> ## Documentation Index
> Fetch the complete documentation index at: https://edenai-fix-claude-code-model-ids-and-pools.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Claude Code

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

export const TechArticleSchema = ({title, description, path, articleSection, about, proficiencyLevel = "Beginner", dependencies, keywords = [], datePublished, dateModified, image, inLanguage = "en"}) => {
  const baseUrl = "https://www.edenai.co/docs";
  const canonicalUrl = `${baseUrl}/${path}`.replace(/\/+$/, "");
  const ogParams = new URLSearchParams({
    division: articleSection || "",
    title: title || "",
    description: description || ""
  });
  const resolvedImage = image || `https://edenai.mintlify.app/_mintlify/api/og?${ogParams.toString()}`;
  const data = {
    "@context": "https://schema.org",
    "@type": "TechArticle",
    "@id": `${canonicalUrl}#techarticle`,
    mainEntityOfPage: {
      "@type": "WebPage",
      "@id": canonicalUrl
    },
    headline: title,
    name: title,
    description: description,
    url: canonicalUrl,
    inLanguage: inLanguage,
    isPartOf: {
      "@type": "WebSite",
      name: "Eden AI Documentation",
      url: baseUrl
    },
    author: [{
      "@type": "Organization",
      name: "Eden AI",
      url: "https://www.edenai.co/"
    }],
    publisher: {
      "@type": "Organization",
      name: "Eden AI",
      url: "https://www.edenai.co/",
      logo: {
        "@type": "ImageObject",
        url: "https://www.edenai.co/assets/logo.png"
      }
    }
  };
  if (articleSection) data.articleSection = articleSection;
  if (about) data.about = {
    "@type": "Thing",
    name: about
  };
  if (proficiencyLevel) data.proficiencyLevel = proficiencyLevel;
  if (dependencies) data.dependencies = dependencies;
  if (keywords && keywords.length) data.keywords = keywords;
  if (datePublished) data.datePublished = datePublished;
  if (dateModified) data.dateModified = dateModified;
  data.image = Array.isArray(resolvedImage) ? resolvedImage : [resolvedImage];
  const json = JSON.stringify(data);
  const schemaId = `techarticle-${canonicalUrl}`;
  React.useEffect(() => {
    if (typeof document === "undefined") return;
    document.querySelectorAll(`script[data-schema-id="${schemaId}"]`).forEach(n => n.remove());
    const script = document.createElement("script");
    script.type = "application/ld+json";
    script.dataset.schemaId = schemaId;
    script.textContent = json;
    document.head.appendChild(script);
    return () => script.remove();
  }, [json, schemaId]);
  return null;
};

<TechArticleSchema title={"Claude Code"} description={"Configure Claude Code, Anthropic's official CLI coding agent, to use Eden AI for access to 500+ models behind a single API key."} path="v3/integrations/claude-code" articleSection="Coding Agents" about={"AI Coding Assistants"} proficiencyLevel="Intermediate" keywords={["Eden AI", "AI API", "Claude Code"]} datePublished="2026-05-06T00:00:00Z" dateModified="2026-07-10T00:00:00Z" />

Configure [Claude Code](https://github.com/anthropics/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

* Claude Code installed ([install instructions](https://github.com/anthropics/claude-code))
* Eden AI API key from [app.edenai.run](https://app.edenai.run) → **API Keys**

## Setup

### 1. Export your API key

<CodeGroup>
  ```bash bash / zsh theme={null}
  export ANTHROPIC_API_KEY="YOUR_EDEN_AI_API_KEY"
  export ANTHROPIC_BASE_URL="https://api.edenai.run/v3"
  export ANTHROPIC_MODEL="anthropic/claude-opus-latest"
  export ANTHROPIC_DEFAULT_HAIKU_MODEL="anthropic/claude-haiku-latest"
  export ANTHROPIC_DEFAULT_SONNET_MODEL="anthropic/claude-sonnet-latest"
  export ANTHROPIC_DEFAULT_OPUS_MODEL="anthropic/claude-opus-latest"
  ```

  ```powershell PowerShell theme={null}
  $env:ANTHROPIC_API_KEY = "YOUR_EDEN_AI_API_KEY"
  $env:ANTHROPIC_BASE_URL = "https://api.edenai.run/v3"
  $env:ANTHROPIC_MODEL = "anthropic/claude-opus-latest"
  $env:ANTHROPIC_DEFAULT_HAIKU_MODEL="anthropic/claude-haiku-latest"
  $env:ANTHROPIC_DEFAULT_SONNET_MODEL="anthropic/claude-sonnet-latest"
  $env:ANTHROPIC_DEFAULT_OPUS_MODEL="anthropic/claude-opus-latest"
  ```
</CodeGroup>

To make it permanent, add the `export` lines to `~/.bashrc` or `~/.zshrc` and reload your shell.

<Tip>
  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](/v3/llms/listing-models).
</Tip>

### 2. Launch Claude Code

```bash theme={null}
claude
```

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:

<CodeGroup>
  ```bash Claude variants theme={null}
  export ANTHROPIC_MODEL="anthropic/claude-opus-4-8"     # most capable
  export ANTHROPIC_MODEL="anthropic/claude-sonnet-5"     # balanced
  export ANTHROPIC_MODEL="anthropic/claude-haiku-4-5"    # fastest
  ```

  ```bash Other providers theme={null}
  export ANTHROPIC_MODEL="openai/gpt-4o"
  export ANTHROPIC_MODEL="google/gemini-2.5-pro"
  ```
</CodeGroup>

Browse the full catalog via [List Models](/v3/llms/listing-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:

<CodeGroup>
  ```bash bash / zsh theme={null}
  export ANTHROPIC_MODEL="@edenai"
  ```

  ```powershell PowerShell theme={null}
  $env:ANTHROPIC_MODEL = "@edenai"
  ```
</CodeGroup>

<Note>
  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.
</Note>

### 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](/v3/llms/smart-routing).
* **`fallbacks`**: models tried in order if the primary fails. See [Fallback](/v3/general/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:

```bash theme={null}
echo $ANTHROPIC_API_KEY

curl -X POST https://api.edenai.run/v3/chat/completions \
  -H "Authorization: Bearer $ANTHROPIC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "anthropic/claude-opus-4-8", "messages": [{"role": "user", "content": "ping"}]}'
```

### 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](https://app-edenai.instatus.com).

## Next Steps

* [Codex CLI](./codex-cli) — OpenAI's open-source coding agent on Eden AI
* [OpenCode](./opencode) — terminal coding agent with auto-generated config
* [Chat Completions](/v3/llms/chat-completions) — full reference for the underlying endpoint
