# Use coding agents

Point Claude Code, Cursor, Codex, Gemini CLI or OpenCode at the [AI Gateway](/docs/ai-gateway.md), and its model calls run on your Veryfront credits.

## Before you start

You need an API key. See [Create an API key](/docs/authentication/api-keys.md).

## Point your coding agent at the gateway

**Claude Code**

1. Point Claude Code at the gateway and start it with a Claude model from `GET /ai/models`:

```bash
export ANTHROPIC_BASE_URL="https://api.veryfront.com/ai"
export ANTHROPIC_AUTH_TOKEN="$VERYFRONT_API_KEY"
export CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY=1
claude --model anthropic/claude-sonnet-5
```

2. Ask "Reply with gateway connected." You should now see it reply "Gateway connected."

**Cursor**

1. Open **Cursor Settings** > **Models**.
2. Turn on **Override OpenAI Base URL**.
3. Enter `https://api.veryfront.com/ai/v1`.
4. Enter your Veryfront API key as the **OpenAI API Key**.
5. Add the model `openai/gpt-5-nano`.
6. Ask "Reply with gateway connected." You should now see it reply "gateway connected".

**Codex**

1. Add the gateway as a provider. Codex's hosted web search isn't served, so turn it off:

```toml title="~/.codex/config.toml"
model = "openai/gpt-5-nano"
model_provider = "veryfront"
web_search = "disabled"

[model_providers.veryfront]
name = "Veryfront AI Gateway"
base_url = "https://api.veryfront.com/ai/v1"
env_key = "VERYFRONT_API_KEY"
wire_api = "responses"
```

2. Run `codex exec "Reply with gateway connected."`. You should now see it reply "gateway connected." Codex warns that it has no metadata for the model; the reply is unaffected.

**Gemini CLI**

1. Point Gemini CLI at the gateway and start it:

```bash
export GOOGLE_GEMINI_BASE_URL="https://api.veryfront.com/ai"
export GEMINI_API_KEY="$VERYFRONT_API_KEY"
gemini --model google/gemini-2.5-flash
```

2. Ask "Reply with gateway connected." You should now see it reply "gateway connected".

**OpenCode**

1. Add the gateway as a provider:

```json title="~/.config/opencode/opencode.json"
{
  "$schema": "https://opencode.ai/config.json",
  "model": "veryfront/openai/gpt-5-nano",
  "provider": {
    "veryfront": {
      "npm": "@ai-sdk/openai",
      "name": "Veryfront AI Gateway",
      "options": {
        "baseURL": "https://api.veryfront.com/ai/v1",
        "apiKey": "{env:VERYFRONT_API_KEY}"
      },
      "models": {
        "openai/gpt-5-nano": {}
      }
    }
  }
}
```

2. Start OpenCode and ask "Reply with gateway connected." You should now see it reply "gateway connected".

## Troubleshooting

**If Claude Code says "There's an issue with the selected model (claude-opus-5-5)"**, you started it without `--model`. Pass a model the gateway serves.

**If Codex says "Not inside a trusted directory"**, you ran it outside a Git repository. Run it in your project's repository, or add `--skip-git-repo-check`.

## Next steps

* [Connect a coding agent](/docs/mcp/connect.md)
* [See what a project costs](/docs/observability/project-analytics.md)
