Skip to main content
You can retrieve the log probability of each generated token. This is useful for uncertainty estimation, token-level filtering, confidence scoring, or building custom sampling logic. Log probabilities are supported across all request modes:
  • OpenAI-compatible API — using logprobs and top_logprobs parameters
  • DeepInfra Native API — streaming and non-streaming

OpenAI-compatible API

Set logprobs: true in your request. Optionally set top_logprobs (1–20) to also get the top alternative tokens at each position.
Response structure:

DeepInfra Native API (streaming)

The native streaming API returns log probabilities inline with each token as it is generated.
Response (streamed):
The logprob field is the log probability of the generated token (base e). Lower (more negative) values indicate less likely tokens.