Input vs Output Token Costs: A 15-Minute Cost Tune-Up
Start Here: Optimize Dollars per Useful Answer
Input tokens are what you send to a model: instructions, conversation history, retrieved documents, and tool results. Output tokens are what the model generates. Both affect your bill, but they often have different prices. A shorter prompt is not automatically the biggest saving.
For busy developers, the fastest approach is to measure one representative workload, identify its expensive side, and change one variable at a time. Here is a practical 15-minute starting point.
1. Calculate Your Actual Request Cost
When prices are listed per million tokens, use: request cost = (input tokens × input rate + output tokens × output rate) ÷ 1,000,000. Use rates for the exact model and billing categories you actually use, not another model’s advertised starting price.
Suppose a model costs $1 per million input tokens and $5 per million output tokens. These are illustrative rates, not a 59API price quote. A request with 3,000 input tokens and 1,000 output tokens costs $0.008. At 10,000 requests, that is $80.
- Reduce output to 400 tokens: The request costs $0.005, or $50 per 10,000 requests.
- Then reduce input to 1,500 tokens: The request costs $0.0035, or $35 per 10,000 requests.
That combined reduction saves 56.25%, assuming quality and request volume remain unchanged. The example shows why output deserves attention when its unit price is higher.
2. Spend Three Minutes Instrumenting Usage
Capture the model identifier, reported input and output token counts, latency, and estimated cost for each request. SDK fields vary: you may see prompt_tokens and completion_tokens, or input_tokens and output_tokens. Prefer reported usage over character-based estimates.
- Group costs by endpoint or feature, such as chat, summarization, and code review.
- Record retries and follow-up calls; one user action may trigger several requests.
- Track task success alongside cost. A cheap answer that requires two corrections may cost more overall.
Check whether your billing includes cached-input categories, reasoning tokens, or separate tool charges. Some models bill reasoning tokens as output even when those tokens are not visible in the answer.
3. Trim Output Before Useful Context
Start by specifying the deliverable: “Return five findings, each with severity, filename, and one suggested fix.” This is more dependable than asking the model to “be concise.” For extraction tasks, request only the required fields rather than a narrative explanation.
Set an output limit appropriate to the endpoint and model. Depending on the API, the parameter may be max_tokens, max_completion_tokens, or max_output_tokens. These are ceilings, not target lengths. An overly tight limit can truncate JSON or code and trigger expensive retries.
Streaming improves responsiveness, not token pricing. It does not make an identical completed response cheaper merely because tokens arrive incrementally.
4. Remove Repeated Input, Not Critical Instructions
Stop resending entire repositories or unbounded chat histories. Retrieve relevant files, include the necessary surrounding code, and summarize older conversation turns. Preserve requirements, unresolved decisions, and exact identifiers that affect correctness.
If prompt caching is supported, keep reusable instructions and documents in a stable prefix. Verify eligibility, cache-write costs, cache-read rates, and expiration rules before forecasting savings. Repeated text is not automatically discounted.
5. Lower Rates Without Breaking Your Workflow
Token efficiency and provider pricing multiply each other. 59API offers low-cost, pay-as-you-go access to Claude and GPT models, using native official-quality models without downgrading them. It supports Claude Code, Codex, and OpenAI SDK workflows, making it practical to compare costs without rebuilding your application.
Use https://api.59api.com as the service base, following the integration instructions for your SDK’s endpoint configuration. Confirm current model rates, supported identifiers, and usage reporting before switching production traffic. A referral rebate is also available; check its current terms separately from token pricing.
Ship One Measured Improvement Today
Run 20 representative tasks before and after each change. Compare total billed usage, task success, truncation, and retries. Choose the lowest cost per successful result—not simply the shortest response. If you want a low-cost place to run that comparison, consider signing up for 59API and starting with a small pay-as-you-go test.