Code By AI · API
Code By AI — third-party multi-model API gateway
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 priceNo 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.
1API key
One key and one balance cover Claude, GPT, Gemini, Grok and DeepSeek — no separate sign-ups or payment methods for each vendor.
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).
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.
Connect your app or your coding tools
One API key. Prepaid access to Claude, GPT, Gemini, Grok and DeepSeek.
API quickstart
Your first API request
Choose an API format, model and language, then copy the example.
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.
Works with the agents you already use
Use one API key and follow each tool’s guide to set the API URL and model.
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 modelsPOST /api/agent/v1/messagesFor Claude Code, the Anthropic SDK and tools that use Messages. Supports streaming responses and tool calls.
Setup guide →OpenAI Responses
GPT + Claude modelsPOST /api/agent/v1/responsesFor Codex CLI and the OpenAI Responses API, including reasoning output and tool calls.
Setup guide →OpenAI Chat Completions
GPT + Claude + Grok + DeepSeek modelsPOST /api/agent/v1/chat/completionsFor OpenCode, Pi and tools that use the OpenAI Chat Completions API.
Setup guide →Gemini generateContent
Gemini modelsPOST /api/agent/v1beta/models/{model}:generateContentGemini 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 -- --claudeTransparent Pricing
AI Model Token Pricing Comparison
See what you pay for each model and compare with official token rates where available.
Gemini model service may be unstable due to recent upstream risk controls. Please choose carefully.
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.
−3%
$20+
−6%
$50+
−10%
$100+
- 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.

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
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
