The model's: the client's context window less the reply it must leave room for, less the standard 8% headroom (HeadroomPercent.Standard) for the tokenizer's approximation and the message framing. The reply is the call's maxTokens when it sets one; otherwise the client's reserveCompletion, capped at a quarter of the window, since the registry reports some models' whole window as their output limit (Ollama's llama3: 8192 of 8192). The budget is at least 1 token for a positive window. The client reads its window from the model registry, so a model the registry knows gets its own.
The model's: the client's context window less the reply it must leave room for, less the standard 8% headroom (HeadroomPercent.Standard) for the tokenizer's approximation and the message framing. The reply is the call's maxTokens when it sets one; otherwise the client's reserveCompletion, capped at a quarter of the window, since the registry reports some models' whole window as their output limit (Ollama's llama3: 8192 of 8192). The budget is at least 1 token for a positive window. The client reads its window from the model registry, so a model the registry knows gets its own.