Setup guides
The only things that change are the URL and the key. Create your key in the console and drop it into the examples below.
Claude Code
Anthropic's official Claude Code CLI and VS Code extension run through Kervan with two environment variables.
macOS / Linux
Run in your terminal, or add to your ~/.zshrc or ~/.bashrc to make it permanent:
export ANTHROPIC_BASE_URL="https://api-kervan.poly1.fun" export ANTHROPIC_AUTH_TOKEN="sk-XXXXXXXXXXXXXXXX" claude
Windows (PowerShell)
Run in PowerShell for the current session:
$env:ANTHROPIC_BASE_URL = "https://api-kervan.poly1.fun" $env:ANTHROPIC_AUTH_TOKEN = "sk-XXXXXXXXXXXXXXXX" claude
settings.json
For a permanent setting, edit ~/.claude/settings.json:
// ~/.claude/settings.json { "env": { "ANTHROPIC_BASE_URL": "https://api-kervan.poly1.fun", "ANTHROPIC_AUTH_TOKEN": "sk-XXXXXXXXXXXXXXXX" } }
Use the /model command inside Claude Code to pick a model.
CC Switch
If CC Switch is installed, the "Send to CC Switch" button in the console adds the provider in one click. The link is generated only in your browser.
Codex
Add a provider to ~/.codex/config.toml and pass your key as an environment variable:
# ~/.codex/config.toml model = "gpt-6-sol" model_provider = "kervan" [model_providers.kervan] name = "Kervan" base_url = "https://api-kervan.poly1.fun/v1" env_key = "KERVAN_API_KEY" wire_api = "responses"
Put the key in an environment variable:
export KERVAN_API_KEY="sk-XXXXXXXXXXXXXXXX" codex
Cursor, Cline, OpenCode
Open your editor's API provider settings and enter these values:
Base URL: https://api-kervan.poly1.fun/v1 API key: sk-XXXXXXXXXXXXXXXX Model: claude-sonnet-5
Cursor: in Settings → Models, enter the key in the OpenAI API Key field and the URL in "Override OpenAI Base URL".
Cline: choose "Anthropic" as the API Provider and enter the URL under "Use custom base URL" (without /v1 at the end).
OpenCode: define a custom provider in opencode.json:
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"kervan": {
"npm": "@ai-sdk/anthropic",
"name": "Kervan",
"options": { "baseURL": "https://api-kervan.poly1.fun/v1", "apiKey": "sk-XXXXXXXXXXXXXXXX" },
"models": { "claude-sonnet-5": {}, "claude-opus-5-5": {} }
}
}
}SDK examples
The official SDKs work unchanged; only base_url and api_key change.
from anthropic import Anthropic client = Anthropic(base_url="https://api-kervan.poly1.fun", api_key="sk-XXXXXXXXXXXXXXXX") msg = client.messages.create( model="claude-opus-5-5", max_tokens=1024, messages=[{"role": "user", "content": "Merhaba"}], ) print(msg.content[0].text)
import OpenAI from "openai"; const client = new OpenAI({ baseURL: "https://api-kervan.poly1.fun/v1", apiKey: "sk-XXXXXXXXXXXXXXXX" }); const res = await client.responses.create({ model: "gpt-6-sol", input: "Merhaba" }); console.log(res.output_text);
curl https://api-kervan.poly1.fun/v1/messages \ -H "x-api-key: sk-XXXXXXXXXXXXXXXX" \ -H "anthropic-version: 2023-06-01" \ -H "content-type: application/json" \ -d '{"model":"claude-sonnet-5","max_tokens":256,"messages":[{"role":"user","content":"Merhaba"}]}'
llms.txt
A condensed setup file that AI assistants can read: /llms.txt
Paste this into your assistant:
Read kervan.com.tr/llms.txt and configure Claude Code to work with Kervan.
Important notes
- Failed requests are not billed.
- /v1/messages/count_tokens is not supported; Claude Code doesn't need it.
- While on trial credit, only trial models are available; all models unlock with your first top-up.