Maniac Docs

Responses

The Responses API — streaming, stateful, and background runs.

Create a response

POST /v1/responses

The OpenAI Responses API. It differs from Chat Completions in three ways: it takes input (a string or typed input items) plus instructions instead of messages, returns an output[] array of typed items instead of choices, and reports usage as input_tokens / output_tokens.

const response = await client.responses.create({
  model: "openai/gpt-4o-mini",
  instructions: "You are a helpful assistant.",
  input: "Summarize the Maniac gateway in one line.",
});

console.log(response.output_text);

Streaming

With stream: true the gateway emits the OpenAI event taxonomy:

response.created  →  response.output_text.delta (×N)  →  response.completed

A mid-stream failure surfaces as a terminal error event. As with chat, a failure before the first event becomes a normal JSON error.

Stateful storage

Set store: true to persist the response, then chain a follow-up turn with previous_response_id — the prior transcript is automatically prepended:

const first = await client.responses.create({
  model: "openai/gpt-4o-mini",
  input: "My name is Ada.",
  store: true,
});

const second = await client.responses.create({
  model: "openai/gpt-4o-mini",
  input: "What's my name?",
  previous_response_id: first.id,
  store: true,
});

Stored responses are scoped to your organization and can be retrieved or removed:

GET    /v1/responses/{id}
DELETE /v1/responses/{id}

Background runs

Set background: true to enqueue the run and return immediately with status: "queued". Poll for completion, reconnect to the live stream, or cancel:

const job = await client.responses.create({
  model: "openai/gpt-4o-mini",
  input: "Write a long essay.",
  background: true,
  store: true,
});

// Poll
let result = await client.responses.retrieve(job.id);
// ...or tail the stream: GET /v1/responses/{id}?stream=true
// ...or cancel:          POST /v1/responses/{id}/cancel

Maniac extensions & limits

  • tags and trace are accepted for parity with chat completions.
  • Managed tools are not yet supported — a non-empty tools list is rejected.

Explore every operation in the API Reference.

On this page