Chat completions
POST
https://console.aimodelhub.ai/v1/chat/completions
Generates a model response for a conversation. The body is the OpenAI Chat Completions schema.
Every field below except brand and knowledge is relayed to the upstream gateway untouched. The request body is forwarded verbatim, so parameters beyond this list may work but are not guaranteed. brand and knowledge are the two fields AI HUB consumes.
| Field | Type | Notes |
|---|---|---|
model |
string | Required. A published model slug (see Models). |
messages |
array | Required. Role/content turns: system, user, assistant. |
stream |
boolean | Optional. Stream tokens as server-sent events. Defaults to false. |
temperature |
number | Optional. Relayed to the model untouched. |
max_tokens |
integer | Optional. Caps the response length. |
top_p |
number | Optional. Relayed to the model untouched. |
stop |
string | array | Optional. One stop string or an array of them. Relayed to the model untouched. |
response_format |
object | Optional. Relayed to the model untouched. Support varies by model. |
tools |
array | Optional. Function/tool definitions. Relayed to the model untouched. Support varies by model. |
tool_choice |
string | object | Optional. Relayed to the model untouched. |
seed |
integer | Optional. Relayed to the model untouched. Support varies by model. |
reasoning_effort |
string | Optional. low, medium, or high. Only has an effect on a thinking-capable model, as listed on that model's own page. |
brand |
string | Optional. A company profile id from the account. Unlike every other field here, this one is NOT relayed. AI HUB consumes it, prepends the profile's voice as a system message, and removes it before the request reaches the model. Brand-aware completions guide. |
knowledge |
string | array | Optional. A company profile id, or an array of up to 10 document ids, from the account. This field is NOT relayed. AI HUB retrieves the passages most relevant to the last user message, prepends them as a system message, and removes the field before the request reaches the model. Document ids are listed by GET /v1/knowledge. An unknown id returns 404 knowledge_not_found. |
Thinking
Some models expose a controllable thinking mode, sent as reasoning_effort: "low" | "medium" | "high". Unlike the chat composer, this endpoint never adds it automatically. If it is not sent, the model answers without extended thinking. Reasoning tokens are billed as ordinary completion tokens.
Whether a specific model supports it, with a ready-to-copy example, is shown on that model's own page. See all text models for the full list.
Example response
{
"id": "97d20b94639f43cfb66abbca787d13d3",
"object": "chat.completion",
"created": 1784286013,
"model": "deepseek-v4-flash",
"choices": [
{
"index": 0,
"message": { "role": "assistant", "content": "Hello!" },
"finish_reason": "stop"
}
],
"usage": { "prompt_tokens": 11, "completion_tokens": 20, "total_tokens": 31 }
}The usage block reports token counts only. Each call is metered at the model's list rate (see Models) and debited from the wallet. That price, not any provider cost, is the amount charged.
Some vendors pass through extra fields on message or usage (e.g. a reasoning_content field for models with a visible thinking phase). Only the fields above are part of the guaranteed contract, and anything else is informational.