Clients/Claude Code

Use the Wokey API with Claude Code

Get a Wokey API key, point Claude Code at the Wokey base URL, then confirm the connection with one curl request.

Updated

On this pageexpand_more

Get an API key and the base URLlink

Every client uses the same Wokey API key and the same base URL.

Create an API key

Sign in and create a platform key on the API page. Keys in one account share its balance.

Create an API keykey

Use the Wokey base URL

Set the client base URL to the gateway domain; the configuration below shows whether to append /v1.

Configure the clientlink

Put the Wokey base URL and API key in the env block of ~/.claude/settings.json; the terminal and the VS Code and JetBrains extensions all read it.

  1. 1

    Open the settings file

    On macOS and Linux it is ~/.claude/settings.json; on Windows, %USERPROFILE%\.claude\settings.json. Create it if it does not exist.

  2. 2

    Add the env block

    Paste the env block below and replace YOUR_API_KEY with your Wokey API key. If the file already has other settings, add only the env block instead of replacing the file. The file is strict JSON: no comments or trailing commas.

  3. 3

    Clear old variables and start

    If ANTHROPIC_API_KEY is set in your shell or ~/.zshrc, remove it and unset it, then open a new terminal and run claude.

~/.claude/settings.json
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.wokey.ai",
    "ANTHROPIC_AUTH_TOKEN": "YOUR_API_KEY"
  }
}
Temporary: current terminal only
export ANTHROPIC_BASE_URL="https://api.wokey.ai"
export ANTHROPIC_AUTH_TOKEN="YOUR_API_KEY"
claude

API formats and base URLslink

When one client switches API format, whether the base URL ends in /v1 can change.

FormatBase URLUse it for
Anthropic Messageshttps://api.wokey.aiClaude models

Where it is configured: env in ~/.claude/settings.json (recommended), or environment variables

Claude Code's WebSearch is a server-side tool. Claude Code sends the search to the model together with a web_search tool definition, and the search runs on the model provider's servers, not on your machine. A gateway can only pass the tool along, so search works only when the upstream serving that request runs it. When it does not, Claude Code shows no error: the search comes back with no links, or the "result" is the model saying it has no search tool, and the reply goes on from the model's training data.

ResultModelsWhat you see in Claude Code
Searchesclaude-opus-5-5claude-sonnet-5-5claude-haiku-5-5claude-fable-5-2claude-opus-4-8claude-opus-4-7claude-sonnet-4-6Results with source links
Varies by requestkimi-k3.1-prokimi-for-codingglm-5.3glm-5.3-flashdoubao-seed-2.1-prodoubao-seed-2.1-litedeepseek-v4-flashWorks when the request reaches an upstream that runs web search; otherwise no links, or a 403 "Access denied for web search"
Does not searchgpt-6.1-solgpt-6.1-terragemini-4-carbongemini-4-hydrogengemini-3.8-flashgrok-4.7qwen4-maxqwen3.7-plusMiniMax-M3MiniMax-M3.1-Flashdeepseek-v4.1-flashdeepseek-v4-prolongcat-2.0hy4No links and no error; some models make up a search result or say they have no search tool. deepseek-v4-pro returns 403 "Access denied for web search"
  • How to tell: if the WebSearch result has no source links, or its text says the model has no search tool, the model behind that request did not search.
  • The search runs on the current main model: Claude Code sends WebSearch to the model you are using, not to ANTHROPIC_DEFAULT_HAIKU_MODEL, so changing the Haiku setting does not help. When you need a search, switch with /model claude-sonnet-5-5, search, then switch back.
  • To search without switching models, add a search MCP server to Claude Code. It calls a search API from your machine, so it does not depend on the model.

Tested 2026-11-16 with Claude Code 2.1.325, several requests per model. Upstream routing changes over time, so results can change.

Verify with curllink

If the client reports an error, rule out the key and base URL with curl first.

Claude Code uses the Anthropic Messages format by default. A 200 from this request means the key and base URL are right. Replace YOUR_API_KEY with your key before sending it.

cURL
curl https://api.wokey.ai/v1/messages \
  -H "x-api-key: YOUR_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-sonnet-5",
    "max_tokens": 1024,
    "messages": [
      { "role": "user", "content": "Hello" }
    ]
  }'

Errors & Troubleshootinglink

Separate auth, balance, rate limit, model availability, and upstream timeout cases first.

401

invalid api key

The key is missing, mistyped, deleted, or Authorization / x-api-key headers conflict.

402

insufficient balance

The account balance is too low. Top up before sending more requests.

403

model_denylisted / account_restricted

Calls to the model, or to every model on the account, are paused after repeated violations. See Violation Handling Fees & Restrictions.

403

request_blocked

This request was blocked before reaching the upstream and is not charged, for example an unchanged resend of a request the model just refused, or a paused end user (X-End-User-Id). The error message says what is blocked; change the request as it says or retry later. Other requests are not affected.

429

rate limited

Traffic is too frequent. Retry later or reduce concurrency. If only one model, or one end user (X-End-User-Id), keeps returning 429, it may be a temporary limit after violations.

499

client disconnected

The client closed the connection before the response finished (code downstream_aborted). This is free by default. Once an account has at least 50 client disconnects in the past 24 hours and they make up 10% or more of its requests, later disconnected requests are billed for the usage the upstream reported: the processed input, including cache reads and writes, and output only when the upstream counted it. A disconnect before the upstream reported any usage stays free. The account is notified when billing starts, and billing stops automatically within an hour once the disconnect rate is back to normal. The usual cause is a client or proxy timeout that is too short, or a program that cancels requests before they finish.

502

upstream unavailable

The upstream model service is temporarily unavailable. Switch models or retry later.

504

upstream timeout

The upstream response timed out. Shorten context, reduce max_tokens, or retry.

529

upstream overloaded

The upstream model is temporarily overloaded and Wokey already retried on other routes (code upstream_overloaded). It is unrelated to your balance. Retry shortly or switch models.

Frequently asked questionslink

Should ANTHROPIC_BASE_URL for Claude Code end in /v1?
No. Use https://api.wokey.ai. Claude Code appends /v1/messages itself, so a base URL ending in /v1 becomes /v1/v1/messages and returns 404.
ANTHROPIC_AUTH_TOKEN or ANTHROPIC_API_KEY?
Use ANTHROPIC_AUTH_TOKEN; Claude Code sends it as Authorization: Bearer. If an old ANTHROPIC_API_KEY is still set, unset it first, because two headers that disagree return 401.
I already export the variables in ~/.zshrc. Do I still need settings.json?
One place is enough, and settings.json is the better one: the VS Code and JetBrains extensions and the desktop app do not see shell variables unless they are started from a terminal, but they all read this file. After moving to settings.json, delete the old export lines from ~/.zshrc so the two places cannot drift apart.

Setup and error guideslink