What an AI task costs on the DipoleML API, worked to the cent

On the DipoleML API, a request costs its new input tokens at the input price, its cached input at the cached price and its output, reasoning included, at the output price. Worked from our published prices, a 30,000-token code review costs $0.0250 on Raven Flash and $0.0625 on Raven Max.
Key facts
- Each request costs (input - cached) x input price + cached x cached price + output x output price, with prices per 1M tokens.
- Reasoning tokens are output tokens, billed at the output price: $2.50 per 1M on Raven Flash, $6.25 on Raven Max.
- A 30,000-token code review: $0.0250 on Raven Flash, $0.0625 on Raven Max.
- 10,000 support replies with a cached 10,000-token prompt: $25.00 on Raven Flash, against $70.00 without the cache.
- Prepaid credit packs of $5, $10, $20 and $50 never expire and are separate from every plan.
Per-token prices are easy to publish and hard to picture. This piece prices three everyday tasks on the DipoleML API, on both Raven models, from the prices on our pricing page. The token counts are our assumptions for each task, stated as we go; the arithmetic is the API's own. The requests are Chat Completions in the OpenAI SDK format.
How is a request billed?
Calls with an API key are paid from prepaid credits, per token, at the prices of the model you call:
| Per 1M tokens | Raven Flash | Raven Max |
|---|---|---|
| Input | $0.50 | $1.25 |
| Cached input | $0.05 | $0.13 |
| Output | $2.50 | $6.25 |
Each request costs its new input at the input price, its cached input at the cached price and its output at the output price:
cost = (input - cached) x input price
+ cached x cached price
+ output x output price
(prices per 1M tokens)
Two details shape the sums below. Reasoning tokens are output tokens: they count toward max_tokens and are billed at the output price. And cached input is the part of your input the model reports as already cached, in usage.prompt_tokens_details.cached_tokens. It is applied on its own, with no flag to set, at up to 90% less than the input price.
What does a code review cost?
Say you send a pull request's diff with the files around it, 30,000 tokens in all, and ask for a review. The model reasons for 2,500 tokens and writes a 1,500-token review, so the output is 4,000 tokens. Nothing is cached, because the code is new each time. Here is what a thousand such reviews cost:
| Per 1,000 reviews | Raven Flash | Raven Max |
|---|---|---|
| New input, 30,000 tokens | $15.00 | $37.50 |
| Output, reasoning included, 4,000 tokens | $10.00 | $25.00 |
| Total | $25.00 | $62.50 |
One review costs $0.0250 on Raven Flash and $0.0625 on Raven Max.
What does a support reply cost?
A support assistant sends the same long instructions with every ticket: say 10,000 tokens of policies and product facts at the start of the request, then the customer's thread, 1,000 tokens. The reply is 600 output tokens, reasoning included. After the first reply, the model reports the repeated instructions as cached, so they are billed at the cached price:
| Per 1,000 replies | Raven Flash | Raven Max |
|---|---|---|
| New input, 1,000 tokens | $0.50 | $1.25 |
| Cached input, 10,000 tokens | $0.50 | $1.30 |
| Output, reasoning included, 600 tokens | $1.50 | $3.75 |
| Total | $2.50 | $6.30 |
One reply costs $0.0025 on Raven Flash and $0.0063 on Raven Max. For 10,000 replies, that is $25.00 and $63.00. Without the cache, the same replies would cost $70.00 and $175.00.
10,000 support repliesUS dollars
| Model and cache | US dollars |
|---|---|
| Raven Max, without the cache | 175 |
| Raven Flash, without the cache | 70 |
| Raven Max, with the cache | 63 |
| Raven Flash, with the cache | 25 |
What does it cost to read a long document twice?
Say you send a 150,000-token contract with a 400-token question, then send the same contract again with a second question. Each answer is 2,000 output tokens, reasoning included. Both requests fit in the 1M-token context window of either model. On the second request, the model reports the contract as cached:
| Line | Raven Flash | Raven Max |
|---|---|---|
| First question | ||
| New input, 150,400 tokens | $0.0752 | $0.1880 |
| Output, reasoning included, 2,000 tokens | $0.0050 | $0.0125 |
| Second question | ||
| New input, 400 tokens | $0.0002 | $0.0005 |
| Cached input, 150,000 tokens | $0.0075 | $0.0195 |
| Output, reasoning included, 2,000 tokens | $0.0050 | $0.0125 |
| Total | $0.0929 | $0.2330 |
Both questions together cost $0.0929 on Raven Flash and $0.2330 on Raven Max. Without the cache, the second question would cost as much as the first, and the two together $0.1604 on Raven Flash and $0.4010 on Raven Max.
What each task costsUS dollars per task
| Task and model | US dollars per task |
|---|---|
| Document read twice, Raven Max | 0.2330 |
| Document read twice, Raven Flash | 0.0929 |
| Code review, Raven Max | 0.0625 |
| Code review, Raven Flash | 0.0250 |
| Support reply, Raven Max | 0.0063 |
| Support reply, Raven Flash | 0.0025 |
Where do I read the token counts?
In the usage of every answer: prompt_tokens for the input, completion_tokens for the output with its reasoning, and prompt_tokens_details.cached_tokens for the cached part. The same formula in Python, with the OpenAI SDK pointed at our base URL:
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.dipoleml.com/v1",
api_key=os.environ["RAVEN_API_KEY"],
)
# US dollars per 1M tokens: input, cached input, output
PRICES = {
"Raven Flash": (0.50, 0.05, 2.50),
"Raven Max": (1.25, 0.13, 6.25),
}
MODEL = "Raven Flash"
resp = client.chat.completions.create(
model=MODEL,
messages=[{"role": "user", "content": "Review this diff: ..."}],
)
u = resp.usage
details = u.prompt_tokens_details
cached = (details.cached_tokens or 0) if details else 0
inp, cac, out = PRICES[MODEL]
cost = ((u.prompt_tokens - cached) * inp + cached * cac + u.completion_tokens * out) / 1_000_000
print(f"${cost:.4f}")
How do I keep the cost down?
- Send the work that fits it to Raven Flash. Raven Max's input and output prices are 2.5 times Raven Flash's.
- Put what repeats at the start. Instructions and documents that open every request are where the cache applies.
- Let simple jobs think less. With
reasoning_effortset tolow, the model spends fewer output tokens on reasoning. - Give each app its own key. A spending cap on each key keeps one app from using the whole balance; see Management Keys.
How do I pay for it?
With prepaid credits, in packs of $5, $10, $20 and $50. Credits never expire, every API key on your account draws on the same balance, and they are separate from every plan: you do not need a plan to call the API, and a plan never uses your credits. When the balance runs out, requests are refused with 402 until you add credits. The details are in the API Credits docs, and the models and formats on the API page.
Product names are trademarks of their owners and are used here only to identify the products.
Questions and answers
Are reasoning tokens billed?
Yes, as output tokens, at the output price of the model you call. They also count toward max_tokens. For simple jobs, setting reasoning_effort to low uses fewer of them.
When is input billed at the cached price?
When the model reports part of your input as already cached, in usage.prompt_tokens_details.cached_tokens. There is no flag to set. A long prefix you repeat, such as a system prompt or a document, is where it helps most, at up to 90% less.
Do I need a plan to use the API?
No. API calls are paid from prepaid credits, which are separate from every plan, and a plan never uses your credits. Packs start at $5 and never expire.
First published Last updated


