AI Chat V2 API
POSThttps://api.acedata.cloud/aichat2/conversations
Request Headers
acceptstring
Response format. `application/json` (default) returns a single `{answer, id}` object after generation is complete; `application/x-ndjson` returns a JSON event stream separated by newline characters; `text/event-stream` pushes the same event content in Server-Sent Events format.
Please select
authorizationstring
Bearer token
Request Body
actionstring
The operation to be performed is `chat` by default. `retrieve` loads a single session (requires `id`); `retrieve_batch` lists session summaries (excluding message details) and supports optional filtering conditions; `update` updates `title` or `messages`; `delete` removes the session.
Please select
idstring
Conversation identifier. It is a required field when action=retrieve / update / delete. It is optional when action=chat: if `stateful: true` is set at the same time, the conversation will continue (loading historical messages and appending a new round of dialogue).
modelstringRequired parameter
Specify the model to be used. It is a required field when action=chat; it is an optional filtering condition when action=retrieve_batch.
questionstring
Plain text user prompt (compatible with v1 format). When the `message` field is provided, this field will be ignored.
message
The multimodal user content for this round of dialogue can be a pure string or an array of content blocks. Each content block's `type` can be `text`, `image_url`, or `file_url`. Please use this field for visual or file input; pure text input can continue to use the backward-compatible `question` field.
statefulboolean
Whether to persist the session. When set to `true` (default), this round of conversation will be stored with an `id`, allowing subsequent calls to continue the session. For one-time requests that do not need to be saved, please set it to `false`.
Please select
referencesarray
A list of optional reference URLs attached to this round of conversation. URLs ending with image extensions (jpg / png / webp, etc.) will be automatically converted to `image_url` content blocks, while other URLs will be converted to `file_url` content blocks. This is suitable for v1 compatible scenarios where users do not want to manually construct the `message` array.
presetstring
The preset name of the server-side system prompt applied to this round of dialogue, effective in conjunction with skills and the MCP system prompts.
max_turnsinteger
The maximum number of iterations for the agent loop in this request is constrained by the platform's default value. Each iteration corresponds to one upstream LLM call, and this value should only be increased when a long toolchain is expected.
tool_resultsarray
Used to resume a session that was paused due to `ask_user_question`. Exactly one record must be provided, and its `tool_use_id` must match the tool_use block to be processed. After setting this field, the `question`, `message`, and `references` fields will be ignored.
messagesarray
The message history for replacement is only effective when action=update.
titlestring
Conversation title, effective only when action=update.
user_idstring
Filter sessions by user, effective only when action=retrieve_batch (and only when the caller does not carry user context).
application_idstring
Filter sessions by application, effective only when action=retrieve_batch.
model_groupstring
Filter sessions by service provider grouping, effective only when action=retrieve_batch.
Please select
offsetinteger
The pagination offset of action=retrieve_batch.
limitinteger
The pagination limit for action=retrieve_batch.
Response
AI Dialogue
Allow Use General Balance
When 'Allow General Balance' is enabled, the general balance is used automatically if an app's balance is insufficient.
Kind reminder: For streaming requests, the above code may not be fully applicable. Please refer to the integration documentation for changes.
