Skip to content

How can I check the actual token charge for a completed DeepSeek answer?

Read usage.prompt_tokens and usage.completion_tokens in the confirmed response, together with the aiswaplab receipt fields. Current retail rates are $0.20 per million input tokens and $0.80 per million output tokens. The response records the final credits and reserved_credits; unused reservation can be returned after confirmed settlement.

BUILD NON-STREAMING TEXT WORKFLOWSAISwapLab team · Editorial methodUpdated 2 min read
Open API documentationExplore 67 Image SkillsPrivate keys · Explicit credit approval
Article workflow: Save the confirmed receipt; Calculate the retail amount; Reconcile returned reservation.
Workflow diagram: Save the confirmed receipt → Calculate the retail amount → Reconcile returned reservation. Read the article for evidence and limits.

The quote is intentionally not an exact tokenizer result

Preflight uses a conservative input bound plus the requested output ceiling. Actual metered input and output can be lower. Treat the confirmed usage as the basis for the settled text price, and keep credit rounding separate from a claim that every tiny request consumes a whole credit.

What to do next

  1. 01

    Save the confirmed receipt

    Retain the job ID, model alias, credit_version, measured tokens, final credits and original reserved amount. Keep those operational fields without exposing private conversation content in routine logs.

  2. 02

    Calculate the retail amount

    Multiply input tokens by 0.20/1,000,000 and output tokens by 0.80/1,000,000, then add them. Compare with the recorded USD list amount and allow for documented credit-step rounding.

  3. 03

    Reconcile returned reservation

    Distinguish unused-reservation settlement from a failed-job return. A successful short answer can return part of its ceiling while still consuming a small measured charge.

A concrete example

Illustrative arithmetic: 1,000 input tokens and 500 output tokens allocate $0.0006 at those retail rates before credit-step rounding. This is a calculation example, not a newly executed chat call or an upstream supplier-cost statement.

Retail arithmetic without an API call

Illustrative integration code. No paid generation was executed for this guide. Review live availability, quotes and your own approval before running creation requests.

python
from decimal import Decimal, ROUND_CEILING

# Illustrative current retail usage, not a provider invoice.
input_tokens, output_tokens = 1000, 500
usd = (Decimal(input_tokens) * Decimal("0.20")
       + Decimal(output_tokens) * Decimal("0.80")) / Decimal(1_000_000)
credits = max(Decimal(1), (usd * Decimal(600)).to_integral_value(
    rounding=ROUND_CEILING))
print(usd, credits)  # 0.0006 USD list amount; 1 whole v4 credit

Before you call it ready

  • Input and output tokens use their respective rates.
  • The reservation and final debit remain distinct.
  • Retail price is not confused with provider cost.

When to stop or choose another method

If measured usage is absent or the outcome is uncertain, do not invent an actual token charge. Retain the existing task for reconciliation instead of estimating a settled receipt from text length.

Sources

One task. A recoverable workflow.

Check the contract, approve the quote and retain the job.

Open API documentation