KONG API AI Docs Start free

Tools

Claude Code

Use Claude Code with a KONG API AI key. Set the API address and the key in your shell profile or in Claude Code's settings file, then check with /status.

Claude Code sends its requests to KONG API AI once you set the API address and your key. Replace gw_live_… with your key in every step below.

On Windows, Kong Connect sets up Claude Code automatically. You paste your key once.

Install Claude Code

Skip this if you already have Claude Code.

macOS, Linux or WSL:

Terminal
curl -fsSL https://claude.ai/install.sh | bash

Windows, in PowerShell:

powershell
irm https://claude.ai/install.ps1 | iex

Or with npm (Node.js 18 or newer):

Terminal
npm install -g @anthropic-ai/claude-code

The quick way: one command

The command below asks for your key without showing it, checks the key with KONG API AI, then writes the settings of Claude Code and Codex as in the steps below. Each file is backed up before it is changed.

macOS or Linux:

Terminal
curl -fsSL https://kongapiai.com/en/install.sh | bash

Windows, in PowerShell:

powershell
irm https://kongapiai.com/en/install.ps1 | iex

To undo, run curl -fsSL https://kongapiai.com/en/install.sh | bash -s -- --remove, or on Windows run $env:KONG_ACTION='remove', then the install command again. To see what the command does before you run it, open its address in a browser.

Option 1: your shell profile (macOS and Linux)

Add these lines to ~/.zshrc or ~/.bashrc:

Terminal
export KONG_API_KEY="gw_live_…"
export ANTHROPIC_BASE_URL="https://kongapiai.com"
export ANTHROPIC_AUTH_TOKEN="$KONG_API_KEY"
export ANTHROPIC_API_KEY="" # Must be empty

Run source ~/.zshrc (or source ~/.bashrc), or open a new terminal.

ANTHROPIC_API_KEY must be empty. If it still holds an Anthropic key, Claude Code uses that key instead of your KONG API AI key.

Option 2: Claude Code's settings file (any system, including Windows)

Create .claude/settings.local.json in your project folder:

JSON
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://kongapiai.com",
    "ANTHROPIC_AUTH_TOKEN": "gw_live_…",
    "ANTHROPIC_API_KEY": ""
  }
}

For every project, put the same content in ~/.claude/settings.json (on Windows: %USERPROFILE%\.claude\settings.json).

Do not put these values in your project's .env file: Claude Code does not read it.

Sign out of an old Anthropic login

If you ever signed in to Claude Code with an Anthropic account, run /logout once in Claude Code, then quit and start claude again. Skip this if you never signed in.

Start

Terminal
cd /path/to/your/project
claude

Check

In Claude Code, run /status. It should show these two lines:

text
Auth token: ANTHROPIC_AUTH_TOKEN
Anthropic base URL: https://kongapiai.com

If the auth line names ANTHROPIC_API_KEY or a Claude account, your settings did not reach Claude Code: open a new terminal and start claude again. After a few requests, you see them on the Activity page of the console.

Pick the models (optional)

By default, Claude Code picks its models. To use the newest model of each family on sale on KONG API AI, add to the same shell profile:

Terminal
export ANTHROPIC_DEFAULT_FABLE_MODEL="claude-fable-5-2"
export ANTHROPIC_DEFAULT_OPUS_MODEL="claude-opus-5-5"
export ANTHROPIC_DEFAULT_SONNET_MODEL="claude-sonnet-5-5"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="claude-haiku-5-5"

In Claude Code's settings file, put the same names and values under env. Then run /model to see them. A key can only call the models it allows: see Models and prices.

If something fails

  • Model not found: usually an old Anthropic login (run /logout), or an Anthropic key still in ANTHROPIC_API_KEY.
  • Error 401: the key is wrong or was revoked. Copy it again, or create a new key in the console.
  • Error 402: no credits left, or the key's monthly limit is reached. See Limits and routing.

A key in your shell profile is kept as plain text. Do not share that file.