Code By AI vs the official Claude API: price and setup
This is a platform comparison for one representative model, claude-sonnet-5, not a model comparison. The same token rates appear in the live catalog and on the model page. Code By AI uses a prepaid balance; the official API is the vendor’s direct billing path. In a Messages client using x-api-key, keep that header and change the base URL and key value for the target platform.
Short answer
For claude-sonnet-5, Code By AI charges $0.50 input / $2.50 output per 1M tokens; the official list price is $2.00 / $10.00. That is the published 1/4 of the list price, before any separate top-up fees or discounts.
Token and monthly figures are arithmetic from the current catalog, not a forecast or a measured benchmark. The monthly example excludes cache writes, tools and actual usage differences.
Token prices on the same basis
All values are USD per 1M tokens. Code By AI prices already include the published multiplier. Vendor list prices are shown only when verified. The 5-minute and 1-hour cache writes apply only to Claude and use each platform’s own input rate.
| Platform | Input | Cache read | Cache write (5 min) | Cache write (1 hour) | Output |
|---|---|---|---|---|---|
| Code By AI | $0.50 | $0.05 | $0.625 | $1.00 | $2.50 |
| Official list | $2.00 | $0.20 | $2.50 | $4.00 | $10.00 |
| OpenRouter | $2.00 | $0.20 | $2.50 | $4.00 | $10.00 |
OpenRouter standard endpoint (verified): anthropic/claude-sonnet-5 · anthropic · anthropic/claude-sonnet-5-20260630 ·
OpenRouter cells show a number only when the exact provider model ID and rate basis were checked against this catalog row. Cells marked Not verified have no such evidence. Credit-purchase fees and other OpenRouter plans are separate and are never added to the per-token prices here. OpenRouter pricing and FAQ · FAQ
Unverified rates are not inferred from catalog values. /pricing
Monthly arithmetic example
At 20M input and 2M output tokens per month, priced at catalog rates:
| Model | Official list / month | Code By AI / month |
|---|---|---|
| Claude Sonnet 5claude-sonnet-5 | $60.00 | $15.00 |
Which choice fits which work?
Rows restate catalog arithmetic and official guidance. They are not Code By AI benchmarks or measured speed and quality results.
| Kind of work | Starting point | Basis |
|---|---|---|
| One prepaid key across Claude, GPT and Gemini | Code By AI | Current catalog and gateway documentation. |
| A direct vendor account, vendor billing or vendor data terms | Official API | The official API is the direct vendor path. |
| A fixed USD token rate with no subscription | Code By AI | Usage is debited from the prepaid balance at catalog rates. |
How the integration differs
These are wire-level settings readers must configure, not capability claims.
| Code By AI base URL | https://www.codebyai.net/api/agent |
|---|---|
| Official base URL | https://api.anthropic.com |
| Anthropic Messages path | https://www.codebyai.net/api/agent/v1/messages (gateway) vs /v1/messages (official) |
| Authentication | Gateway: `x-api-key: <key>` or `ANTHROPIC_AUTH_TOKEN` for Claude Code. Official: `x-api-key` plus `anthropic-version: 2023-06-01`. |
| Billing unit | Both quote USD per 1M tokens. Code By AI debits a prepaid wallet; the official API bills the vendor account. |
| Model ID | `claude-sonnet-5` on both paths; the model catalog is the source for the exact ID. |
FAQ
- Is this a per-token markup or a top-up fee?
- The table compares token rates only. Any top-up fee, discount or payment-method condition is separate and is not added to these per-token values.
- Does Code By AI use the same model IDs as the official API?
- The catalog uses claude-sonnet-5. Code By AI forwards the model ID to the Anthropic-compatible path; this page does not claim that every vendor-side feature or beta is available through the gateway.
- How are OpenRouter credit-purchase fees applied?
- OpenRouter cells show a number only when the exact provider model ID and rate basis were checked against this catalog row. Cells marked Not verified have no such evidence. Credit-purchase fees and other OpenRouter plans are separate and are never added to the per-token prices here.
- Can I use Claude Code through Code By AI?
- Yes. Set `ANTHROPIC_BASE_URL` to the gateway base URL and `ANTHROPIC_AUTH_TOKEN` to your Code By AI key, then pass the model ID. See the Claude Code setup guide for the complete example.
- Does this page state either platform’s data-retention policy?
- No. It compares token prices and connection settings. Data retention and other account terms are governed by the platform you use and are not asserted here.
Next step
Create a Code By AI account, top up the prepaid wallet and create an API key. Then call the model with the ID and endpoint above.
Code By AI is a third-party prepaid API gateway. It is not an official vendor product.