How coding agents connect to backends
Coding agents send chat completions (and often tool calls) over HTTP. They read an endpoint URL and an API key from environment variables or a config file. Tokios exposes both an OpenAI-compatible and an Anthropic-compatible surface at the same URL, so most agents work with a single configuration change.Prerequisites
- A running Tokios connector paired with your local model — see Connector install
- A registered deployment name — see Register a model
- A Tokios API key — see API keys
Claude Code
Claude Code uses the Anthropic Messages API. Set 2 environment variables and pass your deployment name with--model:
- macOS & Linux
- Windows CMD
- Windows PowerShell
claude-* ids. Always pass --model explicitly with your Tokios deployment name. See the full Claude Code guide for persistence and troubleshooting.
OpenCode
OpenCode uses the AI SDK with an OpenAI-compatible provider. Add Tokios toopencode.json:
opencode.json
Aider
Aider reads OpenAI-compatible configuration from environment variables:openai/ prefix tells Aider to use the OpenAI chat completions format. Aider supports tool calling with most models that implement the OpenAI function-calling schema.
Cline
Cline connects to custom OpenAI-compatible endpoints through its VS Code settings:- Open Cline settings in VS Code.
- Under API Configuration, select OpenAI Compatible.
- Set Base URL to
https://api.tokios.com/v1. - Paste your
sk-tok-YOUR_KEYin the API Key field. - Enter your deployment name (e.g.
qwen3-coder) as the Model ID.
Continue
Add Tokios as a custom provider in~/.continue/config.json:
~/.continue/config.json
Roo Code
Roo Code uses the same OpenAI-compatible endpoint pattern:- Open Roo Code settings.
- Select OpenAI Compatible as the API provider.
- Set Base URL to
https://api.tokios.com/v1. - Enter your API key and deployment name.
Switch models without reconfiguring
Because every agent reads the model name from a single field — themodel parameter in the API request — you can register multiple deployments on Tokios and swap between them without touching any agent config:
Model recommendations for coding
Not all local models handle coding tasks equally well. Tool calling — the ability to invoke functions, read files, and run commands — is critical for agent-based workflows.Tips for coding with local models
Use a model that supports tool calling. Agents like Claude Code, OpenCode, and Cline rely on structured function calls. If your model doesn’t support the OpenAI function-calling schema, the agent falls back to text-based tool invocation, which is slower and less reliable. Set context length appropriately. Coding agents send large prompts with file contents and conversation history. Set--max-model-len on your inference server to at least 8192 tokens. Models with 32K+ context handle multi-file tasks better.
Prefer MoE models for throughput. Mixture-of-experts models like Qwen3.5-35B-A3B activate only a fraction of their parameters per token, delivering higher throughput than dense models of similar total size. For iterative coding tasks where latency matters, MoE is often the better choice.
Test tool calls before relying on them. Send a quick test with a tool-calling payload to confirm your model and backend handle function calls correctly:
tool_calls array, tool calling works.
One endpoint for all your agents
Tokios gives every coding agent the same URL and API key. Register your models once, generate 1 API key, and configure any number of agents to point athttps://api.tokios.com. Switch models, add new backends, or move models to different hardware — your agent configurations don’t change.
Model routing
Learn how to register multiple models and route requests by deployment name.
Choose a local model
Compare backends and quantization options before committing a model to agentic workflows.