Reasonix is hard-coded to talk to a provider endpoint, not to a model name. Adding a new endpoint is a [[providers]] entry in ~/.reasonix/config.toml and a matching API key in ~/.reasonix/.env. The same shape works for local llama.cpp, Ollama, vLLM, and remote gateways.

Reasonix files and directories at a glance

How a Reasonix turn flows from input to provider to tools

Reasonix version timeline: 0.x TS legacy, 1.0 Go rewrite, current 1.17.x

Common endpoints

Provider base_url Sample model API key env
Ollama (local) http://127.0.0.1:11434/v1 qwen2.5-coder:14b no real key — any string
lm-studio (local) http://127.0.0.1:1234/v1 mlx-community/Qwen2.5-Coder-14B-Instruct no real key — any string
vLLM (local/cluster) http://127.0.0.1:8000/v1 meta-llama/Meta-Llama-3-8B-Instruct no real key — any string
OpenRouter https://openrouter.ai/api/v1 openai/gpt-4o-mini OPENROUTER_API_KEY
Internal gateway https://llm.internal/v1 mistral-large-latest INTERNAL_GATEWAY_API_KEY

The configuration

Two files: TOML for non-secret configuration, .env for key values. Resolution order is flag > ./reasonix.toml > ~/.reasonix/config.toml > built-in defaults.

Toml
# ~/.reasonix/config.toml
default_model = "local-coder"

[[providers]]
name        = "local-coder"
kind        = "openai"
base_url    = "http://127.0.0.1:11434/v1"          # Ollama default
models      = ["qwen2.5-coder:14b", "deepseek-coder-v2:16b"]
default     = "qwen2.5-coder:14b"
api_key_env = "OLLAMA_API_KEY"
# extra_body is merged into every chat-completions request body
extra_body  = { num_ctx = 32768 }

[[providers]]
name        = "openrouter"
kind        = "openai"
base_url    = "https://openrouter.ai/api/v1"
models      = ["openai/gpt-4o-mini", "anthropic/claude-3.5-sonnet"]
default     = "openai/gpt-4o-mini"
api_key_env = "OPENROUTER_API_KEY"

# ~/.reasonix/.env
OLLAMA_API_KEY=ollama
OPENROUTER_API_KEY=sk-or-v1-...

# pick the provider/model at launch
reasonix --model local-coder/qwen2.5-coder:14b
reasonix run "explain this file" --model openrouter/anthropic/claude-3.5-sonnet

Provider knobs worth knowing

Key Purpose
chat_url Full chat URL — Reasonix will not append /chat/completions.
models_url Separate address for /v1/models discovery. Useful when discovery is on a different host.
extra_body Vendor-specific body fields merged into every request. Cannot override model, messages, tools, stream.
context_window Per-model token budget; override via model_overrides when one endpoint exposes several models with different limits.
effort high or max when the provider supports a reasoning-effort knob; omit for auto.
prices Optional {input, output, cache_hit, currency} overrides for cost telemetry.

Common failure modes

  • base_url must end in /v1 for OpenAI-compatible servers. Ollama, lm-studio and vLLM all default to /v1; gateways vary. Forgetting this gives 404 on chat/completions.
  • API key value goes in ~/.reasonix/.env, not in config.toml. api_key_env is the variable name, not the key.
  • Local servers do not validate the key, but Reasonix still requires a non-empty value in .env. Use OLLAMA_API_KEY=ollama rather than leaving it blank.
  • extra_body cannot replace model. If your endpoint expects the model id in a non-standard field, use a server-side rewrite or a vendor-specific chat_url shim.
  • Switching providers mid-session rebuilds the controller but preserves history. Switching work_mode rebuilds; switching tool_approval does not.

Sources

Last modified: 2026年7月23日

Author

Comments

Write a Reply or Comment

Your email address will not be published.