Create inference result
Create a new inference result. Identify the session with exactly one of sessionId or sessionCustomId. With sessionCustomId (your own conversation id) an existing session with that custom id is found and appended to: provide either versionId or productId as the anchor (if both are given, versionId wins). The session must already exist — create it first through the sessions API with that custom_id. If no matching session exists, the call is rejected with a 400. See Inference Results.
Authorizations
API key authorization. Pass your API key in the Authorization header as a Bearer token. Both new (gsk_*) and legacy (gsk-) API keys are accepted, e.g. Authorization: Bearer gsk_... or Authorization: Bearer gsk-....
Body
ID of the session. Provide this or sessionCustomId.
"session_123"
Your own conversation id. An existing session with this custom id is found and appended to; if none matches the call returns a 400, so create the session first through the sessions API. Requires versionId or productId. Provide this or sessionId.
"my-conversation-42"
Version anchor for the sessionCustomId lookup. Provide this or productId; if both are given, versionId wins.
"ver_123"
Product anchor for the sessionCustomId lookup when no versionId is given: the existing session with that custom id is found across the product's versions.
"prod_123"
ID of the user
"user_123"
Index of the inference result
0
Status of the inference result
PENDING, GENERATED, FAILED, SKIPPED Error message explaining why this inference result failed or was skipped
Structured input data. For plain text, use { user_message: "..." }
Agent output. Plain text by default (the scored scalar); for voice, an envelope { assistant_message, content: [{ type, uri, transcript }] } carrying audio parts. An audio part without a transcript is rejected with a 400.
"Model response text"
Retrieval context information
"Retrieved context document"
Latency in milliseconds
Number of input tokens
Number of output tokens
Number of cache read input tokens
Total number of tokens
Cost per input token
Cost per output token
Cost per cache read input token
Total cost
Version of the conversation simulator
Response
Inference result created successfully
"ir_123"
"session_123"
"user_123"
Order index within the session
0
PENDING, GENERATED, FAILED, SKIPPED "PENDING"
Error message explaining why this inference result failed or was skipped
null
Structured input data. For plain text input, format is { user_message: "..." }
The agent turn output. Plain text by default (the scored scalar). For voice turns, an envelope { assistant_message, content: [{ type, uri, transcript }] } carrying audio parts — the scored scalar stays the canonical transcript.
"Model response"
150
100
50
20
Total tokens
150
0.00001
0.00003
0.000005
0.001
1
"1.0.0"
W3C trace ID for the root span created during direct inference. The same trace ID is propagated to the user endpoint via the traceparent header.
"a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4"