Responses

Use POST /v1/responses for normal Agent execution. The official OpenAI SDK can call it by changing baseURL and using a Rebyte Agent ID as model.

Create a Response

import OpenAI from "openai";

const rebyte = new OpenAI({
  apiKey: process.env.REBYTE_API_KEY,
  baseURL: "https://api.rebyte.ai/v1",
});

const response = await rebyte.responses.create({
  model: process.env.REBYTE_AGENT_ID,
  input: "Research this company and summarize the evidence.",
});

console.log(response.output_text);
console.log(response.conversation.id);

The first Response creates a Conversation automatically.

Continue a Conversation

const followup = await rebyte.responses.create({
  model: process.env.REBYTE_AGENT_ID,
  conversation: response.conversation.id,
  input: "Compare it with its closest competitor.",
});

The Conversation ID remains stable. Each turn receives a new Response ID.

previous_response_id is accepted for OpenAI wire compatibility and resolves to the same Conversation. It is mutually exclusive with conversation. Rebyte clients use the Conversation ID directly.

Supported input

input may be a non-empty string or up to 32 user messages:

{
  "model": "550e8400-e29b-41d4-a716-446655440000",
  "input": [
    {
      "role": "user",
      "content": [
        {"type": "input_text", "text": "Summarize this company."}
      ]
    }
  ]
}
FieldSupported value
modelRebyte Agent UUID.
inputNon-empty string or user text-message array.
streamBoolean.
conversationconv_... string or { "id": "conv_..." }.
previous_response_idresp_...; cannot be combined with conversation.
storetrue only. Responses are durable.
backgroundfalse only.

Instructions, tools, MCP servers, and Skills come from the Agent. Request-level tools, images, files, structured output, reasoning configuration, and background execution are outside this contract and are rejected.

Streaming events

Set stream: true and iterate the SDK result:

const stream = await rebyte.responses.create({
  model: process.env.REBYTE_AGENT_ID,
  input: "Write a concise market brief.",
  stream: true,
});

for await (const event of stream) {
  if (event.type === "response.output_text.delta") {
    process.stdout.write(event.delta);
  }
}

A completed text output follows this order:

response.created
response.in_progress
response.output_item.added
response.content_part.added
response.output_text.delta             zero or more
response.output_text.done
response.content_part.done
response.output_item.done
response.completed

MCP calls use:

response.output_item.added
response.mcp_call_arguments.delta      when arguments are non-empty
response.mcp_call_arguments.done
response.mcp_call.in_progress
response.mcp_call.completed            or response.mcp_call.failed
response.output_item.done

Rebyte adds optional execution detail:

response.rebyte_tool_call.started
response.rebyte_tool_call.progress
response.rebyte_tool_call.action_required
response.rebyte_tool_call.failed

Every JSON event has a strictly increasing sequence_number. The SSE stream ends with data: [DONE]. A terminal execution failure emits response.failed before [DONE].

Retrieve durable output

const stored = await rebyte.responses.retrieve(response.id);
console.log(stored.status);
console.log(stored.output_text);

GET /v1/responses/{response_id} is authoritative after a disconnect or an uncertain client timeout.

When to use Conversations and Messages

Use the lower-level Conversation and Message API for asynchronous submission, standing SSE, interruption, or answers to Agent questions. The Responses endpoint waits for completion and can return 504 response_timeout after five minutes; the stored execution may still be reconciled through its durable resources.