Create chat completion
Maitai parameters
The Application reference name (shown in the Portal). Maitai uses this to group your traffic.
The Intent / action type for this request (also called
action_type). This is used for organization, configuration, and quality tooling.Optional but recommended. Groups related requests into a session in the Portal. If omitted, the SDK will generate one.
Optional metadata tags stored with the request for filtering/debugging.
Evaluations and corrections (optional)
Enable/disable Sentinel evaluations for this request (Portal config also controls this).
When enabled, Maitai may apply an automatic correction if evaluations find a fault.
Prioritize accuracy over latency when applying corrections.
Optional callback invoked with the evaluation results. See Evaluate.
Inference routing
Controls where inference runs.
Fallbacks (optional)
Optional fallback configuration used when the primary model fails or times out.
OpenAI parameters
Maitai accepts the standard OpenAIchat.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-compatiblechat.completion response, plus a few extra fields:
The Maitai request identifier.
Evaluation results (when evaluations are enabled).
Whether a correction was applied.
Optional input safety score (when enabled). A number between 0 and 1 where lower values indicate a potential jailbreak attempt.
Time to first token (milliseconds), when available.
Total response time (milliseconds), when available.
Present when a fallback model was used (explains why).
Usage statistics for the completion request.
Streaming usage
An optional field that will only be present when you set stream_options: {'"include_usage": true} in your request. When present, it contains a null value except for the last chunk which contains the token usage statistics for the entire request.