Skip to main content
POST
Responses
POST /v1/responses is OpenAI’s next-generation unified interface. It can mix text, images, and other input types in a single request and return results in a structured format.

Request example

Streaming and compatibility

  • Streaming output: set stream: true to receive server-sent events (SSE) increments. When you need to stay compatible with the Chat Completions streaming format, you can convert on the SSE client side (GregAPI has built-in backward-compatibility handling).
  • Tool events: tool calls appear in the stream as response.output_item.added; the stream closes with aggregated usage token statistics.

Tips and notes

  • The input field can be a string or a composite array; an array is recommended so you can mix text, images, file references, and more.
  • Conversation history can be continued by adding multiple role/content segments to input.
  • response_format supports json_schema, text, and other options. Combined with GregAPI’s flow-control strategy, it enables structured automation.
  • For tool calls, declare optional functions in tools; results appear in the tool_calls field of output.
  • Billing note: when tools such as Web Search Preview, Code Interpreter, or File Search are enabled, GregAPI attaches extra billing metadata in usage for reconciliation.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
model
string
required

Model name

input
array

Input messages, a string or composite array

response_format
object

Output format

stream
boolean

Whether to stream output

tools
array

Optional tool declarations

Response

200

Successful structured response