/api/ai/BuiltInModel/chat
Total calls: 0
AI Chat (unified entry)
Start a chat with the model of your choice: supports a single message, a full message list, a caller-supplied system prompt, image/video/audio understanding and streaming output.
Optional: omit to use the platform default model. Candidates come from the platform (see the Model List endpoint).
Optional: message content for a simple single-turn chat (provide at least one of content or messages)
Optional: for multi-turn chat, formatted as a JSON array with role set to user/assistant; takes precedence over content
Optional: temporarily override the platform setting; omit to use the prompt configured for the model; empty string to use no system prompt
Optional: only for models marked as vision-capable. Public image URLs as a JSON array or plain text (newline/comma separated); the per-model image cap is configured on the platform (adjustable in the console).
Optional: only for models marked as video-capable (e.g. Doubao Seed 2.0 omni-modal). Public video URLs as a JSON array or plain text (newline/comma separated); the per-model video cap is configured on the platform (adjustable in the console).
Optional: only for models marked as audio-capable (e.g. Doubao Seed 2.0 omni-modal). Public audio URLs as a JSON array or plain text (newline/comma separated); the per-model audio cap is configured on the platform (adjustable in the console). Upload the audio via the File Upload service first, then pass the returned URL here.
Optional: pass your own key (it must belong to the vendor of the chosen model); otherwise the platform key is used.
Optional: when true, the response is SSE (text/event-stream), pushed chunk by chunk
- The request body is an application/x-www-form-urlencoded form; this service requires the project signature.
- Provide at least one of content or messages, otherwise a missing parameter error is returned.
- The images parameter works only for vision-capable models; other models return an invalid-value error (20003). The number of images is capped per model on the platform (adjustable in the console); exceeding the cap returns the same invalid-value error.
- videos works only for video-capable models (e.g. Doubao Seed 2.0 omni-modal, which understands both the picture and the audio track); other models return an invalid-value error (20003). The video count limit is likewise configured per model by the platform, and going over it returns an invalid-value error.
- audios works only for audio-capable models (e.g. Doubao Seed 2.0 omni-modal, for speech transcription and audio understanding); other models return an invalid-value error (20003). The audio count limit is likewise configured per model by the platform, and going over it returns an invalid-value error.
- Temperature, max reply length and stop words are configured per model by the platform and are not accepted from callers; passing one returns an invalid-value error (20003).
- Streaming mode returns SSE: each frame is either data: {"content": "chunk"} (the answer) or data: {"reasoning": "chunk"} (a reasoning model's thinking; only such models emit it, and it is sent separately from the answer, so ignore it if you only care about the answer), terminated by data: [DONE]. The live debugger renders the answer as Markdown and prints it character by character; a reasoning model's thinking goes into a collapsible "Reasoning" block that is expanded while it streams and collapses once the answer starts.
- Live debugging really consumes upstream quota — make sure the platform key works first.
- The former prefix-completion capability (prefix / prefix_content) has been retired; passing it returns an invalid-value error.
The fields below describe data when stream=false; with stream=true the response becomes an SSE text stream (pushed frame by frame, see above) and does not use this structure.
| Field | Type | Description |
|---|---|---|
| reply | string | Model reply text (Markdown) |
| model | string | Public model identifier |
| usage | object | Token usage; null when not returned by upstream |
| usage.prompt_tokens | int | Prompt tokens |
| usage.completion_tokens | int | Completion tokens |
| usage.total_tokens | int | Total tokens |
| finish_reason | string | Finish reason; may be null |
{
"reply": "示例回复内容",
"model": "deepseek-chat",
"usage": {"prompt_tokens": 10, "completion_tokens": 20, "total_tokens": 30},
"finish_reason": "stop"
}