The per-token price is the smallest part of your bill
Every few weeks another reseller appears offering AI API credits at a fraction of list price. Sometimes that is genuine arbitrage — regional capacity, committed-use blocks, off-peak routing — and it is absolutely worth taking. Other times you are buying a lottery ticket: the tokens are real, but the reliability, model routing, and caching behaviour behind them are not what you assumed.
The trap is that API pricing is quoted per token while your actual cost is per finished outcome. Between those two numbers sit retries, schema failures, timeouts, queueing, and the engineering hours you spend debugging a gateway you cannot inspect.
The real cost equation
Real cost per useful result = everything you were billed for ÷ the outputs that passed your checks. Every failed call that still consumed prompt tokens is spend with no artifact. Every retry re-sends the entire prompt. Every post-processing fix is either a second model call or a human.
So the useful question is not which provider has the lowest rate. It is: what does one validated answer cost me, end to end? A provider with a higher per-token rate that succeeds on the first attempt can beat a cheaper one that needs two tries — before you even count your own time.
Seven ways bargain credits quietly get expensive
Retry inflation — failures still burn input tokens. If a noticeable share of calls needs a retry, your effective token count climbs far above the headline rate.
Tier-based rate limits — a low rate often ships with a low concurrency cap, so the batch that took minutes now takes hours.
Silent model swaps — some gateways route to whichever model is cheapest at that moment, so output quality drifts and your evals stop meaning anything.
Weak structured output — if the endpoint does not reliably honour JSON mode and tool calls, you pay a parsing tax in code complexity and edge cases.
Expiring quota — credits that must be burned in a fixed window push you into low-value calls just to avoid waste.
No cache visibility — context caching is one of the biggest legitimate cost levers. Providers that neither expose nor honour cache hits erase that saving silently.
Support vacuum — when a gateway goes dark there is often nobody to escalate to and no documented migration path.
What cheap looks like when you measure it
Suppose you wire two providers into the same extraction task with the same prompt and the same validator. Provider A is the bargain: fast most of the time, but a meaningful share of responses fail schema validation and get retried. Provider B bills more per token but returns a valid object on the first attempt.
Count tokens billed, not answers received. Provider A can end up with more billed tokens than Provider B despite the lower rate — and that is before latency and debugging time. Do not take anyone's word for which is which, including ours. Measure it.
How to measure effective cost per successful task
Build the test from your own traffic: 30-50 real prompts paired with a programmatic checker — a JSON schema, a regex, a unit assertion, or a rubric. Run the same set against each endpoint and record three things: tokens billed, wall-clock latency, and whether the output passed.
The script below runs that loop against any OpenAI-compatible endpoint. Change base_url and the API key to test a vendor, then compare tokens per successful task rather than tokens per call.
import json
import os
import statistics
import time
from openai import OpenAI
# Swap base_url and the key to test any OpenAI-compatible endpoint.
client = OpenAI(
api_key=os.environ["AICREDITS_API_KEY"],
base_url="https://api.aicreditsapi.com/v1",
)
SYSTEM = (
"You are a data-extraction engine. Reply with a single JSON object only. "
"No markdown, no commentary."
)
TASKS = [
"Extract company and founding year: 'Northwind Traders was founded in 1998 in Oslo.' Keys: company, year.",
"Extract company and founding year: 'Acme Robotics, established 2011, is based in Berlin.' Keys: company, year.",
"Extract company and founding year: 'The Helios Lab began operations in 2005.' Keys: company, year.",
"Extract company and founding year: 'Founded in 2017, Vertex Foods is a supplier.' Keys: company, year.",
"Extract company and founding year: 'Blue Harbor Bank opened in 1974.' Keys: company, year.",
]
def run_once(prompt):
started = time.perf_counter()
resp = client.chat.completions.create(
model="deepseek-v4-flash",
messages=[
{"role": "system", "content": SYSTEM},
{"role": "user", "content": prompt},
],
temperature=0,
max_tokens=200,
response_format={"type": "json_object"},
)
elapsed = time.perf_counter() - started
text = resp.choices[0].message.content or ""
ok = False
try:
data = json.loads(text)
ok = isinstance(data, dict) and {"company", "year"} <= set(data)
except json.JSONDecodeError:
pass
return {
"ok": ok,
"latency_s": elapsed,
"tokens": resp.usage.prompt_tokens + resp.usage.completion_tokens,
}
results = [run_once(task) for task in TASKS]
good = [r for r in results if r["ok"]]
billed = sum(r["tokens"] for r in results)
print(f"runs: {len(results)}")
print(f"passed validation: {len(good)}")
print(f"success rate: {len(good) / len(results):.0%}")
print(f"median latency: {statistics.median(r['latency_s'] for r in results):.2f}s")
print(f"tokens billed: {billed}")
print(f"tokens per successful task: {billed / len(good):.0f}" if good else "no successes")
Reading the output matters. A high success rate with more tokens per task can still win if the failures are the expensive kind. And if a provider rejects response_format, delete that argument and keep the strict JSON instruction in the system prompt instead — what the model was actually told matters more than which flag produced it.
Guard the calls you do make
Cheap credits fail the same way as expensive ones: transient 5xx responses, timeouts, empty completions. A retry wrapper with exponential backoff turns most of those into a non-event, and escalating to a stronger model on the final attempt turns the rest into a slow success instead of a failed job.
import os
import random
import time
from openai import OpenAI, APIError, APITimeoutError, RateLimitError
client = OpenAI(
api_key=os.environ["AICREDITS_API_KEY"],
base_url="https://api.aicreditsapi.com/v1",
)
RETRYABLE = (APIError, APITimeoutError, RateLimitError)
def complete(messages, attempts=3):
"""Retry cheap fast calls, then escalate to the stronger model."""
for attempt in range(attempts):
last_attempt = attempt == attempts - 1
try:
return client.chat.completions.create(
model="deepseek-v4-pro" if last_attempt else "deepseek-v4-flash",
messages=messages,
temperature=0,
)
except RETRYABLE:
if last_attempt:
raise
time.sleep(2 ** attempt + random.random())
raise RuntimeError("unreachable")
Cache-aware prompting: the saving a cheap gateway can erase
Cached input is billed more cheaply than fresh input, but that only helps if the cacheable part of your prompt is byte-identical between calls and sits at the front. Put long, stable instructions and schemas first; put the variable user content last. If a bargain gateway rewrites, reorders, or re-wraps system prompts, you lose cache hits and never see it on the invoice.
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["AICREDITS_API_KEY"],
base_url="https://api.aicreditsapi.com/v1",
)
# Byte-identical on every call and kept at the front, so it can be cached.
STABLE_PREFIX = (
"You are a support triage classifier. Return one JSON object with exactly "
"three keys: category (billing|bug|feature|other), severity (low|medium|high), "
"and summary (max 20 words). Return no prose and no other keys."
)
def classify(ticket_text):
resp = client.chat.completions.create(
model="deepseek-v4-flash",
messages=[
{"role": "system", "content": STABLE_PREFIX},
{"role": "user", "content": ticket_text},
],
temperature=0,
response_format={"type": "json_object"},
)
return resp.choices[0].message.content
print(classify("Export button returns a 500 for accounts older than 2019."))
A checklist to run before you commit volume
| Signal | What to ask | Why it matters |
|---|---|---|
| Model identity | Which model handles my request, and can it change? | Silent routing makes evals meaningless and quality unpredictable. |
| Failure billing | Are failed or truncated responses billed? | You cannot compute effective cost without knowing what failures cost. |
| Concurrency | Requests per minute and concurrent streams on my tier | A low cap turns a fast pipeline into an overnight job. |
| Cache behaviour | Is context caching exposed, and how is cached input treated? | Caching is a real lever; hidden cache behaviour hides the loss. |
| Quota terms | Do credits expire, and do unused credits roll over? | Expiring quota creates pressure to make low-value calls. |
| Data handling | Retention, logging, and whether prompts train anything | Cheap often means unstated, and for regulated data that is disqualifying. |
| Continuity | What is my migration path if this gateway changes? | You are betting your uptime on someone else's upstream deals. |
Where AiCredits fits
We sell DeepSeek API credits, so we have an obvious bias — but here is the honest framing: what we optimise for is not being the absolute cheapest rate on the internet. It is being an endpoint you can budget predictably. You get deepseek-v4-flash as a fast default and deepseek-v4-pro when a task genuinely needs more reasoning, paid with a card or PayPal, with no Chinese phone number or bank account required. Current rates live at aicreditsapi.com/pricing rather than being negotiated in DMs.
Off-peak requests cost less than peak, and cached input costs less than fresh input, so the levers that actually shrink your bill are workload shaping and prompt structure — not hunting for a lower headline rate. We also build linting tools for the code around these calls, because a schema bug in your parser can waste more tokens than the API ever did.
FAQ
Yes. Regional pricing, committed-use blocks, and off-peak capacity are legitimate and worth using. The problem is not low rates; it is low rates combined with hidden failure rates, silent model swaps, or expiring quota. Test the endpoint on your own tasks before committing volume.
You cannot inspect routing directly, so test behaviour. Run a fixed eval set with strict validators — JSON schema, tool-call arguments, format constraints — and watch for drift over time. A sudden shift in instruction-following or reasoning depth with no change to your prompt is the signal.
Start with deepseek-v4-flash for almost everything: extraction, classification, summarisation, code edits. Move to deepseek-v4-pro where a wrong answer costs more than the extra tokens, such as multi-step reasoning, ambiguous instructions, or long-context synthesis. You can also escalate mid-retry, as the wrapper above does.
We deliberately do not print numbers in articles, because they change. Current rates, including off-peak and cache pricing, are published at aicreditsapi.com/pricing.