Interface ChatCompletionParams

interface ChatCompletionParams {
    appSource?: string;
    autoExecuteTools?: boolean;
    frequency_penalty?: number;
    max_tokens?: number;
    maxToolRounds?: number;
    messages: ChatMessage[];
    min_p?: number;
    model: string;
    onToolCall?: (toolCall: ToolCall) => Promise<string>;
    onToolProgress?: (
        toolCall: ToolCall,
        progress: ToolExecutionProgress,
    ) => void;
    presence_penalty?: number;
    repetition_penalty?: number;
    response_format?: ChatResponseFormat;
    sogni_tool_execution?: boolean;
    sogni_tools?: SogniToolsMode;
    stop?: string | string[];
    stream?: boolean;
    taskProfile?: "general" | "coding" | "reasoning";
    temperature?: number;
    think?: boolean;
    tokenType?: "sogni" | "spark";
    tool_choice?: ToolChoice;
    tools?: ToolDefinition[];
    top_k?: number;
    top_p?: number;
}

Properties

appSource?: string

Optional source label for this request. Defaults to the client appSource when configured.

autoExecuteTools?: boolean

Automatically execute Sogni tool calls (image/video/music generation) when the model requests them. The SDK handles the full multi-round tool calling loop: send completion → execute tools → feed results back → repeat until done.

Only supported with stream: false. For streaming, use chat.tools.executeAll() manually in your own loop.

frequency_penalty?: number
max_tokens?: number
maxToolRounds?: number

Maximum number of tool calling rounds when autoExecuteTools is enabled. Prevents infinite loops. Default: 5.

messages: ChatMessage[]
min_p?: number
model: string
onToolCall?: (toolCall: ToolCall) => Promise<string>

Handler for non-Sogni tool calls when autoExecuteTools is enabled. Called for any tool call whose name does NOT start with sogni_. Must return a string (the tool result content).

onToolProgress?: (toolCall: ToolCall, progress: ToolExecutionProgress) => void

Progress callback for Sogni tool execution when autoExecuteTools is enabled. Fires as each tool call progresses through creation, queuing, processing, and completion.

presence_penalty?: number
repetition_penalty?: number
response_format?: ChatResponseFormat

Constrain output structure (OpenAI-compatible). Most useful on tool-call rounds where the model must emit a specific argument shape — eliminates JSON drift on quantized models. Forwarded to the worker unchanged.

sogni_tool_execution?: boolean

When sogni_tools is enabled, ask the Sogni API to execute requested Sogni tools server-side before returning the chat response. Independent of the SDK's client-side autoExecuteTools loop.

sogni_tools?: SogniToolsMode

Ask the Sogni API to inject server-side media-generation tool families. true or 'creative-tools' injects the hosted creative media/planning tool family. 'rich' is accepted as a legacy alias for 'creative-tools'. 'creative-agent' adds hosted workflow-control and asset-manifest tools.

stop?: string | string[]
stream?: boolean
taskProfile?: "general" | "coding" | "reasoning"

Hint for server-side preset selection.

temperature?: number
think?: boolean

Control thinking/reasoning mode for supported models (e.g. Qwen3/3.5). When false, sends chat_template_kwargs: { enable_thinking: false } so the model skips its internal reasoning step. When true, explicitly enables thinking. When omitted, server defaults apply.

tokenType?: "sogni" | "spark"

Token type to use for billing. Defaults to 'sogni'.

tool_choice?: ToolChoice

Controls which (if any) tool is called by the model.

tools?: ToolDefinition[]

Tool definitions for function calling.

top_k?: number
top_p?: number