Skip to main content
Upcoming release — Zylon 1.58These docs are published ahead of release so you can prepare your API integrations. The release image is not yet available. For installations running 1.57, use the 1.57 documentation.
Messages is the core of ZylonGPT. You send a conversation history, and Zylon returns the next assistant message as a list of content blocks (text, tool calls, tool results, and more).

Prerequisites

PrivateGPT.Read.All permits synchronous POST /messages, POST /messages/validate, and the other endpoints in the ZylonGPT read-only allowlist. Read.All permits the same calls only when the account token carries gateway_id; without gateway context, it cannot call ZylonGPT. Effective access also depends on the token owner’s role permissions.

Basic request and response

Send one user message and get back one assistant message.
To render plain text, concatenate the text values from any blocks where type is "text".

Messages shape

The same message body is used by ZylonGPT and by the pgpt field in Workspace chat/interaction requests. Send conversation content; the selected model or gateway determines which optional settings it supports. model and max_tokens are nullable options, rather than universally required fields. Keeping them explicit makes model selection and output limits predictable; validate requests against your gateway.
Nullable fields can be omitted. A non-nullable option with a default can be omitted but should not be sent as null.
response_format is deprecated; use output_config.format. Move deprecated thinking.effort to output_config.effort. Replace system.use_default_prompt with the individual system.prompt flags; setting the old flag to true enables all prompt categories.
usage may include cache_creation_input_tokens, cache_read_input_tokens, inference_geo, service_tier, cache_creation (ephemeral_1m_input_tokens, ephemeral_1h_input_tokens, ephemeral_5m_input_tokens), and server_tool_use (web_fetch_requests, web_search_requests). Counts in the nested usage objects default to 0. Nullable response fields may be omitted. There is no top-level stop_sequence field; use stop_reason: "stop_sequence". See Handling stop reasons.

Validate a request

Use /messages/validate to check payload shape before sending a real request. It returns valid: true or a list of validation errors.
Example response:

Multi-turn conversations

To continue a conversation, include the prior turns in messages:

System prompts

Use the top-level system field to control assistant behavior (instead of a "system" role message):
Prefer the top-level system field for system instructions so they are applied consistently across the whole request.

Structured JSON output (json_schema)

If you need machine-readable output, set output_config.format.type to json_schema and provide output_config.format.schema. Zylon returns JSON as text in a text content block.

Streaming (SSE)

Set stream: true to receive a text/event-stream response containing events like content_block_delta (token deltas).

Async messages

Async message start, stream, status, cancel, and delete routes require PrivateGPT.ReadWrite.All or ReadWrite.All. Read-only tokens receive 403 for every async lifecycle route.
Async messages use the same request body as sync messages—you just call a different endpoint. The main difference is the response shape: sync returns a full message, async returns a message_id you can stream or poll later.

Start an async message

Stream or poll status

Stream events:
Poll status:

Cancel or delete

  • Cancel: POST /messages/async/{message_id}/cancel
  • Delete: DELETE /messages/async/{message_id}/delete

Common mistakes

  • Wrong method: /messages is POST, not GET.
  • Missing auth header: include Authorization: Bearer ....
  • Wrong base URL: use https://{BASE_URL}/api/gpt/v1/.
  • Invalid request body: use POST /messages/validate to catch schema mistakes early.
  • Unexpected stops or errors: see Handling stop reasons for causes and fixes.

Next steps

Tools

Let Zylon use built-in and custom tools during a message.

Artifacts

Ingest text, files, or URIs into collections for retrieval.