API reference
Count tokens
Count or estimate the input tokens in a Messages request.
Request fields come from the gateway's OpenAPI document. See authentication and headers and errors.
The OpenAPI document does not define response schemas for these routes. Missing response fields below do not mean the API returns an empty response.
POST
header
AuthorizationBearer <token>application/json- body
model*stringLength
1 <= lengthsystem?string|array<>messages*array<|>Items
1 <= itemstemperature?numberRange
0 <= value <= 1top_p?numberRange
0 <= value <= 1top_k?integerRange
0 <= value <= 9007199254740991stop_sequences?array<string>tools?array<>cache_control?|nulltool_choice?|thinking?|||output_config?metadata?[key: string]?unknownDefault Response
curl -X POST 'https://unused.market/v1/messages/count_tokens' \ -H 'Content-Type: application/json' \ -d '{ "model": "string", "messages": [ { "role": "user", "content": "string" } ], "property1": null, "property2": null}'Empty