Skip to main content

Create chat completion

Image input

Maitai parameters

string
required
The Application reference name (shown in the Portal). Maitai uses this to group your traffic.
string
required
The Intent / action type for this request (also called action_type). This is used for organization, configuration, and quality tooling.
string
Optional but recommended. Groups related requests into a session in the Portal. If omitted, the SDK will generate one.
map<string, any>
Optional metadata tags stored with the request for filtering/debugging.
object
Provider-agnostic reasoning controls: effort ("low" | "medium" | "high", optional) and summary (boolean, default false) to include thinking text on the response. See Reasoning.
string
Deprecated. Use the reasoning object with an effort field (for example reasoning={"effort": "high"} in Python or reasoning: { effort: "high" } in Node) instead. See Reasoning. This field still works for backward compatibility.

Evaluations and corrections (optional)

boolean
Enable/disable Sentinel evaluations for this request (Portal config also controls this).
boolean
When enabled, Maitai may apply an automatic correction if evaluations find a fault.
Corrections require server-side inference.
boolean
Prioritize accuracy over latency when applying corrections.
function(EvaluateResponse)
Optional callback invoked with the evaluation results. See Evaluate.

Inference routing

boolean
Controls where inference runs.

Fallbacks (optional)

object
Optional fallback configuration used when the primary model fails or times out.

OpenAI parameters

Maitai accepts the standard OpenAI chat.completions.create parameters (for example: model, temperature, tools, tool_choice, response_format, stream, etc.). If you set them in the request, they override Portal defaults. Related guides:

Response fields

Maitai returns an OpenAI-compatible chat.completion response, plus a few extra fields:
string
The Maitai request identifier.
object or null
Evaluation results (when evaluations are enabled).
boolean
Whether a correction was applied.
number or null
Optional input safety score (when enabled). A number between 0 and 1 where lower values indicate a potential jailbreak attempt.
number
Time to first token (milliseconds), when available.
number
Total response time (milliseconds), when available.
string or null
Present when a fallback model was used (explains why).

Streaming usage