Endpoint
Request Headers
Replace
YOUR_API_KEY with the API key created in the A2Agent console.
A2Agent usesAuthorization: Bearerfor this compatibility endpoint. Do not replace it withx-api-keyunless 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 inmessages must contain:
For a basic text request, use a string:
Example Request
GET /v1/models. Model IDs are case-sensitive.
Example Response
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 atchoices[0].message.content. For a basic text response, read:
type before reading its fields.
Response Fields
The response follows the Anthropic message shape. The field pathcontent[] 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_startcontent_block_startcontent_block_deltacontent_block_stopmessage_deltamessage_stop
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.