| Components | All | New | MacOS | Windows | Linux | iOS | ||||
| Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old | |
FoundationModels.GetMaximumResponseTokens
Queries the maximum number of tokens the model is allowed to produce in its response.
| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
| FoundationModels | 15.5 | ✅ Yes | ❌ No | ❌ No | ❌ No | ✅ Yes |
MBS( "FoundationModels.GetMaximumResponseTokens"; FoundationModel ) More
Parameters
| Parameter | Description | Example |
|---|---|---|
| FoundationModel | The identifier for the model. | $model |
Result
Returns number, nothing or error.
Description
Queries the maximum number of tokens the model is allowed to produce in its response.If the model produce `maximumResponseTokens` before it naturally completes its response, the response will be terminated early. No error will be thrown. This property can be used to protect against unexpectedly verbose responses and runaway generations.
If no value is specified, then the model is allowed to produce the longest answer its context size supports. If the response exceeds that limit without terminating, an error will be thrown.
Returns empty value if not set.
Examples
Queries maximum response tokens:
Set Variable [ $MaximumResponseTokens; Value: MBS( "FoundationModels.GetMaximumResponseTokens" ) ]
See also
This function is free to use.
Created 26th September 2025, last changed 27th September 2025
FoundationModels.CloseSession - FoundationModels.GetTemperature