Install
Requires Node.js 22.18+ or Node.js 24 LTS to run.mts directly.
Chat Completions
Save aschat.mts.
Responses
Save asresponses.mts. Select a Responses-compatible model first.
Run and handle results
completed status. output_text is an SDK convenience property that joins text; handle tools and other non-text output separately.
Streaming · Error handling
Reference: Official OpenAI TypeScript SDK documentation。
The text-only Responses example rejects empty text, refusals, tool calls, and incomplete output. Continue with the full Responses examples in conversations, tool calling, and structured output.
简体中文