Skip to main content

ResponseFormat

Structured response control

When a schema is set, current server validation defaults to enabled unless explicitly disabled. An explicit retry count of zero disables validation retries; omission defaults to one. A retry can incur another model attempt and cost. A schema name is a label, not an immutable schema version.

Usage profiles​

UsageFields and validation
In requestsView fields
In responsesView fields
In webhook payloadsView fields

In requests​

API JSON uses JSON field names (camelCase).

FieldTypePresenceMeaning
jsonObjectbooleanOptionalWhether the model provider is requested to return a valid JSON object.
jsonSchemaMap from string to JSON valueOptionalJSON Schema describing the requested structured model output.
schemaNamestringOptionalHuman-readable name of the structured-output schema, included in structured-message metadata and in the provider request’s json_schema.name.
validatebooleanOptional; explicit presenceEnable server-side validation of the response against json_schema. Default: true when json_schema is set (applied in Go when not explicitly set).
maxValidationRetriesinteger (int32)Optional; explicit presenceMaximum retries when server-side validation fails. Default: 1 when not set. Set to 0 to disable retry (fail immediately on invalid output). Minimum: 0. Maximum: 3.
responseHealingbooleanOptional; explicit presenceEnable response healing for structured JSON output. Defaults to enabled for non-streaming requests with json_schema unless explicitly disabled.

Request validation​

These rules apply when this value is supplied in a request. Request validation does not guarantee that response fields are present or satisfy the same rules.

Applies toRuleRequirement
maxValidationRetriesAt most3
maxValidationRetriesAt least0

In responses​

API JSON uses JSON field names (camelCase).

FieldTypePresenceMeaning
jsonObjectbooleanOptionalWhether the model provider is requested to return a valid JSON object.
jsonSchemaMap from string to JSON valueOptionalJSON Schema describing the requested structured model output.
schemaNamestringOptionalHuman-readable name of the structured-output schema, included in structured-message metadata and in the provider request’s json_schema.name.
validatebooleanOptional; explicit presenceEnable server-side validation of the response against json_schema. Default: true when json_schema is set (applied in Go when not explicitly set).
maxValidationRetriesinteger (int32)Optional; explicit presenceMaximum retries when server-side validation fails. Default: 1 when not set. Set to 0 to disable retry (fail immediately on invalid output). Minimum: -2147483648. Maximum: 2147483647.
responseHealingbooleanOptional; explicit presenceEnable response healing for structured JSON output. Defaults to enabled for non-streaming requests with json_schema unless explicitly disabled.

Request validation​

These rules apply when this value is supplied in a request. Request validation does not guarantee that response fields are present or satisfy the same rules.

Applies toRuleRequirement
maxValidationRetriesAt most3
maxValidationRetriesAt least0

In webhook payloads​

Webhook JSON uses protobuf field names (snake_case).

FieldTypePresenceMeaning
json_objectbooleanOptionalWhether the model provider is requested to return a valid JSON object.
json_schemaMap from string to JSON valueOptionalJSON Schema describing the requested structured model output.
schema_namestringOptionalHuman-readable name of the structured-output schema, included in structured-message metadata and in the provider request’s json_schema.name.
validatebooleanOptional; explicit presenceEnable server-side validation of the response against json_schema. Default: true when json_schema is set (applied in Go when not explicitly set).
max_validation_retriesinteger (int32)Optional; explicit presenceMaximum retries when server-side validation fails. Default: 1 when not set. Set to 0 to disable retry (fail immediately on invalid output). Minimum: -2147483648. Maximum: 2147483647.
response_healingbooleanOptional; explicit presenceEnable response healing for structured JSON output. Defaults to enabled for non-streaming requests with json_schema unless explicitly disabled.

Request validation​

These rules apply when this value is supplied in a request. Request validation does not guarantee that response fields are present or satisfy the same rules.

Applies toRuleRequirement
max_validation_retriesAt most3
max_validation_retriesAt least0

Where used​

ReferenceRelationship
Create an agent profilePOST /api/v1/agent-profiles/create
Import a prompt libraryPOST /api/v1/agent-profiles/import
Update an agent profilePOST /api/v1/agent-profiles/update
Append a message without generatingPOST /api/v1/llm/append-message
Create a new conversation threadPOST /api/v1/llm/create-thread
Send a message to a conversationPOST /api/v1/llm/send-message
Send a message and wait for the resultPOST /api/v1/llm/send-message-sync
Update context management settingsPOST /api/v1/llm/update-context-management-settings
Update default generation configPOST /api/v1/llm/update-default-generation-config
Update the caller's default generation configPOST /api/v1/enduser/update-generation-config
Get an agent profilePOST /api/v1/agent-profiles/get
List agent profilesPOST /api/v1/agent-profiles/list
Withdraw your rating on a messagePOST /api/v1/llm/delete-message-rating
Get full conversation statePOST /api/v1/llm/conversation-state
Rate an assistant messagePOST /api/v1/llm/rate-message
Submit client-side tool results and wait for the next segmentPOST /api/v1/llm/submit-client-tool-results-sync
Get the caller's end-user profilePOST /api/v1/enduser/get
Generation configurationAPI JSON uses JSON field names (camelCase).
llm.generation_startedWebhook JSON uses protobuf field names (snake_case).
llm.message_publishedWebhook JSON uses protobuf field names (snake_case).
GenerationConfigNested in model
GenerationConfigNested in model
GenerationConfigNested in model

Download the public reference contract.

Document: DOC-API-MODEL-response-format.