Skip to Content
Anuma SDKClientInternalType AliasesLlmapiChatCompletionResponse

LlmapiChatCompletionResponse

LlmapiChatCompletionResponse = Omit<GeneratedLlmapiChatCompletionResponse, "usage"> & object

Defined in: src/clientCompat.ts:77 

Override the generated LlmapiChatCompletionResponse so legacy top-level fields (tools_checksum, tool_call_events, inference_id, …) and cost-on-usage (usage.cost_micro_usd, usage.credits_used) remain readable by SDK consumers that haven’t migrated to the new portal envelope.

The portal returns the strict OpenAI-compliant shape on the wire; the SDK’s streaming buildFinalResponse populates both paths so reads on either side succeed. Non-streaming direct calls (postApiV1ChatCompletions) return only the wire shape — legacy fields are undefined there, matching the optional typing below.

TODO(deprecate-legacy-chat-completion-mirrors) [#548]: the legacy top-level fields and the cost-on-usage fields below are slated for removal in the next SDK MAJOR bump, paired with the mirror-emission in strategies/completions.ts buildFinalResponse. See that TODO for the full deprecation plan.

Type Declaration

client_injected_tools?

optional client_injected_tools: string[]

image_model?

optional image_model: string

inference_id?

optional inference_id: string

messages?

optional messages: LlmapiMessage[]

portal_injected_tools?

optional portal_injected_tools: string[]

tool_call_events?

optional tool_call_events: LlmapiToolCallEvent[]

tools_checksum?

optional tools_checksum: string

usage?

optional usage: LlmapiChatCompletionUsage

Last updated on