Skip to main content
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

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

At minimum, send: Each message has:

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 response_format.type to json_schema and provide a 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 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.