Smart Router · Coding agents

Claude Code with the AI Stupid Level Smart Router

Two environment variables send Claude Code through the router’s native Anthropic Messages passthrough: your own Anthropic key, no token markup, and the same allowance, budgets and request logs as every other endpoint.

Get a free router key

1,000 routed requests a month free · your own provider keys · no card

Part of Smart Router integrations · About the Smart Router · Help centre

ShellShell
export ANTHROPIC_BASE_URL="https://aistupidlevel.info"
export ANTHROPIC_API_KEY="aism_your_key_here"
claude

01

What Claude Code gets from the Smart Router

Two environment variables send Claude Code through the router’s native Anthropic Messages passthrough: your own Anthropic key, no token markup, and the same allowance, budgets and request logs as every other endpoint.

A native Anthropic Messages passthrough
POST /v1/messages forwards Claude Code’s requests to Anthropic with your Anthropic key, for the Claude model Claude Code names, and returns the native Anthropic response format — not an OpenAI translation.
One key for every tool
The same aism_ key serves Claude Code and every OpenAI-compatible tool you connect. Your Anthropic key is stored once under Providers, encrypted at rest (AES-256-GCM) and never shown again.
No token markup
The router adds nothing to token prices. Free includes 1,000 routed requests a month, and only successful requests count.
Allowance, budgets and request logs
Your plan allowance, budgets and request logs apply as on the other endpoints. Token counting, POST /v1/messages/count_tokens, is free at Anthropic and is not counted against your plan.

02

How to set up Claude Code with the Smart Router

Every value below is the one in the router documentation; paste it as shown.

  1. Create a router key

    Go to API keys, click Create key and copy it somewhere safe. The key starts with aism_ and is the one key for every tool you connect.

  2. Add your Anthropic provider key

    The Messages passthrough requires an active Anthropic provider key: add it under Providers. It is encrypted at rest (AES-256-GCM) and never shown again; the request to Anthropic is made with it.

  3. Set two environment variables and start Claude Code

    ANTHROPIC_BASE_URL is the site root without /v1: Claude Code calls the Messages endpoint, POST https://aistupidlevel.info/v1/messages, itself. The router key goes in ANTHROPIC_API_KEY. The endpoint accepts aism_ keys via either x-api-key or Authorization: Bearer, so Claude Code’s ANTHROPIC_AUTH_TOKEN, which sends a Bearer header, works as well.

    ShellShell
    export ANTHROPIC_BASE_URL="https://aistupidlevel.info"
    export ANTHROPIC_API_KEY="aism_your_key_here"
    claude
  4. Optional: add the MCP server for benchmark tools

    Rankings, drift, incidents, route previews and router answers become tools in the editor. The benchmark tools take a Data API key (asl_live_…) from Data API keys; the router answers use your aism_ key.

    Claude CodeShell
    claude mcp add aistupidlevel -e ASL_DATA_KEY=asl_live_... -e ASL_ROUTER_KEY=aism_... -- npx -y @aistupidlevel/mcp

03

Which model does Claude Code use?

There is no routing on this path: the request goes to Anthropic, with your Anthropic key, for the Claude model Claude Code names, so you choose the model in Claude Code as you normally do. The auto-* routing modes belong to the OpenAI-compatible endpoint, POST /v1/chat/completions, which Claude Code does not speak. For benchmark data inside Claude Code, the MCP server adds rankings, drift, incidents, route previews and router answers as tools.

As of 26 Oct 2026, 10:51 UTC · this path passes through to Anthropic and does not route · the boards the routed tools use are on the full leaderboard

04

What Claude Code supports behind the router

  • Native Anthropic Messages API passthrough: POST /v1/messages and POST /v1/messages/count_tokens, returning the native Anthropic response format, not OpenAI-translated.
  • The anthropic-version header is forwarded as sent (default 2023-06-01), and so is any anthropic-beta header.
  • count_tokens is free at Anthropic, so it is not counted against your plan.
  • The aism_ key is accepted via either x-api-key or Authorization: Bearer.
  • No routing on this path: the request goes to Anthropic, with your Anthropic key, for the Claude model Claude Code names. Your plan allowance, budgets and request logs apply as on the other endpoints.

05

Claude Code not working with the router?

The errors a tool shows, with the fix from the docs’ error table and the help centre.

Claude Code reports an invalid key on start
The variable that reaches the router must hold the aism_ key, not your Anthropic key: ANTHROPIC_API_KEY (sent as x-api-key) or ANTHROPIC_AUTH_TOKEN (sent as a Bearer header). Your real Anthropic key lives under Providers.
Requests reach Anthropic but fail
A 400 provider_key_rejected or no_provider_keys means the Anthropic key under Providers is missing or was refused; 429 provider_quota_exceeded means your Anthropic account refused for credit or quota. Re-check the key and its credits on Anthropic’s dashboard.
401 invalid_api_key
Missing or invalid aism_ key. Check the key is correct and not revoked, and that the tool sends it as Authorization: Bearer aism_…. If a field insists on an sk- prefix, sk-aism_… is accepted: the prefix is stripped automatically. A key that had an expiry date and passed it gets 401 expired_api_key, and the message says when.
400 model_not_found
An unknown auto-* name is a 400 that lists the valid routing modes. For a real model id, check the spelling: direct pin routing infers the provider from the model name prefix, and GET /v1/models lists every id you can use.
No models in the dropdown
The tool fills its list from GET /v1/models, which requires a valid aism_ key. Check that the key and the base URL https://aistupidlevel.info/v1 are both in place.
400 provider_key_rejected or no_provider_keys
Your provider key is missing or was refused. Add or update it under Providers, re-check it on the provider’s dashboard, and make sure it has active credits and the right permissions.
Streaming
Set stream: true. Text arrives as the model writes it (X-AISM-Streaming-Mode: native); tool calls arrive in one chunk each once the model has finished them, then the finish reason, then usage if you set stream_options.include_usage. If the chosen model fails before sending anything, or its provider sends nothing for 120 seconds, the next fallback is tried.
400 unsupported_content
The router routes text only, on purpose: it picks a model from benchmark results for coding, reasoning and tool use, and none of those measure image, audio or file understanding. Send such requests to the provider directly.
429 allowance_exhausted
This month’s requests are used up and you have no prepaid credits. Credits top up the allowance; moving up a plan is the cheaper way to buy regular volume.

06

Questions about Claude Code and the Smart Router

Does Claude Code route between models through the Smart Router?

No. Claude Code speaks the Anthropic Messages API, and the router passes it through natively: the request goes to Anthropic, with your Anthropic key, for the Claude model Claude Code names. What you gain is one key for every tool, plus the same allowance, budgets and request logs as every other endpoint. Benchmark-driven routing lives on the OpenAI-compatible endpoint, which the other integrations use; inside Claude Code, the MCP server adds route previews and router answers as tools.

Why is ANTHROPIC_BASE_URL set without /v1?

Because Claude Code appends the Messages path itself. The passthrough endpoint is POST https://aistupidlevel.info/v1/messages, so the base URL is https://aistupidlevel.info. A base URL ending in /v1 would double the segment.

Does this cost extra?

No. You pay the providers directly for tokens, with your own keys; the router adds nothing to token prices. The Free plan includes 1,000 routed requests a month (Pro Intelligence 10,000, Developer 100,000, Teams 1,000,000), and prepaid credits cover any beyond that at $5 per 10,000. Only successful requests count. No card for the Free plan.

Which key goes where?

ANTHROPIC_API_KEY (or ANTHROPIC_AUTH_TOKEN) holds your router key, aism_…; the endpoint accepts it via x-api-key or Authorization: Bearer. Your real Anthropic key is stored once under Providers, encrypted at rest (AES-256-GCM) and never shown again.

Is token counting counted against my plan?

No. POST /v1/messages/count_tokens is passed through and is free at Anthropic, so it is not counted. Chat requests count as usual, and only successful requests count.

07

Other tools that work with the Smart Router

Every tool takes the same base URL and key. The integrations hub lists them all; the docs add samples for frameworks and SDKs.

Connect Claude Code in a few minutes

A free account gives you a router key, the Providers page for your own keys, and the request allowance. No card.

Get a free router key

1,000 routed requests a month free · your own provider keys · no card