Skip to main content
A2Agent uses the Anthropic Messages request and response shape at this endpoint. The examples below use Bearer Token authentication, as required by A2Agent. The model IDs are A2Agent model IDs and may be aliases controlled by A2Agent routing configuration.

Endpoint

Request Headers

Replace YOUR_API_KEY with the API key created in the A2Agent console.
A2Agent uses Authorization: Bearer for this compatibility endpoint. Do not replace it with x-api-key unless A2Agent explicitly instructs you to do so.

Request Body Parameters

string
required
The ID of the model to use. For example: deepseek-v4-pro, deepseek-v4-flash, qwen3.8-max. See List Models for the full list of available IDs.
array
required
An ordered array of message objects representing the conversation history. Each object must contain a role and content.
integer
Maximum output tokens. This field is required; a low value may end generation with stop_reason: "max_tokens". The allowed maximum depends on the model and account.
number
Controls randomness: lower values are more deterministic and higher values more varied. The range and default depend on the model; use it or top_p, not both.
boolean
When true, returns an SSE stream; when omitted or false, returns one complete JSON response. Anthropic streams use message/content-block events.
number
Nucleus-sampling threshold. Lower values focus the output and higher values allow more candidates. The range and default depend on the model; use it or temperature, not both.

Message Object

Each item in messages must contain: For a basic text request, use a string:

Example Request

Use the exact model ID returned by GET /v1/models. Model IDs are case-sensitive.

Example Response

This is an observed response sample from A2Agent. The id, generated text, and token counts vary for each request. A2Agent may add, omit, or extend metadata fields over time.

Reading the Text Response

Unlike an OpenAI Chat Completions response, the text is not located at choices[0].message.content. For a basic text response, read:
For example:
If a response contains multiple content blocks, inspect each block’s type before reading its fields.

Response Fields

The response follows the Anthropic message shape. The field path content[] refers to each content block in the content array.

Streaming

Set "stream": true to request server-sent events (SSE), if streaming is enabled for the selected model and account. Anthropic streaming events are not the same as OpenAI chat.completion.chunk objects or the [DONE] marker. A standard Anthropic stream can contain events such as:
  • message_start
  • content_block_start
  • content_block_delta
  • content_block_stop
  • message_delta
  • message_stop
Text deltas are normally found in a content_block_delta event under a text delta object. Confirm the exact event sequence and fields against the A2Agent response before documenting streaming as generally available.