> Source page: https://tryaiapi.com/en/docs/coding-agents/ (Markdown version of this page)

Docs · Coding Agents Setup

# Claude Code, Codex CLI & Coding Agents Setup Guide

Configure Claude Code, Codex CLI, Antigravity, and standard OpenAI or Anthropic SDKs with a single API key covering Claude, GPT, and Gemini text models — pay-as-you-go from $5 via Stripe with transparent per-token pricing and no monthly lock-in. You can also hand [/SKILL.md](https://tryaiapi.com/SKILL.md) directly to your coding agent for automated setup.

## 01 Configure Claude Code

**Base URL rule:** `ANTHROPIC_BASE_URL` must be `https://tryaiapi.com` with **no** `/v1` suffix.

**Shell · Claude Code env vars**

```bash
export ANTHROPIC_BASE_URL="https://tryaiapi.com"
export ANTHROPIC_API_KEY="YOUR_TRYAIAPI_KEY"
```

Or merge into the `env` object of `~/.claude/settings.json` without overwriting unrelated settings:

**JSON · ~/.claude/settings.json**

```javascript
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://tryaiapi.com",
    "ANTHROPIC_API_KEY": "YOUR_TRYAIAPI_KEY"
  }
}
```

Active Anthropic model IDs: `claude-fable-5-2`, `claude-opus-5-5`, `claude-sonnet-5-5`, and `claude-haiku-5-5` (1,000,000 context window, 128,000 max output tokens; verify live availability via `GET /v1/models`).

## 02 Configure Codex CLI

**Base URL rule:** `OPENAI_BASE_URL` must include `/v1`: `https://tryaiapi.com/v1`.

**Shell · Codex CLI env vars**

```bash
export OPENAI_BASE_URL="https://tryaiapi.com/v1"
export OPENAI_API_KEY="YOUR_TRYAIAPI_KEY"
```

Or add a custom provider entry to `~/.codex/config.toml` (this reads `TRYAIAPI_KEY` from your shell, so set `export TRYAIAPI_KEY="YOUR_TRYAIAPI_KEY"` first):

**TOML · ~/.codex/config.toml**

```toml
[model_providers.tryaiapi]
name = "Try AI API"
base_url = "https://tryaiapi.com/v1"
env_key = "TRYAIAPI_KEY"
wire_api = "responses"
```

Active OpenAI text model IDs: `gpt-6.2-astra`, `gpt-6.2-sol`, `gpt-6-astra`, `gpt-6-sol`, and `gpt-6-luna` (1,050,000 context window, 128,000 max output tokens). Active Google text models (`gemini-4-neon`, `gemini-4-carbon`, `gemini-4-argon`, `gemini-4-hydrogen`) also use `https://tryaiapi.com/v1/chat/completions`.

## 03 Verify Connectivity Before Sending Paid Requests

Run a free, read-only balance check first to confirm authentication:

**curl · balance check**

```bash
curl -sS https://tryaiapi.com/v1/user/balance \
  -H "Authorization: Bearer $TRYAIAPI_KEY"
```

- HTTP `200` with JSON balance: authentication is valid and your client is ready.
- HTTP `401`: API key is missing, revoked, or malformed — check your key in the [console](https://tryaiapi.com/sign-in?lng=en).
- HTTP `402`: insufficient balance — top up in the console.
- HTTP `404`: most commonly caused by adding `/v1` to `ANTHROPIC_BASE_URL`, omitting `/v1` from `OPENAI_BASE_URL`, or using a model ID not listed in `GET /v1/models`.
- Live prices are published at the [model market](https://tryaiapi.com/en/models/) and `GET /api/pricing`. For multimodal endpoints, see [Image Model Docs](https://tryaiapi.com/en/docs/image-model/) and [Video Model Docs](https://tryaiapi.com/en/docs/video-model/).
