Coding Agents
BasicRouter works with coding agents and AI development tools that support OpenAI-compatible or Anthropic-compatible API endpoints. Use routing aliases such as mwf/coding-auto so BasicRouter can route to the best available coding model without requiring developers to change tool configuration.
Generic OpenAI-compatible setup
Use this setup for Cursor, Codex, Hermes, OpenClaw, Continue, Aider, Cline, LangChain-based agents, LlamaIndex-based agents, and custom OpenAI-compatible agent runtimes.
export OPENAI_BASE_URL="https://api.basicrouter.ai/api/v1"
export OPENAI_API_KEY="$BASICROUTER_API_KEY"
export OPENAI_MODEL="mwf/coding-auto"Generic Anthropic-compatible setup
Use this setup for Claude-compatible clients and tools that expect Anthropic Messages format.
export ANTHROPIC_BASE_URL="https://api.basicrouter.ai/api/anthropic"
export ANTHROPIC_API_KEY="$BASICROUTER_API_KEY"
export ANTHROPIC_MODEL="mwf/coding-auto"Recommended agent models
| Use case | Recommended alias | Requirements |
|---|---|---|
| General coding | mwf/coding-auto | Tool calling, streaming, strong coding ability. |
| Fast coding chat | mwf/coding-fast | Low latency and streaming. |
| Large repo analysis | mwf/coding-long | Long context and stable output. |
| Cost-sensitive coding assistant | mwf/low-cost | Lower price and acceptable coding quality. |
| UI screenshot / vision coding | mwf/vision-chat | Vision input and text output. |
Cursor quick guide
Use the OpenAI-compatible endpoint.
Base URL: https://api.basicrouter.ai/api/v1
API Key: BASICROUTER_API_KEY
Model: mwf/coding-autoRecommended steps:
- Open Cursor settings.
- Add or enable OpenAI-compatible API key configuration.
- Set the OpenAI base URL override to
https://api.basicrouter.ai/api/v1. - Add a custom model such as
mwf/coding-auto,mwf/coding-fast, ormwf/coding-long. - Use a model that supports streaming and tool calling for best agent behavior.
Troubleshooting:
| Issue | Suggested fix |
|---|---|
| Model not shown | Add the model name manually as a custom model. |
| Tool calling fails | Use a model with tool_calling: true in the Models page. |
| Streaming interrupted | Retry with backoff or use a routing alias with fallback. |
| 401 error | Check the API key and base URL. |
| 404 model error | Confirm the model is enabled for the account. |
Claude Code quick guide
Use the Anthropic-compatible gateway endpoint.
export ANTHROPIC_BASE_URL="https://api.basicrouter.ai/api/anthropic"
export ANTHROPIC_API_KEY="$BASICROUTER_API_KEY"
export ANTHROPIC_MODEL="mwf/coding-auto"BasicRouter supports this Anthropic-compatible path for Claude Code and Anthropic SDK compatibility:
POST /api/v1/messagesRecommended requirements:
| Requirement | Reason |
|---|---|
| Anthropic Messages-compatible request shape | Claude Code expects Anthropic-style messages. |
| Streaming support | Claude Code relies on streaming UX. |
| Tool calling support | Required for agentic coding workflows. |
| Long context | Useful for repository-level tasks. |
| Stable fallback | Useful for long-running coding sessions. |
Codex quick guide
Use BasicRouter as a custom OpenAI-compatible model provider.
Example provider configuration:
[model_providers.basicrouter]
name = "BasicRouter"
base_url = "https://api.basicrouter.ai/api/v1"
env_key = "BASICROUTER_API_KEY"
wire_api = "responses"
model_provider = "basicrouter"
model = "mwf/coding-auto"Environment variable:
export BASICROUTER_API_KEY="br_xxx"Recommended models:
| Model | Use case |
|---|---|
mwf/coding-auto | Default coding agent model. |
mwf/coding-long | Large repository context. |
mwf/coding-fast | Fast iteration and small changes. |
Troubleshooting:
| Issue | Suggested fix |
|---|---|
| Auth error | Confirm env_key points to BASICROUTER_API_KEY. |
| Model not found | Add the alias in BasicRouter Console or use a direct model ID. |
| Responses API error | Use wire_api = "responses" only for models and endpoints that support Responses. |
| Chat Completions-only model | Switch to a chat-compatible wire API if the client supports it. |
Hermes quick guide
Use the OpenAI-compatible endpoint unless your Hermes deployment is configured for another protocol.
export OPENAI_BASE_URL="https://api.basicrouter.ai/api/v1"
export OPENAI_API_KEY="$BASICROUTER_API_KEY"
export OPENAI_MODEL="mwf/coding-auto"Recommended model policy:
| Hermes workload | Model |
|---|---|
| General code generation | mwf/coding-auto |
| Low-latency task execution | mwf/coding-fast |
| Long-context repo scan | mwf/coding-long |
| Cost-sensitive background tasks | mwf/low-cost |
OpenClaw quick guide
Use the OpenAI-compatible endpoint for OpenAI-style agent runtime configuration.
export OPENAI_BASE_URL="https://api.basicrouter.ai/api/v1"
export OPENAI_API_KEY="$BASICROUTER_API_KEY"
export OPENAI_MODEL="mwf/coding-auto"If OpenClaw supports multiple providers, configure BasicRouter as an OpenAI-compatible provider and use BasicRouter routing aliases for model selection.
{
"provider": "openai-compatible",
"base_url": "https://api.basicrouter.ai/api/v1",
"api_key_env": "BASICROUTER_API_KEY",
"model": "mwf/coding-auto"
}Agent compatibility checklist
| Capability | Required for |
|---|---|
| Streaming | Good terminal/editor UX. |
| Tool calling | Agentic coding, file edits, command execution. |
| Long context | Large repositories and multi-file changes. |
| Structured outputs | Planning, task decomposition, automated workflows. |
| Vision input | UI screenshot analysis and design-to-code workflows. |
| Fallback | Production stability and long-running tasks. |
