How to Configure Provider Model Overrides and Pricing in reasonix.toml
To configure provider model overrides and pricing in reasonix.toml, define a [[providers]] block and use the model_overrides map for per-model settings and the prices map for custom per-token costs.
The reasonix.toml file serves as the central configuration hub for the DeepSeek-Reasonix engine, controlling which AI providers are available and how their models are priced. By configuring provider model overrides and pricing in reasonix.toml, you can fine-tune context windows, enable vision capabilities, and lock in specific rates per million tokens. The configuration system follows a four-level hierarchy where project-level settings take precedence over global defaults but yield to command-line flags.
Configuration Hierarchy and Precedence
DeepSeek-Reasonix evaluates configuration settings across four distinct levels, with each level overriding the one below it:
- Command-line flags – Highest priority, temporary overrides for single invocations
./reasonix.toml– Project-level configuration in the current working directory<Reasonix-home>/config.toml– Global user configuration- Built-in defaults – Lowest priority, fallback values defined in the source
When you configure provider model overrides and pricing in reasonix.toml at the project level, those settings persist across sessions while remaining portable via version control.
Defining Provider Model Overrides
The model_overrides key within a [[providers]] block allows you to override provider-wide defaults for specific models. According to internal/config/config.go (lines 1376-1380), this field maps model IDs to ProviderModelOverride structures.
Common override fields include:
context_window– Adjust the maximum token context for models with different limits than the provider defaultmax_output_tokens– Cap the response length for specific modelsreasoning_protocol– Select extended reasoning implementations (e.g.,"openai"or"none")vision– Boolean flag to enable or disable vision capabilities per model
In reasonix.example.toml (line 67), the syntax appears as a TOML inline table:
model_overrides = { "deepseek-v4-flash" = { context_window = 1000000 } }
For mixed-gateway providers where models expose differing capabilities, you can disable reasoning for one model while enabling vision for another:
[[providers]]
name = "openai-compatible-custom"
kind = "openai"
base_url = "https://api.example.com/v1"
models = ["model-a", "model-b"]
model_overrides = {
"model-b" = {
reasoning_protocol = "none",
vision = true
}
}
Configuring Custom Pricing
The prices map locks in per-model costs, overriding any provider-wide defaults. As implemented in internal/config/pricing.go (lines 41-44), the system back-fills built-in defaults only when you omit custom rates.
Each pricing entry supports:
input– Cost per 1 million input tokensoutput– Cost per 1 million output tokenscache_hit– Cost per 1 million cached tokenscurrency– Currency symbol or code (e.g.,"¥","USD")
From reasonix.example.toml (lines 71+):
prices = {
"deepseek-v4-flash" = { cache_hit = 0.02, input = 1, output = 2, currency = "¥" },
"deepseek-v4-pro" = { cache_hit = 0.025, input = 3, output = 6, currency = "¥" }
}
This configuration ensures that cost-tracking and quota enforcement use your specified rates rather than fluctuating provider defaults.
Complete Configuration Example
Combine both features in a single provider definition:
[[providers]]
name = "deepseek"
kind = "openai"
base_url = "https://api.deepseek.com"
models = ["deepseek-v4-flash", "deepseek-v4-pro"]
default = "deepseek-v4-flash"
api_key_env = "DEEPSEEK_API_KEY"
context_window = 1000000
# Override specific model capabilities
model_overrides = {
"deepseek-v4-flash" = { context_window = 2000000 }
}
# Lock in pricing (per 1M tokens)
prices = {
"deepseek-v4-flash" = { cache_hit = 0.02, input = 1, output = 2, currency = "¥" },
"deepseek-v4-pro" = { cache_hit = 0.025, input = 3, output = 6, currency = "¥" }
}
The internal/config/render.go file (lines 381-384) handles serializing these maps back to TOML, ensuring that programmatic changes persist correctly to disk.
Key Implementation Files
Understanding the source structure helps troubleshoot configuration issues:
reasonix.example.toml– Canonical reference showing all supported keys and syntax patternsinternal/config/config.go– Defines theConfigstruct withModelOverridesandPricesfields mapped directly to TOML keysinternal/config/pricing.go– Implements pricing validation and default back-fill logicinternal/config/render.go– Serializes configuration changes back to TOML formatdocs/SPEC.md(lines 103-107) – Formal specification of the configuration format
Summary
- Configuration hierarchy places
./reasonix.tomlbetween command-line flags and global settings, making it ideal for project-specific overrides. - Model overrides use the
model_overridesmap to adjustcontext_window,vision,reasoning_protocol, and other per-model capabilities. - Custom pricing is set via the
pricesmap withinput,output,cache_hit, andcurrencyfields, overriding provider defaults. - Source code in
internal/config/handles parsing, validation, and persistence of these settings.
Frequently Asked Questions
What happens if I specify a model in prices but not in model_overrides?
The model will use the custom pricing rates you defined while inheriting all other settings (context window, vision support, etc.) from the provider-wide defaults. The prices and model_overrides maps operate independently in reasonix.toml.
Can I use different currencies for different models within the same provider?
Yes. Each entry in the prices map includes its own currency field, allowing you to specify "¥" for one model and "USD" for another. The cost-tracking system records expenses using the currency defined for each specific model.
How do I temporarily override a setting without modifying reasonix.toml?
Use command-line flags, which take precedence over all configuration file settings. The hierarchy defined in the DeepSeek-Reasonix source code ensures that CLI arguments override ./reasonix.toml, which in turn overrides the global <Reasonix-home>/config.toml.
Where does Reasonix store the built-in default pricing?
Built-in defaults are hardcoded in the source and applied in internal/config/pricing.go only when you do not supply custom rates in the prices map. If you specify any pricing field for a model, the system uses your values exclusively without merging with defaults.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →