AI gateway
Call models from every major vendor with your Pikeway key, in the OpenAI Chat Completions, Anthropic Messages or OpenAI Responses format. You pay per token from the same balance as every other API.
Point any OpenAI or Anthropic client at Pikeway by changing two things: the base URL and the key. Every model in the model catalog works with all three formats.
POST /ai/v1/chat/completionsPOST /ai/v1/messagesanthropic-version and anthropic-beta headers are passed through.POST /ai/v1/messages/count_tokensPOST /ai/v1/responsesGET /ai/v1/modelsOpenAI Chat Completions
curl https://gw.pikeway.ai/ai/v1/chat/completions \
-H "Authorization: Bearer $PIKEWAY_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5",
"messages": [{ "role": "user", "content": "Summarize the WBTC market in one line." }]
}'
# X-Pikeway-Cost: 0.000412
# X-Pikeway-Tokens: 18+52With "stream": true, the response is passed through as server-sent events. The gateway asks the upstream to include usage at the end of the stream so the call can be billed by tokens.
Anthropic Messages
curl https://gw.pikeway.ai/ai/v1/messages \
-H "Authorization: Bearer $PIKEWAY_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-sonnet-5",
"max_tokens": 512,
"messages": [{ "role": "user", "content": "Hello" }]
}'Use with Claude Code
Claude Code speaks the Messages format, so two environment variables route it through Pikeway:
export ANTHROPIC_BASE_URL=https://gw.pikeway.ai/ai export ANTHROPIC_AUTH_TOKEN=pk-… # your Pikeway key claude
Claude Code requests models by their dated Anthropic names (e.g. claude-sonnet-4-5-20250929). The gateway resolves these to the canonical catalog name (claude-sonnet-4.5), so you don't need to change any model settings.
OpenAI Responses
curl https://gw.pikeway.ai/ai/v1/responses \
-H "Authorization: Bearer $PIKEWAY_KEY" \
-H "Content-Type: application/json" \
-d '{ "model": "gpt-5", "input": "Write a haiku about toll roads." }'Model names
Use the id from the catalog or from GET /ai/v1/models as model. Models also accept aliases (such as an OpenRouter-style full id or a short name), and Anthropic-style names are normalized: a date or -latest suffix is dropped and dashes between digits become dots. Usage is always recorded under the canonical name. An unknown model returns 404 unknown model.
curl https://gw.pikeway.ai/ai/v1/models
{
"object": "list",
"data": [{
"id": "claude-sonnet-5",
"object": "model",
"owned_by": "anthropic",
"display_name": "…",
"context_length": 200000,
"pricing": { "input_per_mtok": 3, "output_per_mtok": 15 },
"capabilities": { "tools": true, "streaming": true, "thinking": true }
}, …]
}Token billing
- Each model has an input and an output price per million tokens (
input_per_mtok,output_per_mtok). Cost = input tokens × input price + output tokens × output price. - Input tokens served from the vendor's prompt cache are billed at the model's cache-read price when it has one.
- Token counts come from the upstream's
usage. Non-streaming responses report them inX-Pikeway-Tokens(input+output) and the cost inX-Pikeway-Cost. For streams the cost is settled when the stream ends; see it in your call log. - Requests the upstream rejects (4xx/5xx) are not billed.
- A request needs a positive balance to start; otherwise it gets
402 insufficient balance.
X-Pikeway-Cache: 300 to a non-streaming chat completion and identical requests within 5 minutes are answered from cache at 10% of the token price. See Caching.