Usage statistics for the completion request.

interface CompletionUsage {
    completion_tokens: number;
    completion_tokens_details?: CompletionTokensDetails;
    prompt_tokens: number;
    prompt_tokens_details?: PromptTokensDetails;
    total_tokens: number;
}

Properties

completion_tokens: number

Number of tokens in the generated completion.

completion_tokens_details?: CompletionTokensDetails

Breakdown of tokens used in a completion.

prompt_tokens: number

Number of tokens in the prompt.

prompt_tokens_details?: PromptTokensDetails

Breakdown of tokens used in the prompt.

total_tokens: number

Total number of tokens used in the request (prompt + completion).