Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explaining billed tokens and why they're different. #399

Merged
merged 3 commits into from
Feb 6, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions fern/pages/going-to-production/how-does-cohere-pricing-work.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,25 @@ Our Rerank models are priced based on the quantity of searches, and our Embeddin

You can find up-to-date prices on our [dedicated pricing page](https://cohere.com/pricing).

### What's the Difference Between "billed" Tokens and Generic Tokens?

When using the [Chat API endpoint](https://docs.cohere.com/reference/chat), the response will contain the total count of input and output tokens, as well as the count of _billed_ tokens. Here's an example:

```json JSON
{
"billed_units": {
"input_tokens": 6772,
"output_tokens": 248
},
"tokens": {
"input_tokens": 7596,
"output_tokens": 645
}
}
```

The rerank and embed models have their own, slightly different versions, and it may not be obvious why there are separate input and output values under `billed_units`. To clarify, the _billed_ input and output tokens are the tokens that you're actually _billed_ for. The reason these values can be different from the overall `"tokens"` value is that there are situations in which Cohere adds tokens under the hood, and there are others in which a particular model has been trained to do so (i.e. when outputting special tokens). Since these are tokens *you don't have control over, you are not charged for them.*

## Trial Usage and Production Usage

Cohere makes a distinction between "trial" and "production" usage of an API key.
Expand Down