Use the models where you already code
One key, four API formats. Claude Code, Codex CLI and Gemini clients work with no plugin and no workaround.
Quick start
Paste your key and copy the ready-made command for your terminal.
Loading account…
Generated in your browser — the key never leaves it. Generate a key
$env:ANTHROPIC_BASE_URL = "https://ghostcli.dev"
$env:ANTHROPIC_API_KEY = "gcli_SUA_CHAVE"
claudeVideos
Two video walkthroughs, from nothing to a first reply. The CLI one covers install, PATH and environment variables; the app one covers developer mode and the gateway form.
Claude Desktop (app)
LENGTH 3:17Enabling developer mode and filling in the third-party inference form — no file editing at all.
Download the videoClaude Code in the terminal
LENGTH 3:45Install, PATH setup and the environment variables that point the CLI at GhostCLI. Windows, Linux and macOS.
Download the videoEndpoints
| FORMAT | ENDPOINT | WHO SPEAKS IT |
|---|---|---|
| Anthropic Messages | /v1/messages | Claude Code, Anthropic SDK |
| OpenAI Responses | /v1/responses | Codex CLI |
| OpenAI Chat Completions | /v1/chat/completions | OpenAI SDK, Cursor, Continue, Aider, LangChain |
| Gemini GenerateContent | /v1beta/models/{model}:generateContent | Google Gen AI SDK and Gemini clients |
Authenticate with Authorization: Bearer gcli_… or x-api-key: gcli_… — the server accepts both, because each SDK sends a different one. The key is shown only once, in the dashboard, and your IP has to be allowed there.
The Gemini format also accepts x-goog-api-key and the ?key= query parameter, matching Google SDK conventions.
Claude Code
| VARIABLE | VALUE |
|---|---|
| ANTHROPIC_BASE_URL | https://ghostcli.dev |
| ANTHROPIC_API_KEY | gcli_... |
ANTHROPIC_BASE_URL never ends in /v1. The SDK appends /v1/messages on its own, so pointing at …/v1 hits /v1/v1/messages and returns 404 — and the CLI complains about an "issue with the selected model", blaming the model for a URL mistake.$env:ANTHROPIC_BASE_URL = "https://ghostcli.dev"
$env:ANTHROPIC_API_KEY = "gcli_..."
claude --model claude-fable-5.1With the variables in your environment, every claude command talks to GhostCLI — no extra flag and no config file.
Codex CLI
Claude in Codex, step by step
Prepare API access
In the dashboard, check your plan, activate the API add-on, create your key and authorize your IP using the email code. This authorizes its provider network (ASN), so IP changes within the same ASN do not require another approval. A chat subscription alone does not enable API access.
Open the Codex configuration
Use ~/.codex/config.toml on macOS/Linux or %USERPROFILE%\.codex\config.toml on Windows. Create the directory and file if missing. Back up existing settings; merge the example without duplicating entries. If CODEX_HOME is customized, use its config.toml.
Select GhostCLI and a Claude model
Put model and model_provider at the top, before any [table]. The provider name must match [model_providers.ghostcli]. GhostCLI translates the Responses API used by Codex to the selected model. This does not make Claude an OpenAI model.
Set your key and start a new session
Copy the environment command from the generator. For permanent Windows variables, open a new terminal. Start codex in your project. Use /status to inspect the selected model; try a simple prompt before a larger task.
Use the exact model ID from the catalog. Model availability follows your plan. Keep /v1 in the Codex URL and wire_api = "responses". Do not use the Anthropic /v1/messages endpoint in Codex.
Codex ignores OPENAI_BASE_URL for the default provider: it needs its own provider in config.toml (~/.codex/config.toml, or %USERPROFILE%\.codex\config.toml on Windows).
model = "claude-sonnet-5"
model_provider = "ghostcli"
[model_providers.ghostcli]
name = "GhostCLI"
base_url = "https://ghostcli.dev/v1"
env_key = "GHOSTCLI_API_KEY"
wire_api = "responses"model and model_provider must come before [model_providers.ghostcli]. After the table, the parser reads them as keys of that table and Codex silently falls back to the OpenAI provider.$env:GHOSTCLI_API_KEY = "gcli_..."
codexThe variable name is whatever you set in env_key. To switch models, change model at the top of the file.
SDK and cURL
base_url includes /v1; with Anthropic it does not — the SDK appends the path itself.from openai import OpenAI
client = OpenAI(base_url="https://ghostcli.dev/v1", api_key="gcli_...")
r = client.chat.completions.create(
model="claude-fable-5.1",
messages=[{"role": "user", "content": "Explique RAG"}],
)
print(r.choices[0].message.content)In PowerShell, curl is an alias for Invoke-WebRequest and does not accept this syntax — use curl.exe, which ships with Windows 10 and 11.
Models
The id goes in the model field of requests and in the --model flag of the CLIs.
| ID | MODEL | CONTEXT | MINIMUM PLAN |
|---|---|---|---|
| claude-opus-5 | Claude Opus 5 | 1,000k | pro |
| claude-sonnet-5 | Claude Sonnet 5 | 1,000k | pro |
| claude-fable-5.1 | Claude Fable 5.1 | 1,000k | max |
| z-ai/glm-5.3 | GLM 5.3 | 1,000k | pro |
Tool calling
Works in all four formats — tool_use/tool_result on Anthropic, tool_calls on Chat Completions, function_call/function_call_output on the Responses API, functionCall/functionResponse on Gemini — with streaming: plain text arrives token by token and only the span of a call is held back until it closes.
Verified end to end with both real CLIs in a full cycle: run a failing test, read the file, fix it, run again and confirm it passes.
Common errors
| SYMPTOM | CAUSE | FIX |
|---|---|---|
| 404 | ANTHROPIC_BASE_URL ending in /v1 | Keep only the domain |
| 401 invalid or revoked | Wrong or revoked key, or pasted with a space | Generate a new one in the dashboard |
| 429 Free daily limit reached | 5 messages/day ceiling of the free model | Subscribe to a plan, or wait for the day to roll over (UTC) |
| 402 API access not purchased/expired | API add-on not purchased or expired | Purchase or renew under API access |
| 403 IP not authorized | IP not on the authorized list | Allow or renew under API keys |
| ConnectionRefused | URL with http:// or an explicit port | Use https://ghostcli.dev |
| Codex uses OpenAI, not GhostCLI | model_provider declared after the table in the TOML | Move both keys to the top |
| issue with the selected model | Same cause as the 404 — the message misleads | Check the ANTHROPIC_BASE_URL |