For most new integrations, start with Chat Completions on POST /v1/chat/completions.
curl https://api.lemondata.cc/v1/chat/completions \ -H "Authorization: Bearer sk-your-api-key" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-5.4", "messages": [ {"role": "user", "content": "What is the capital of France?"} ] }'
Use POST /v1/responses only when you explicitly need Responses-specific behavior. Some Responses-only fields depend on the selected model and routed path.
stream = client.chat.completions.create( model="gpt-5.4", messages=[{"role": "user", "content": "Tell me a short story."}], stream=True)for chunk in stream: delta = chunk.choices[0].delta.content if delta: print(delta, end="")