> ## Documentation Index
> Fetch the complete documentation index at: https://docs.apiany.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Using in Claude Code

> Configure APIAny.AI API keys, base URLs, and recommended models in Claude Code.

[Claude Code](https://claude.ai/code) can connect to APIAny.AI through environment variables or local configuration files. It is useful for terminal, editor, and automated development workflows.

## Prerequisites

* Claude Code is installed.
* You have created an API key in the [APIAny.AI dashboard](https://apiany.ai/dashboard/api-keys).
* You have selected a model ID.

## Install

```bash theme={null}
npm install -g @anthropic-ai/claude-code
```

## Configure with settings.json

Add this to `~/.claude/settings.json`:

```json theme={null}
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://apiany.ai",
    "ANTHROPIC_AUTH_TOKEN": "sk-xxxxxxxxxxxx",
    "ANTHROPIC_MODEL": "claude-sonnet-4-6",
    "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
  }
}
```

Restart Claude Code after saving. You can also test with temporary environment variables:

```bash theme={null}
export ANTHROPIC_BASE_URL="https://apiany.ai"
export ANTHROPIC_API_KEY="sk-xxxxxxxxxxxx"
export ANTHROPIC_MODEL="claude-sonnet-4-6"
claude
```

## Recommended models

| Model ID            | Best for                                                                        |
| ------------------- | ------------------------------------------------------------------------------- |
| `gpt-5.5`           | Best first choice for complex reasoning, coding, and production workflows.      |
| `gpt-5.4`           | Strong general-purpose model for advanced chat and agent tasks.                 |
| `gpt-5.4-mini`      | Balanced speed, quality, and cost for everyday usage.                           |
| `gpt-4o-mini`       | Fast and economical choice for simple chat, translation, and lightweight tasks. |
| `claude-sonnet-4-6` | Claude-compatible model ID for long-form writing and coding workflows.          |
| `gemini-3.5-flash`  | Gemini-compatible model ID for fast multimodal usage.                           |

## Walkthrough screenshots

The screenshots below show the key configuration screens in Claude Code. API names and endpoints have been adjusted for APIAny.AI.

### Step 1

<img src="https://mintcdn.com/lingquai/Twqr-r52XykGBMod/images/integrations/claude-code/claude-code-cli.png?fit=max&auto=format&n=Twqr-r52XykGBMod&q=85&s=11752b888792a51a62473fb464e682a0" alt="Claude Code setup screenshot 1" width="2574" height="360" data-path="images/integrations/claude-code/claude-code-cli.png" />

## Troubleshooting

### 401 or authentication errors

Make sure the API key is copied completely, has no extra spaces, and is enabled in the APIAny.AI dashboard.

### The model does not appear in the app

Enter the model ID manually and confirm it is available in the [model catalog](/models/chat-models). Some tools do not fetch model lists automatically.

### Which Base URL should I use?

OpenAI-compatible settings usually use `https://apiany.ai/v1`; Claude-compatible settings usually use `https://apiany.ai`; tools that ask for a full endpoint use `https://apiany.ai/v1/chat/completions`.
