基础调用
入口为POST /v1/chat/completions。模型需要支持 chat-completions;使用 Bearer 鉴权、messages 数组与合理的 max_completion_tokens 上限。
流式输出
设置stream: true。Python 使用 for chunk in stream,读取非空 chunk.choices[0].delta.content;JavaScript 使用 for await 读取 choices[0]?.delta?.content。HTTP 原生 SSE 在结束时包含 [DONE],不要使用 Responses 的 response.output_text.delta 解析器。