http
POST /ai/v1/messages/count_tokensCount input tokens for a supported Anthropic deployment without generating content or charging credits.
Parameters
| Name | In | Required | Description |
|---|---|---|---|
x-veryfront-project-reference | header | ||
x-veryfront-project-id | header | ||
x-veryfront-project-slug | header | ||
x-veryfront-agent-run-id | header | ||
x-veryfront-conversation-id | header | ||
x-veryfront-message-id | header | ||
x-veryfront-agent-id | header | ||
x-veryfront-billing-group-id | header |
Request body
| Field | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Catalog model ID or alias. Required: the request is routed by model, not by base URL. |
messages | array | Yes | Vendor-shaped messages, forwarded as sent. |
Responses
| Status | Description |
|---|---|
| 200 | Input-token count for the permitted deployment; no generation or credit charge. |
| 400 | Invalid request |
| 401 | Unauthorized |
| 402 | Insufficient AI credits, an exhausted monthly AI budget, or a provider spend limit |
| 403 | Project access denied |
| 404 | The selected model has no permitted token-counting deployment. Clients may fall back to a character estimate. |
| 413 | Request body over the 32 MiB limit (code request_too_large), or an upstream 413 re-rendered in this envelope |
| 429 | Optional API-key limits or mandatory token-count user, originating-key, project or platform request/attempt quotas were exceeded. Gateway refusals include Retry-After; upstream 429s retain any provider retry headers. |
| 500 | Gateway error, or an upstream 500 re-rendered in this envelope |
| 502 | Gateway proxy error, or an upstream 502 re-rendered in this envelope |
| 503 | No available deployment, auth unavailable, or an upstream 503 re-rendered in this envelope |
| 529 | Upstream provider overloaded, re-rendered in this envelope |
| default | Any other status the upstream provider returned, with the upstream status and its body (if any) re-rendered in this envelope |