Skip to main content

Coding agents

Terminal coding agents are hard-wired to their vendor's API: Claude Code speaks Anthropic Messages, Codex speaks OpenAI Responses. MindsHub speaks both, so one key covers both agents, and either agent can drive any model in the catalog. Claude Code works today; Codex support is coming.

You get three things a vendor-native setup doesn't:

  • Model switching. Run Claude Code on Kimi K3 or DeepSeek V4 Pro while its own tools (file edits, shell, search) keep working.
  • Centralized billing. Both agents, plus your application traffic, draw one prepaid balance and appear in one usage summary. No per-vendor subscriptions to reconcile.
  • One credential to rotate. A single MindsHub key, revocable from the console, instead of an Anthropic key plus an OpenAI key plus whatever else.

Claude Code

Two environment variables:

export ANTHROPIC_BASE_URL="https://api.mindshub.ai" # host only, no /v1
export ANTHROPIC_AUTH_TOKEN="$MINDSHUB_API_KEY" # AUTH_TOKEN, not API_KEY
claude --model kimi
  • ANTHROPIC_AUTH_TOKEN, not ANTHROPIC_API_KEY. The auth-token variable sends Authorization: Bearer …, the only header MindsHub accepts. ANTHROPIC_API_KEY sends x-api-key and gets a 401 before the request reaches the API. If both are set, the auth token wins.
  • The base URL is the host only. The client appends /v1/messages itself; adding /v1 yields a confusing model error rather than a URL error.
  • Optionally isolate the profile. export CLAUDE_CONFIG_DIR="$HOME/.claude-mindshub" keeps MindsHub sessions separate from your claude.ai login. Not required for auth, since the auth token outranks a stored login, but it's the fix if a startup 401 shows Claude Code preferring the stored login anyway.

Switch models mid-session with /model, or start on one:

claude --model sonnet # Claude Sonnet 5
claude --model kimi # Kimi K3
claude --model deepseek # DeepSeek V4 Pro
claude --model gpt # GPT 5.6 Sol, in Claude Code

Claude Code's own model picker also works unmodified: real Claude model names like claude-sonnet-5 or claude-opus-5[1m] map onto the matching alias by family. Claude Code can even run its main loop and its subagents on different catalog models; see Mix models in one session.

Deep guide, with verified troubleshooting: Kimi K3 in Claude Code.

OpenAI Codex

Codex speaks the Responses format. Codex is not usable yet; the config below is what will work once the Responses upgrade ships. Status lives in the Codex guide.

Add MindsHub as a model provider in ~/.codex/config.toml:

model = "gpt"
model_provider = "mindshub"

[model_providers.mindshub]
name = "MindsHub"
base_url = "https://api.mindshub.ai/v1"
env_key = "MINDSHUB_API_KEY"
wire_api = "responses"

Then export the key and run it:

export MINDSHUB_API_KEY="mdb_..."
codex
  • base_url includes /v1 here, the opposite of the Claude Code setup: Codex follows the OpenAI convention.
  • env_key names the environment variable Codex reads the key from; it does not hold the key itself.
  • wire_api = "responses" is required. Codex removed its Chat Completions mode in early 2026.

Switch models by changing model in the config, or per run:

codex --model sonnet # Claude Sonnet 5, in Codex
codex --model kimi # Kimi K3
codex --model gpt-codex # GPT 5.3 Codex

Deep guide: MindsHub in Codex.

VS Code and other editors

VS Code chat reaches MindsHub through Copilot's Custom Endpoint provider, which speaks Chat Completions. Chat and agent mode both work, including tool calling. See MindsHub in VS Code.

Other tools that speak Chat Completions to a custom base URL generally work the same way: point them at https://api.mindshub.ai/v1 with a catalog alias as the model name, and test before relying on features beyond chat (the accepted-and-ignored list applies).

Picking a model for agent work

Agents consume tokens quickly: long system prompts, large file contexts, many turns. That makes model choice a cost decision as much as a quality one.

AliasModelWhy you'd pick it
sonnetClaude Sonnet 5Strong general coding, mid-range price
opusClaude Opus 5Hardest reasoning tasks, most expensive
gpt-codexGPT 5.3 CodexTuned for code
kimiKimi K3Agentic coding at lower cost
deepseekDeepSeek V4 ProCheapest capable option for bulk work

Prices are in the price list. Two cost notes specific to agents:

  • Claude Code's default model maps to opus, one of the priciest in the catalog. Pick a cheaper model explicitly if cost matters.
  • Caching works in your favor. Agents cache aggressively, and cached reads bill at roughly a tenth of the input rate. Cache writes are billable and never draw included tokens.

The cost display in your agent is not your bill

Claude Code prices sessions locally at its vendor's list rates, so on a non-Claude model its dollar figure is wrong. Codex reports token counts with no dollar figure at all. Neither knows MindsHub's prices for the model actually serving the request.

The authoritative number is always:

curl "https://auth.mindshub.ai/v1/usage/summary/?range=period&group_by=model" \
-H "Authorization: Bearer $MINDSHUB_API_KEY"

That returns per-model tokens and cost for the current billing period, across every agent and application on the key.

Separate keys are for revocation

Give each machine and agent its own key from the console: revoking your laptop's key then doesn't touch production. Don't expect separate keys to split your bill, though. Usage is reported for the organization as a whole, grouped by model only, so two keys on the same account meter into the same rows.

Troubleshooting

SymptomCause and fix
401 at startup in Claude CodeKey is in ANTHROPIC_API_KEY, which sends the wrong header: use ANTHROPIC_AUTH_TOKEN. Or a stored claude.ai login is winning: set CLAUDE_CONFIG_DIR to a fresh directory.
There's an issue with the selected modelEither the model isn't a catalog alias (kimi, not kimi-k3), or ANTHROPIC_BASE_URL has a /v1 suffix it shouldn't.
Codex 404 / Not Foundbase_url must end in /v1 for Codex.
Codex ignores the keyenv_key names the variable, not the value. Confirm MINDSHUB_API_KEY is exported in the shell running codex.
Replies truncate mid-answerThe model's internal reasoning used the output budget. In Claude Code, set CLAUDE_CODE_MAX_OUTPUT_TOKENS=8192 or higher and restart.
429 under heavy agent useThroughput limit, not funding. See Rate limits.

More symptoms in Errors and in each agent's deep guide.