Your Terminal Session, Priced per Million Tokens
Your Terminal Session, Priced per Million Tokens
A price per million tokens is a unit rate, not a minimum purchase. Your terminal agent can consume 800 tokens or 800,000; the bill follows its actual usage. The expensive mistake is treating that headline rate as the cost of a request, especially when an agent repeatedly sends repository context.
Fluxo puts Claude, GPT, Gemini, DeepSeek, Kimi, GLM, Qwen, Grok and more behind one key and one base URL: https://api.fluxorelay.com. It works with Claude Code, Codex, Gemini CLI and any OpenAI SDK. Billing follows real tokens, including cache reads and writes, with no monthly fee. That makes token accounting useful at the session level, not just on an invoice.
Convert Million-Token Rates into Request Costs
For a basic text request, calculate input_tokens × input_rate / 1,000,000, then add output_tokens × output_rate / 1,000,000. Keep the categories separate: output can cost substantially more than input.
Suppose you are estimating a Claude Sonnet 5.5 coding session. Use illustrative rates of $3 per million input tokens and $15 per million output tokens. These are made-up worksheet values, not current Fluxo prices; substitute the applicable rates before budgeting.
- A request containing 12,000 input tokens costs $0.036 for input.
- A response containing 2,000 output tokens costs another $0.030.
- The combined request costs $0.066, or about seven cents.
Run that request 100 times and you spend $6.60. But an agent rarely repeats an identical usage shape: tool results, patches, test logs and conversation history change the next request. Estimate sessions from recorded calls, not from the first successful completion.
Separate Cache Reads, Cache Writes and Ordinary Input
Caching changes the arithmetic, not the need to count tokens. For another illustrative worksheet, keep output at $15 per million and assume ordinary input costs $3, cache reads cost $0.30, and cache writes cost $3.75 per million.
Imagine one call reports 80,000 cache-read tokens, 20,000 cache-write tokens and 2,000 output tokens, with no ordinary input. Its cost is $0.024 + $0.075 + $0.030 = $0.129. Sending all 100,000 input tokens uncached would instead cost $0.330, including the same output.
Across 50 calls with exactly that usage shape, the totals would be $6.45 and $16.50. That is a controlled comparison, not a promise: cache eligibility, retention, prefix stability and provider rules determine actual results.
Normalize usage before multiplying. Some APIs expose cached tokens inside an overall input total; others provide separate categories. Subtract overlapping categories where required, and verify whether cache-write pricing replaces ordinary input pricing or adds to it. Otherwise, your dashboard can double-count the cheapest tokens.
Keep Repository Prefixes Stable Across Agent Turns
Put stable instructions and reusable repository context before volatile material when your tool allows it. Append the current task and changing tool results later. Avoid injecting timestamps, random identifiers or reordered file inventories into an otherwise reusable prefix.
- Exclude generated bundles and irrelevant logs before they enter context.
- Measure cache hits after changing prompt templates or tool configuration.
- Compact stale conversation history when its future value becomes negligible.
Compaction also costs tokens and can discard useful details. Compare the summarization cost against expected savings over remaining turns, rather than compacting on a fixed timer.
Route by Cost per Accepted Patch
For routine edits, benchmark DeepSeek V4 Flash alongside your primary coding model. Do not decide from input pricing alone. A cheaper call that triggers three retries, a broken migration and another debugging loop can lose on total cost.
Log model, rate version, input categories, output usage, retries and task outcome. Include billable reasoning tokens where applicable, using the provider's accounting definitions. Track cost per accepted patch and test-passing task, not merely cost per response.
If you want to measure your own editor workload, create a Fluxo account and start with a small session budget. Keep referral earnings separate from inference costs: users earn a referral share when people they invite pay, but that does not change the underlying token arithmetic.