# Claude Code and Codex Configuration

Configure Claude Code and Codex to route model calls through Felo API Platform. Model calls require prepaid API credits; Felo Pro does not apply.

This guide shows how to configure agent clients to use the Felo API Platform LLM API. Use this page when you want Claude Code or Codex to route model calls through Felo API Platform instead of calling a model vendor directly.

::: warning Felo API credits are required
Felo model calls are billed from prepaid **Felo API Platform service credits**. A **Felo Pro subscription does not include API/model usage** and cannot be used to pay for these calls. Top up at [Console Billing](https://openapi.felo.ai/console/billing) before your first request.
:::

Set `FELO_API_KEY` to your Felo API Platform key before using either client.

```bash
export FELO_API_KEY="YOUR_API_KEY"
```

## Supported Client Paths

| Client or API surface | Recommended Felo endpoint | Model example | Notes |
|-----------------------|---------------------------|---------------|-------|
| Claude Code | `POST /api/v1/messages` | `claude-sonnet-5` | Claude Code uses the Anthropic Messages wire format. |
| Codex | `POST /api/v1/responses` | `gpt-5.6-sol` | Codex custom providers should use the Responses API. |
| Chat Completions | `POST /api/v1/chat/completions` | `gpt-5.6-sol` | Use from SDKs or server-side integrations. Codex Chat Completions support is deprecated in Codex documentation. |

## Claude Code

Claude Code should use the Anthropic-compatible Messages endpoint.

Claude Code can use any published model listed in [Models and Pricing](https://openapi.felo.ai/docs/guides/models-and-pricing.md), including the newly available `claude-sonnet-5`:

```bash
claude --model claude-sonnet-5
```

### Shell Configuration

```bash
export ANTHROPIC_API_KEY="$FELO_API_KEY"
export ANTHROPIC_BASE_URL="https://openapi.felo.ai/api"
export ANTHROPIC_MODEL="claude-sonnet-5"

claude
```

The Anthropic base URL intentionally omits `/v1`, because Claude Code and the Anthropic SDK append `/v1/messages` to the configured API host.

### Settings File Configuration

Use a Claude Code settings file when you want the endpoint and model to apply every time `claude` starts. Keep API keys in your shell or secret manager instead of committing them into project settings.

```json
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://openapi.felo.ai/api",
    "ANTHROPIC_MODEL": "claude-sonnet-5"
  }
}
```

You can also choose the model for one session:

```bash
claude --model claude-sonnet-5
```

## Codex

Codex should use the OpenAI-compatible Responses endpoint. `gpt-5.6-sol` is the flagship GPT-5.6 tier for complex reasoning, coding, and agentic workflows.

### User Config

Add a Felo provider to your user-level Codex configuration at `~/.codex/config.toml`.

```toml
model_provider = "felo"
model = "gpt-5.6-sol"

[model_providers.felo]
name = "Felo API Platform LLM API"
base_url = "https://openapi.felo.ai/api/v1"
env_key = "FELO_API_KEY"
wire_api = "responses"
```

Codex endpoint authentication and endpoint selection must live in user-level Codex config. Codex ignores `model_provider`, `model_providers`, and `openai_base_url` from project-scoped `.codex/config.toml` files.

### One-Off Model Selection

After the Felo provider is configured, you can choose the model for a single CLI run:

```bash
codex --model gpt-5.6-sol
```

For non-interactive runs:

```bash
codex exec --model gpt-5.6-sol "Review this change"
```

## Billing and credits

Model calls are prepaid separately from Felo Pro:

- Every Felo model request deducts from your Felo API Platform service-credit balance.
- A Felo Pro subscription does not grant API credits and does not make model calls free.
- Top up and review usage in [Console Billing](https://openapi.felo.ai/console/billing).
- If the balance is empty, the API returns `402 INSUFFICIENT_CREDITS`.

See [Billing and Credits](https://openapi.felo.ai/docs/faq/billing-and-credits.md) for the full policy.

## Official Documentation

- [Claude Code environment variables](https://code.claude.com/docs/en/env-vars)
- [Claude Code model configuration](https://code.claude.com/docs/en/model-config)
- [Claude Code settings](https://code.claude.com/docs/en/settings)
- [Codex config basics](https://developers.openai.com/codex/config-basic)
- [Codex advanced configuration](https://developers.openai.com/codex/config-advanced#custom-model-providers)
- [Codex models](https://developers.openai.com/codex/models)
