How to Configure Multiple OpenAI‑Compatible Providers in reasonix.toml

You configure multiple OpenAI‑compatible providers in reasonix.toml by defining separate [[providers]] array‑of‑tables for each vendor, specifying the name, base_url, api_key, and either model or models fields, then routing requests via provider/model syntax or the global default_model fallback.

The reasonix.toml file is the central configuration hub for the DeepSeek‑Reasonix inference engine, determining which LLM endpoints are available and how to authenticate against them. By leveraging TOML’s array‑of‑tables syntax, you can simultaneously register any number of OpenAI‑compatible services—such as OpenAI, Azure OpenAI, and Anthropic—within a single deployment. This guide explains the exact schema, source implementation, and routing logic used to direct requests to the correct vendor.

Understanding the reasonix.toml Provider Schema

Each provider is defined within a [[providers]] block, which supports the following fields:

  • name – Unique identifier used in the provider/model routing syntax.
  • base_url – The vendor’s API endpoint (e.g., https://api.openai.com/v1).
  • api_key – Authentication token for the vendor.
  • model – Default model string for this provider when a specific model is not requested.
  • models – Alternative to model; an array exposing multiple models under one provider name.
  • supported_efforts – Optional list of effort levels (low, medium, high, max) the provider accepts. Defaults to all levels if omitted.
  • disable_sampling – Boolean flag set to true for vendors like Anthropic that reject temperature or top_p parameters.

As implemented in sdk/go/provider.go, Reasonix parses these definitions at startup to build dedicated HTTP clients for each vendor.

Step‑by‑Step Configuration Guide

Follow these steps to register multiple providers:

  1. Copy the example file – Start with reasonix.example.toml from the repository root as a template.
  2. Define the fallback – Set default_model at the top level, using either a plain model name or provider/model syntax.
  3. Add provider blocks – Append a [[providers]] table for each vendor, ensuring each has a unique name.
  4. Configure capabilities – Set supported_efforts and disable_sampling to match the vendor’s API constraints.
  5. Validate routing – Use provider/model in requests to test explicit routing, or omit the provider to test the default_model fallback.

Complete Configuration Examples

OpenAI and Azure OpenAI Side‑by‑Side

This configuration registers both OpenAI and Azure endpoints, routing to Azure only when explicitly requested:


# reasonix.toml

default_model = "openai/gpt-4o-mini"

[[providers]]
name = "openai"
base_url = "https://api.openai.com/v1"
api_key = "sk-XXXXXXXXXXXXXXXXXXXXXXXX"
model = "gpt-4o-mini"
supported_efforts = ["low", "medium", "high", "max"]

[[providers]]
name = "azure"
base_url = "https://myresource.openai.azure.com/openai/deployments"
api_key = "XXXXXXXXXXXXXXXXXXXXXXXXXXXX"
model = "gpt-4o-mini"
supported_efforts = ["low", "medium"]
disable_sampling = true

Requests resolve as follows:

  • model: "gpt-4o-mini" → Routed to the OpenAI provider via default_model.
  • model: "azure/gpt-4o-mini" → Explicitly selects the Azure provider.

Integrating Anthropic Claude

Add a third provider for Claude, which requires sampling parameters to be disabled:

[[providers]]
name = "anthropic"
base_url = "https://api.anthropic.com/v1"
api_key = "YOUR_ANTHROPIC_API_KEY"
model = "claude-3-5-sonnet-20240620"
disable_sampling = true
supported_efforts = ["high", "max"]

Now model: "anthropic/claude-3-5-sonnet-20240620" routes to the Anthropic endpoint, as handled by the provider logic in internal/provider/anthropic.go.

Serving Multiple Models from One Provider

Expose several models under a single provider name using the models array:

[[providers]]
name = "openai"
base_url = "https://api.openai.com/v1"
api_key = "sk-..."
models = ["gpt-4o-mini", "gpt-4o"]
supported_efforts = ["low", "medium", "high", "max"]

Select specific models with openai/gpt-4o or openai/gpt-4o-mini. The implementation in internal/provider/openai.go maps these strings to the correct API calls.

Advanced Provider Settings

Configuring Effort Levels

The supported_efforts field controls which reasoning effort levels Reasonix advertises for a provider. If a vendor does not support the /effort endpoint, explicitly disable it:

[[providers]]
name = "legacy"
base_url = "https://legacy.example.com/v1"
api_key = "legacy-key"
model = "legacy-model"
supported_efforts = []

Disabling Sampling Parameters

For APIs that reject temperature or top_p, set disable_sampling = true. This prevents Reasonix from sending sampling parameters, adhering to the provider’s requirements as shown in internal/provider/anthropic.go.

How Reasonix Resolves Provider Routing

When Reasonix receives a request, it applies the following resolution logic, implemented in sdk/go/provider.go and internal/provider/openai.go:

  1. Parse the model string – If it contains a /, split into provider and model components.
  2. Lookup provider – Match the provider component against the name fields in [[providers]] tables.
  3. Fallback to default – If no / is present, use the default_model value, which may itself be a provider/model pair or a plain model name resolved against the default provider.

This routing system allows seamless switching between vendors without changing application code.

Summary

  • Use separate [[providers]] array‑of‑tables for each OpenAI‑compatible vendor, ensuring unique name values.
  • Set default_model at the root level to define the fallback when requests omit a provider prefix.
  • Route requests explicitly using provider/model syntax (e.g., azure/gpt-4o-mini).
  • Configure supported_efforts and disable_sampling to match vendor capabilities and avoid API errors.
  • Key source files governing this behavior include reasonix.example.toml, sdk/go/provider.go, and internal/provider/openai.go.

Frequently Asked Questions

How do I specify which provider to use in an API request?

Use the provider/model syntax in your request’s model field. For example, sending "anthropic/claude-3-5-sonnet-20240620" routes the request to the provider named anthropic defined in your reasonix.toml, while "openai/gpt-4o" routes to the openai provider.

What happens if I don't specify a provider in the request?

Reasonix falls back to the default_model value defined at the top of reasonix.toml. If default_model is set to "openai/gpt-4o-mini", all requests without an explicit provider prefix are routed to the openai provider using that model.

Can I disable temperature and top_p for specific providers?

Yes. Set disable_sampling = true inside the provider’s [[providers]] block. This is required for vendors like Anthropic Claude or certain Azure OpenAI configurations that reject sampling parameters, ensuring Reasonix omits temperature and top_p from the API call.

Where does Reasonix parse the provider configuration?

The Go SDK parses reasonix.toml in sdk/go/provider.go, which constructs HTTP clients for each defined provider. Provider‑specific logic, such as handling effort levels and model selection, is implemented in internal/provider/openai.go for OpenAI‑compatible APIs and internal/provider/anthropic.go for Claude‑specific adaptations.

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:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →