Interface ChatCompletionParams

interface ChatCompletionParams {
    autoExecuteTools?: boolean;
    frequency_penalty?: number;
    max_tokens?: number;
    maxToolRounds?: number;
    messages: ChatMessage[];
    model: string;
    onToolCall?: (toolCall: ToolCall) => Promise<string>;
    onToolProgress?: (
        toolCall: ToolCall,
        progress: ToolExecutionProgress,
    ) => void;
    presence_penalty?: number;
    stop?: string | string[];
    stream?: boolean;
    temperature?: number;
    think?: boolean;
    tokenType?: "sogni" | "spark";
    tool_choice?: ToolChoice;
    tools?: ToolDefinition[];
    top_p?: number;
}

Properties

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[]
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
stop?: string | string[]
stream?: boolean
temperature?: number
think?: boolean

Control thinking/reasoning mode. When false, appends /no_think to the system message so the model skips its internal reasoning step. When true or omitted, thinking is enabled (default behavior for supported models like Qwen3).

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_p?: number