Code By AI · API

Code By AI — third-party multi-model API gateway

Prepaid access to Claude, GPT/Codex, Gemini, Grok and DeepSeek through one API key and balance. Connect an app or configure your coding tools. Text models are billed per token at a share of the catalog base rate; image generation is billed by size and number of images.

First top-up · save 30%

For accounts that have never topped up: save 30% on the first $500 of your first top-up, up to $150 off. Any amount above $500 receives no first-top-up discount.

Your first successful top-up ends first-top-up eligibility, even for a small amount or when another offer is used. Failed or abandoned payments do not use it; refunds do not restore it. The lowest payable price among eligible offers is applied automatically; discounts do not stack. Processing fees apply.

View first-top-up price

No card required to sign up · API usage requires a top-up

Claude models from 1/4 of the catalog base rate; GPT from 1/10 and Gemini from 1/10. Compare Claude Code pricing

At a glance

Three reasons to switch

Same tools, one key, lower spend — that is the entire migration.

01

1API key

One key and one balance cover Claude, GPT, Gemini, Grok and DeepSeek — no separate sign-ups or payment methods for each vendor.

02

5model families

Claude, GPT, Gemini, Grok and DeepSeek use the same API key and balance. Model choice depends on your client’s protocol. DeepSeek requires Chat Completions (/v1/chat/completions).

03

1/10of the catalog base rate

Grok’s saving is calculated only against xAI’s short-context list price for prompts under 200,000 tokens. Other channels show their share of the catalog base rate. For actual charges, see each model’s USD rates per 1M tokens in the price table. No subscription or minimum spend.

Claude Code1/4Codex1/10Gemini1/10Grok−95%DeepSeek3/10

API quickstart

Your first API request

Choose an API format, model and language, then copy the example.

Your first API request

1. Set your API key

Replace YOUR_API_KEY in the setup command with your key, then run it in your terminal. Keep CODEBYAI_API_KEY unchanged. This setting lasts for the current terminal session.

macOS / Linux (bash / zsh)

export CODEBYAI_API_KEY="YOUR_API_KEY"

2. Run the example

Copy the example below and paste it into the same bash or zsh terminal. It reads the key you just set.

# bash / zsh: export CODEBYAI_API_KEY before running
curl --fail-with-body --max-time 120 "https://www.codebyai.net/api/agent/v1/messages" \
  -H "x-api-key: ${CODEBYAI_API_KEY:?Set CODEBYAI_API_KEY}" \
  -H "anthropic-version: 2023-06-01" \
  -H "content-type: application/json" \
  -d '{"model":"claude-sonnet-5","max_tokens":256,"messages":[{"role":"user","content":"Hello"}]}'

What success looks like

A successful request returns generated text and token usage.

content[].text · usage

This page only generates examples. Running them sends a request and successful inference uses your balance. Never share your API key.

API quickstartModel catalog

One API key · 4 API formats

Use familiar SDKs

Use Anthropic, OpenAI and Gemini API formats with one API key and balance. Choose the endpoint that matches your client.

Anthropic Messages

Claude models
POST /api/agent/v1/messages

For Claude Code, the Anthropic SDK and tools that use Messages. Supports streaming responses and tool calls.

Setup guide →

OpenAI Responses

GPT + Claude models
POST /api/agent/v1/responses

For Codex CLI and the OpenAI Responses API, including reasoning output and tool calls.

Setup guide →

OpenAI Chat Completions

GPT + Claude + Grok + DeepSeek models
POST /api/agent/v1/chat/completions

For OpenCode, Pi and tools that use the OpenAI Chat Completions API.

Setup guide →

Gemini generateContent

Gemini models
POST /api/agent/v1beta/models/{model}:generateContent

Gemini CLI and the Google SDK send :generateContent and :streamGenerateContent here.

Setup guide →

Use Anthropic, OpenAI or Gemini request formats with one API key. Each endpoint supports specific model families; choose an exact model ID from the catalog.

One-command setup

Set up your coding tools with one command

Paste the command into your terminal and enter your API key when prompted. The script backs up existing files, writes each tool’s settings and checks the API key. Run it again to add tools, or use --uninstall to undo its changes.

curl -fsSL https://www.codebyai.net/setup.sh | sh -s -- --claude
Sets upClaude CodeCodexGemini CLIOpenCodePiQwen CodeZCodeWorkBuddyCodeBuddyAll options →

Transparent Pricing

AI Model Token Pricing Comparison

See what you pay for each model and compare with official token rates where available.

30
models supported
22.9%
of official price, on average
−90%
max saving (excludes tiered models)
View all 30 models

Gemini model service may be unstable due to recent upstream risk controls. Please choose carefully.

Model
Official → Code By AI · per 1M tokens
You save
≤ 100,000 prompt tokensin$0.10$0.025cache read$0.01$0.0025out$0.50$0.125
> 100,000 prompt tokensin$0.50$0.125cache read$0.05$0.0125out$2.50$0.625
in$1.00$0.25out$5.00$1.25
75% off
in$2.00$0.50out$10.00$2.50
75% off
in$2.00$0.50out$10.00$2.50
75% off
in$3.00$0.75out$15.00$3.75
75% off
in$4.00$1.00out$20.00$5.00
75% off
in$5.00$1.25out$25.00$6.25
75% off
in$5.00$1.25out$25.00$6.25
75% off
in$5.00$1.25out$25.00$6.25
75% off
in$5.00$1.25out$25.00$6.25
75% off
in$8.00$2.00out$40.00$10.00
75% off
in$10.00$2.50out$50.00$12.50
75% off
in$10.00$2.50out$50.00$12.50
75% off
in$1.00$0.10cache read$0.05$0.005out$5.00$0.50
90% offinput ≤272k
in$2.00$0.20cache read$0.20$0.02out$12.00$1.20
90% offinput ≤272k
in$2.00$0.20cache read$0.20$0.02out$10.00$1.00
90% offinput ≤272k
in$2.00$0.20cache read$0.10$0.01out$10.00$1.00
90% offinput ≤272k
in$2.00$0.20cache read$0.10$0.01out$10.00$1.00
90% offinput ≤272k
in$4.00$0.40cache read$0.40$0.04out$20.00$2.00
90% offinput ≤272k
in$8.00$0.80cache read$0.40$0.04out$40.00$4.00
90% offinput ≤272k
in$10.00$1.00cache read$1.00$0.10out$50.00$5.00
90% offinput ≤272k
in$0.15$0.045cache read$0.003$0.0009out$0.60$0.18
70% offOfficial off-peak rate
in$0.66$0.198cache read$0.022$0.0066out$1.98$0.594
70% offOfficial off-peak rate
in$0.75$0.075out$3.75$0.375
90% off
in$1.50$0.15out$7.50$0.75
90% off
in$0.40out$2.00
in$0.40out$2.00
in$2.00$0.10cache read$0.30$0.015out$6.00$0.30
95% offprompt <200k
in$2.00$0.10cache read$0.50$0.025out$6.00$0.30
95% offprompt <200k
in$2.00$0.10cache read$0.50$0.025out$6.00$0.30
95% offprompt <200k

Prices per 1M tokens in USD. Official prices and savings are shown only where vendor rates are verified and comparable.

Prompt length includes uncached input and cache reads and writes. The selected tier applies to the whole request.

Grok official prices are xAI's short-context rate for prompts under 200,000 tokens. The saving covers only that tier, not long-context, regional, or tool fees.

OpenAI standard rates cover prompts up to 272,000 input tokens. Above that, the whole request is billed at 2x input and cache rates and 1.5x output; the saving shown covers only the standard tier.

The official DeepSeek prices shown are its off-peak API rates, half the peak rates. Code By AI uses those off-peak rates as the basis for calculating what you pay at all hours. DeepSeek’s peak hours are 01:00–04:00 and 06:00–10:00 UTC on weekdays (excluding Chinese public holidays); the saving is measured against the official off-peak rates.

Input from $0.025 per 1M tokens

Volume Discount

Top up more, save up to 15%

Automatic tiered discount applied at checkout — the higher the top-up, the bigger the savings.

Top Up Now
  1. −3%

    $20+

  2. −6%

    $50+

  3. −10%

    $100+

  4. BEST VALUE

    −15%

    $300+

One platform dollar equals one USD before discounts and fees. Discounts reduce the payment; the credited balance stays the same.

GPT IMAGE 2.5

AI Image Generation

Create stunning images from text descriptions with GPT Image 2.5. From concept art to product mockups, bring your ideas to life.

Miniature 3D diorama of a cozy developer workspace with a code monitor, plants and a sleeping cat

Generate anything you can imagine

GPT Image 2.5 delivers photorealistic quality with precise text rendering and style control. Available through your existing API key.

  • Text-to-image and image-to-image generation
  • Multiple output sizes from 1K to 4K resolution
  • Seamless integration with your CodeByAI account
FAQ

Frequently Asked Questions

Learn how to connect tools, choose models and understand billing.

Still have questions?

Can't find the answer you're looking for? Our team is here to help.

Contact our support team