Skip to main content
Configure Claude Code, Anthropic’s official CLI coding agent, to use Eden AI for access to 500+ models behind a single API key.

Overview

Claude Code runs in your terminal and edits code in your project. Pointing it at Eden AI gives you:
  • 500+ models: switch between Claude, GPT, Gemini, and more without reinstalling
  • One API key: unified billing and monitoring across providers
  • Provider failover: keep working when an upstream provider has an incident

Prerequisites

Setup

1. Export your API key

To make it permanent, add the export lines to ~/.bashrc or ~/.zshrc and reload your shell.
The -latest aliases always resolve to the newest model in each tier, so your config never goes stale. To pin an exact version instead, use a specific ID such as anthropic/claude-opus-4-8. Browse every ID via List Models.

2. Launch Claude Code

Claude Code now sends requests to Eden AI using the model you set in ANTHROPIC_MODEL.

Switching models

Eden AI uses the provider/model format. Update the ANTHROPIC_MODEL environment variable (or pass --model on the command line) to switch:
Browse the full catalog via List Models or GET https://api.edenai.run/v3/models.

Model pools and routing

Instead of pinning a single model, you can let Eden AI pick the best model for each request or fail over automatically when a provider has an incident.

Automatic routing with @edenai

Set the model to @edenai and Eden AI’s router selects the best available model from its default pool on every request. This works directly in Claude Code, since it only needs the model name:
Smart routing is tuned for general prompts. Claude Code is an agentic tool that leans heavily on tool calling, so for real coding sessions we recommend pinning a strong model (for example anthropic/claude-opus-4-8) or restricting the pool to tool-capable models.

Custom pools and fallbacks

To restrict routing to a specific pool or declare an ordered failover list, you pass these as request-body fields:
  • router_candidates: a custom pool that @edenai chooses from. See Smart Routing.
  • fallbacks: models tried in order if the primary fails. See Fallback.
Claude Code only forwards the model name, not extra body fields, so use router_candidates and fallbacks through the API or an SDK directly rather than Claude Code’s environment variables.

Troubleshooting

Authentication errors

Verify the API key is loaded in your shell and that it has LLM access:

Model not found

Use the full provider/model string (e.g. anthropic/claude-opus-4-8, not claude-opus-4-8). Confirm the ID is in the catalog returned by GET /v3/models.

Connection issues

Confirm ANTHROPIC_BASE_URL is exactly https://api.edenai.run/v3. Check Eden AI status at app-edenai.instatus.com.

Next Steps

  • Codex CLI — OpenAI’s open-source coding agent on Eden AI
  • OpenCode — terminal coding agent with auto-generated config
  • Chat Completions — full reference for the underlying endpoint