Gemini 3.1 Pro Preview vs Gemini 4 Carbon: API price and setup
This page compares the exact API IDs `gemini-3.1-pro-preview` and `gemini-4-carbon`. Both are Gemini models, so the client setup is shared; only the model value and token rates change. Gemini 4 Carbon uses Google’s introductory Standard rate before 2026-12-01 (UTC) and the regular Standard rate from that date. The official token prices and monthly estimate follow that schedule. The OpenRouter prices are a dated snapshot, not a quote for the new period.
Short answer
For 1M input plus 1M output tokens, Gemini 4 Carbon is the lower-priced row: Gemini 3.1 Pro Preview costs $0.20 for input plus $1.20 for output on Code By AI, versus Gemini 4 Carbon at $0.20 plus $1.00. Official list rates are $2.00 input / $12.00 output and $2.00 input / $10.00 output per 1M tokens.
These are price estimates, not measured benchmarks. The monthly example excludes cache, tools and differences in actual usage.
Token prices on the same basis
All values are USD per 1M tokens. Code By AI rates come from the live billing catalog and include the published multiplier. Only the Claude rows have comparable 5-minute and 1-hour cache writes.
| Model | Metric | Code By AI | Official list | OpenRouter |
|---|---|---|---|---|
| Gemini 3.1 Pro Previewgemini-3.1-pro-preview | Input | $0.20 | $2.00 | $2.00 |
| Cache read | $0.02 | $0.20 | $0.20 | |
| Cache write (5 min) | Not applicable | Not applicable | Not applicable | |
| Cache write (1 hour) | Not applicable | Not applicable | Not applicable | |
| Output | $1.20 | $12.00 | $12.00 | |
| Gemini 4 Carbongemini-4-carbon | Input | $0.20 | $2.00 | $2.00 |
| Cache read | $0.01 | $0.10 | $0.10 | |
| Cache write (5 min) | Not applicable | Not applicable | Not applicable | |
| Cache write (1 hour) | Not applicable | Not applicable | Not applicable | |
| Output | $1.00 | $10.00 | $10.00 |
Official list: gemini-4-carbon ·
OpenRouter standard endpoint (verified): google/gemini-3.1-pro-preview · google-ai-studio · google/gemini-3.1-pro-preview-20260219 ·
OpenRouter standard endpoint (verified): google/gemini-4-carbon · google-ai-studio · google/gemini-4-carbon-20261110 ·
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
OpenRouter: Google AI Studio, 1,048,576-token context. Verified base rates apply below 200,000 input tokens per request for Gemini 3.1 Pro Preview and matched the catalog vendor fields; they are recorded here. Larger requests have different rates. Batch, Priority and regional endpoints are excluded. /pricing
Monthly arithmetic example
At 20M input and 2M output tokens per month, using the rates above:
| Model | Official list / month | Code By AI / month |
|---|---|---|
| Gemini 3.1 Pro Previewgemini-3.1-pro-preview | $64.00 | $6.40 |
| Gemini 4 Carbongemini-4-carbon | $60.00 | $6.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 |
|---|---|---|
| Work already configured for Gemini | Either model; change only `model` | The base URL, auth and protocol are shared. |
| Input-heavy requests: long prompts, large context, repeated instructions | Either | Both list $0.20 per 1M tokens for this metric. |
| Output-heavy requests: long code or document generation | Gemini 4 Carbon | Output rate: Gemini 3.1 Pro Preview $1.20 vs Gemini 4 Carbon $1.00 per 1M tokens. |
| Cache-read-heavy requests: repeated prefixes and reused context | Gemini 4 Carbon | Cache read rate: Gemini 3.1 Pro Preview $0.02 vs Gemini 4 Carbon $0.01 per 1M tokens. |
How the integration differs
These are wire-level settings readers must configure, not capability claims.
| Model IDs | gemini-3.1-pro-preview / gemini-4-carbon |
|---|---|
| Gemini setup | Gemini CLI setup guide · model: gemini-3.1-pro-preview · https://www.codebyai.net/api/agent |
| Protocol | Gemini: Gemini generateContent |
| Key and balance | Both use the same base URL, auth variable and prepaid balance. |
| What changes | Only the `model` value; the client configuration is unchanged. |
| Billing | Both debit the same prepaid wallet at the per-1M-token rates above. Code By AI does not charge the official list price. |
FAQ
- Which model is cheaper on Code By AI?
- For 1M input plus 1M output tokens, Gemini 4 Carbon is the lower-priced row: Gemini 3.1 Pro Preview costs $0.20 for input plus $1.20 for output on Code By AI, versus Gemini 4 Carbon at $0.20 plus $1.00. Official list rates are $2.00 input / $12.00 output and $2.00 input / $10.00 output per 1M tokens.
- Are these the exact API model IDs?
- Yes. Use `gemini-3.1-pro-preview` and `gemini-4-carbon` exactly. The page does not derive IDs by splitting the slug.
- Do both models use the same key and endpoint?
- Yes. Both are Gemini models on the same endpoint; only the model value changes.
- How are the OpenRouter prices obtained?
- The OpenRouter cells show recorded base rates that matched the catalog vendor fields when checked. The dates are listed with the sources below the table. 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.
- Does this page measure quality or speed?
- No. The scenarios describe client protocols and token mix, not measured quality, speed or SLA results.
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.