Pay-as-you-go API gateway

One API key for GPT, Claude and Gemini

OpenAI- and Anthropic-compatible endpoints. Pay as you go at 30% of each provider's list price. No subscription.

https://api.apirail.dev28 modelsUSD · from $20
$ curl https://api.apirail.dev/v1/chat/completions \
  -H "Authorization: Bearer ar-live-…" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-sonnet-5-5",
    "stream": true,
    "messages": [{"role": "user", "content": "Say hello in one sentence."}]
  }'

data: {"model":"claude-sonnet-5-5","choices":[{"delta":{"content":"Hello"}}]}
data: {"model":"claude-sonnet-5-5","choices":[{"delta":{"content":"! Your request"}}]}
data: {"model":"claude-sonnet-5-5","choices":[{"delta":{"content":" reached Claude"}}]}
data: {"model":"claude-sonnet-5-5","choices":[{"delta":{"content":" through APIRail."}}]}
data: {"choices":[],"usage":{"prompt_tokens":14,"completion_tokens":11}}
data: [DONE]

# Hello! Your request reached Claude through APIRail.

Models you can call today

APIRail prices per 1M tokens, next to the provider's list price.

OpenAI · Text

GPT-6.2 Sol

gpt-6.2-sol

Context
922K
Input / 1M
$2.00$0.60
Output / 1M
$10.00$3.00
OpenAI · Text

GPT-6.2 Astra

gpt-6.2-astra

Context
922K
Input / 1M
$8.00$2.40
Output / 1M
$40.00$12.00
OpenAI · Text

GPT-5.5

gpt-5.5

Context
1.05M
Input / 1M
$5.00$1.50
Output / 1M
$30.00$9.00
Anthropic · Text

Claude Opus 5.5

claude-opus-5-5

Context
1M
Input / 1M
$4.00$1.20
Output / 1M
$20.00$6.00
Anthropic · Text

Claude Sonnet 5.5

claude-sonnet-5-5

Context
1M
Input / 1M
$2.00$0.60
Output / 1M
$10.00$3.00
Anthropic · Text

Claude Haiku 5.5

claude-haiku-5-5

Context
1M
Input / 1M
$0.10$0.03
Output / 1M
$0.50$0.15
Google · Text

Gemini 4 Neon

gemini-4-neon

Context
1M
Input / 1M
$3.00$0.90
Output / 1M
$15.00$4.50
Google · Text

Gemini 4 Hydrogen

gemini-4-hydrogen

Context
1M
Input / 1M
$1.50$0.45
Output / 1M
$7.50$2.25

See all models and prices

Works with the SDKs and tools you already use

Change the base URL and the key. The rest of your code stays the same.

OpenAI SDK

Base URL https://api.apirail.dev/v1 for Chat Completions, Responses and Images. Works for GPT, Claude and Gemini model IDs.

python
from openai import OpenAI

client = OpenAI(base_url="https://api.apirail.dev/v1", api_key="ar-live-YOUR_KEY")

stream = client.chat.completions.create(
    model="gpt-6.2-sol",
    messages=[{"role": "user", "content": "Say hello in one sentence."}],
    stream=True,
)
for chunk in stream:
    if chunk.choices:
        print(chunk.choices[0].delta.content or "", end="")

What happens to each request

APIRail sits between your app and the model provider. It checks, meters and passes the request through.

  1. Your app

    Sends a request with an ar-live key

  2. APIRail

    Key check, balance check, usage metering

  3. Model provider

    Runs the model you asked for

  4. Streamed back

    Tokens reach your app as they are generated

Spending limits per key

Give each key a monthly limit in USD and a list of allowed models. A key that reaches its limit stops with a clear error instead of draining your balance.

A usage log for every request

Each call is recorded with its model, key, token counts, cost, time to first token, latency and status, so you can see where every cent went.

Streams that stay open

While a long request waits for its first token, APIRail sends keep-alive comments so proxies and load balancers do not close the stream early.

What a request costs

2,000 input tokens and 500 output tokens, priced from the current catalog.

Claude Sonnet 5.5On APIRail$0.0027At list price: $0.009$0.60 / 1M input · $3.00 / 1M output
GPT-6.2 SolOn APIRail$0.0027At list price: $0.009$0.60 / 1M input · $3.00 / 1M output
Gemini 3.8 FlashOn APIRail$0.001013At list price: $0.003375$0.225 / 1M input · $1.125 / 1M output

Compare every model on the pricing page

FAQ

How do I get a Claude API key on APIRail?

Sign in with Google, create a key under Dashboard → API keys, top up at least $20, then point your client at https://api.apirail.dev. The same key works for GPT and Gemini.

Is APIRail compatible with the OpenAI and Anthropic SDKs?

Yes. /v1/chat/completions, /v1/responses, /v1/messages (+ count_tokens), /v1/images/generations, and native Gemini /v1beta/models/{model}:generateContent. Change the base URL and key; the rest of your code stays the same.

How is usage priced?

Per token, at 30% of the provider's list price, with cached input billed at the cached rate. Each request's cost is rounded up to the nearest micro-dollar and shown in your usage log.

Can I use it with Claude Code or Codex CLI?

Yes: ANTHROPIC_BASE_URL=https://api.apirail.dev + ANTHROPIC_AUTH_TOKEN=ar-live-… for Claude Code; OPENAI_BASE_URL=https://api.apirail.dev/v1 + OPENAI_API_KEY for Codex CLI.

How do I pay?

Top up your USD balance with crypto (USDT, BTC and other coins via NOWPayments), from $20. Balance does not expire. Card payment is not available yet.

Am I charged when a request fails?

No charge when the model provider returns an error. If you cancel a stream midway, you pay for the tokens already generated.

Can I limit what a key can spend?

Yes. Each key can have a monthly spending limit and a list of allowed models, and can be disabled at any time. Up to 20 keys per account.

Do you store my prompts or outputs?

No. APIRail logs request metadata only (model, token counts, cost, latency, status). Prompt and response bodies are passed through and not stored.

Start with $20 and one key

Sign in with Google, top up your balance and send your first request to api.apirail.dev.

Get your API key