Skip to main content
POST
Create inference result

Authorizations

Authorization
string
header
required

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

application/json
sessionId
string

ID of the session. Provide this or sessionCustomId.

Example:

"session_123"

sessionCustomId
string

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.

Example:

"my-conversation-42"

versionId
string

Version anchor for the sessionCustomId lookup. Provide this or productId; if both are given, versionId wins.

Example:

"ver_123"

productId
string

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.

Example:

"prod_123"

userId
string | null

ID of the user

Example:

"user_123"

index
integer

Index of the inference result

Example:

0

status
enum<string>

Status of the inference result

Available options:
PENDING,
GENERATED,
FAILED,
SKIPPED
error
string | null

Error message explaining why this inference result failed or was skipped

input
object | null

Structured input data. For plain text, use { user_message: "..." }

actualOutput

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.

Example:

"Model response text"

retrievalContext
string | null

Retrieval context information

Example:

"Retrieved context document"

latency
number | null

Latency in milliseconds

inputTokens
integer | null

Number of input tokens

outputTokens
integer | null

Number of output tokens

cacheReadInputTokens
integer | null

Number of cache read input tokens

tokens
integer | null

Total number of tokens

costPerInputToken
number | null

Cost per input token

costPerOutputToken
number | null

Cost per output token

costPerCacheReadInputToken
number | null

Cost per cache read input token

cost
number | null

Total cost

conversationSimulatorVersion
string | null

Version of the conversation simulator

Response

Inference result created successfully

id
string
Example:

"ir_123"

sessionId
string
Example:

"session_123"

userId
string | null
Example:

"user_123"

index
integer

Order index within the session

Example:

0

status
enum<string>
Available options:
PENDING,
GENERATED,
FAILED,
SKIPPED
Example:

"PENDING"

error
string | null

Error message explaining why this inference result failed or was skipped

Example:

null

input
object | null

Structured input data. For plain text input, format is { user_message: "..." }

Example:
actualOutput

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.

Example:

"Model response"

latency
integer | null
Example:

150

inputTokens
integer | null
Example:

100

outputTokens
integer | null
Example:

50

cacheReadInputTokens
integer | null
Example:

20

tokens
integer | null

Total tokens

Example:

150

costPerInputToken
number | null
Example:

0.00001

costPerOutputToken
number | null
Example:

0.00003

costPerCacheReadInputToken
number | null
Example:

0.000005

cost
number | null
Example:

0.001

creditsUsed
integer | null
Example:

1

conversationSimulatorVersion
string | null
Example:

"1.0.0"

traceId
string | null

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.

Example:

"a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4"

createdAt
string<date-time>
deletedAt
string<date-time> | null