Skip to content

Claude Code and Codex

Both tools let you change the API endpoint. Pointing them at RevidAPI works immediately — billed in VND, no vendor account required.

Fastest path

Open these URLs in a browser, replacing sk_... with your key:

https://revidapi.com/v1/setup-claudecode?key=sk_YOUR_KEY
https://revidapi.com/v1/setup-codex?key=sk_YOUR_KEY

They return ready-made setup commands for your platform.

Claude Code — manual

export ANTHROPIC_BASE_URL="https://revidapi.com"
export ANTHROPIC_AUTH_TOKEN="sk_YOUR_KEY"
claude

Add those lines to ~/.zshrc or ~/.bashrc to make it permanent.

Pick a model with /model inside Claude Code, or:

export ANTHROPIC_MODEL="claude-sonnet-5"

Codex CLI — manual

Edit ~/.codex/config.toml:

model_provider = "revidapi"
model = "gpt-6-astra"

[model_providers.revidapi]
name = "RevidAPI"
base_url = "https://revidapi.com/v1"
wire_api = "responses"
env_key = "REVIDAPI_KEY"

Then:

export REVIDAPI_KEY="sk_YOUR_KEY"
codex

wire_api = "responses" is required. Routing Codex through Chat Completions drops tool calls, and Codex loses the ability to read files in your project.

Auto-compact threshold

Once a conversation reaches a threshold, Claude Code / Codex summarises its history (compact). Pick the threshold on the dashboard Connect app page ("Auto-compact threshold" slider). It is stored per API key: install commands generated for that key apply it — rerun the installer after changing it.

App Default Range Written to
Claude Code, Claude Desktop (Code tab) 250,000 100,000 – 500,000 autoCompactWindow in ~/.claude/settings.json
Codex per model (200,000 – 230,000) 100,000 – 260,000 model_auto_compact_token_limit in ~/.codex/config.toml

With "default", a value you already set on your machine is kept.

Read / change via API:

curl https://revidapi.com/v1/account/compact -H "x-api-key: sk_YOUR_KEY"
curl -X POST https://revidapi.com/v1/account/compact -H "x-api-key: sk_YOUR_KEY" \
  -H "content-type: application/json" -d '{"claude": 300000, "codex": null}'

null resets to default. Or append &compact=300000 to the install URL above.

Choosing: every turn resends the whole conversation, so a lower threshold makes each turn cheaper but compacts more often (1–3 min each, early detail is lost); a higher one keeps more context but late-session turns cost more credits. Past ~180.000 tokens RevidAPI adds a one-line reminder inside the reply (at most once per 6 hours).

Cost

Long sessions carry very large input because the whole context is resent each turn. Two things cut the bill most:

  • Use /compact once the conversation is long.
  • Pick a model that is merely sufficient. claude-sonnet-5 is about 40% cheaper than claude-opus-5 on both input and output, and handles most code edits.

See Saving with cache.