Skip to navigation

Estimate input tokens

Estimates the input tokens of a decisions request from its questions and the duration of its audio. The body takes the same context and questions as the request part of a POST /v0/decisions/file request, plus audio_duration_ms, the duration of the audio file in milliseconds.

Authentication

X-Hume-Api-Keystring
API Key authentication via header

Request

This endpoint expects an object.
audio_duration_msintegerRequired5000-300000

The duration of the audio file the decisions request would send, in milliseconds. A duration under 5 seconds is rejected with audio_too_short, and one over 5 minutes with audio_too_long.

questionsmap from strings to objectsRequired

The questions to answer: at most 20 noul, choice and score questions together, and at most 5 span questions. Each key is a question ID you choose, such as agent_tone, and can be any non-empty string of up to 256 characters. The response returns each answer under the same ID.

noulobjectRequired

Asks a yes or no question. Optionally, say what counts as yes or no in criteria.

OR
choiceobjectRequired
Asks which of two or more unordered options applies.
OR
scoreobjectRequired
Asks where the audio falls on a scale of two or more ordered levels.
OR
spanobjectRequired
Asks when an event occurs in the audio.
contextstringOptional<=1000 characters
Background information the model considers alongside the audio, such as the setting or who is speaking.

Response

The estimated number of input tokens for the request.
estimated_input_tokensinteger>=0

The estimated number of input tokens for the request: what POST /v0/decisions/file would bill it, as its response’s received.input_tokens. The estimate counts the audio from its duration rather than the file, so it can differ slightly.

Errors

400
Bad Request Error
401
Unauthorized Error
403
Forbidden Error
413
Content Too Large Error
415
Unsupported Media Type Error
429
Too Many Requests Error
500
Internal Server Error