Calm motion: animations on this site only fade, with no movement
Token cost
The tokens of a request and what they cost
Shows what one request to a language model costs, in a developer console, a usage page, or a debug panel. For how full the context window is, use the context meter.
Basic
| Tokens | Count | Price per million | Cost |
|---|---|---|---|
| Input | 1,840 | $3.00 | $0.00552 |
| Cached input | 12,000 | $0.30 | $0.0036 |
| Output | 620 | $15.00 | $0.0093 |
| Total | 14,460 | $0.0184 |
usagehas theinputandoutputtokens, and optionalcachedinput tokens. Cached tokens are not part ofinput.pricesare the prices for one million tokens of each kind. Ifcachedhas no price, it costs the same as input.- The table shows the count, the price, and the cost of each kind, and the total in the footer.
- A cost that fits in cents shows as usual. A smaller cost keeps three digits that count, such as $0.0036, so it does not show as $0.00.
currency(default USD) andlocaleformat the money and the counts.modelgoes in the caption.- Change the words with
labelsor a label pack. The API table lists the keys.
The tokenCost function does the math. It is exported for your own views, such as a total for a month.
Usage
ts
import { BlessTokenCost } from "blessing-ui";API
Props
| Name | Type | Default | Description |
|---|---|---|---|
usage* | BlessTokenUsage | — | |
prices* | BlessTokenPrices | — | |
model | string | — | the model, for the caption |
currency | string | "USD" | |
locale | string | "en" | |
labels | Partial<{ caption: (model?: string | undefined) => string; kind: string; tokens: string; price: string; cost: string; input: string; cached: string; output: string; total: string; }> | — |