AI Service

Multi-model AI chat API: switch between models from several vendors with the model parameter — single-turn, multi-turn, streaming and image understanding (on supported models).

/api/ai/

Service Description

The AI service offers chat capabilities out of the box, with models from several vendors (currently DeepSeek). The platform holds the vendor keys, so callers need no application or configuration of their own — handy for quickly validating content generation, summarisation or Q&A features.

Switching models takes only the model parameter: the endpoint, authentication and response shape stay identical. See the Model List endpoint below, or the model dropdown on the chat endpoint. New models are added by a super admin in the console; all vendor differences (upstream URL, key, capabilities) are absorbed server-side.

One endpoint covers both single-turn and multi-turn chats: send content for a quick single question, or messages (a JSON array with role and content) for multi-turn; streaming output is supported as well.

System prompts are configured per model by the platform (an admin maintains several and assigns one to each model). Callers need not — and cannot — change the generation strategy: temperature, max reply length and stop words are likewise platform-controlled and not accepted as request parameters, so every integrator gets the same, predictable behaviour.

Models marked as vision-capable also accept images (public image URLs) so they can answer about a picture; models without it return an invalid-value error instead of silently dropping the parameter.

This service requires project signature authentication. With streaming enabled (stream=true) the response is pushed as SSE chunks rather than a single JSON body, and the live debugger on this page prints it character by character.

Built-in Models

Platform-managed keys (DeepSeek / Moonshot / Volcengine Ark / Alibaba Bailian and more, extendable in the console) Signature Required

A single chat endpoint covers every model: switching models only changes the model parameter, while platform keys, upstream URLs, system prompts and sampling parameters are maintained by admins in the console.

POST /api/ai/BuiltInModel/chat Total calls: 5

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 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: 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.
  • 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.
GET /api/ai/BuiltInModel/models Total calls: 0

Model List

List the models currently available on the platform (key, display name, vision support, whether it is the default).

  • Lets callers discover available models dynamically instead of hardcoding model names in the client.
  • Returns model information only: no vendor, upstream URL or key.
  • Requests that omit model use the entry whose is_default is true.
XiaoYingAPI · Unified API Aggregation Service