Interface ChatRequest

A host-brokered chat completion request: the messages plus optional tools, response format, and model hint (each honored per the provider's features).

interface ChatRequest {
    maxTokens?: number;
    messages: ChatMessage[];
    modelHint?: "fast" | "smart";
    responseFormat?: "text" | "json";
    signal?: AbortSignal;
    tools?: ToolDef[];
}

Properties

maxTokens?: number
messages: ChatMessage[]
modelHint?: "fast" | "smart"

An ABSTRACT tier hint, never a vendor model id — the host maps it to a concrete model on the resolved provider. Omit to take the provider's default.

responseFormat?: "text" | "json"

'json' honored only when features.jsonMode. Defaults to 'text'.

signal?: AbortSignal

Abort the completion mid-stream. When it fires, the SDK sends the host a cancel frame so the host aborts the upstream provider request and STOPS BILLING the user's key — not merely stops the app-side iterator (LLM_AND_AGENTS_SPEC §3.3 "abort the in-flight LLM request", R3-224). Not sent over the wire (an AbortSignal isn't serializable); handled SDK-side.

tools?: ToolDef[]

Honored only when the resolved provider advertises features.tools.