Skip to main content
Your agent is halfway through an answer when the user adds: “Actually, make this a checklist.” Send that update without waiting for the answer to finish. Particle preserves the output already delivered and starts a linked response with the new direction. Connect to wss://api.particle.ai/v1/responses using your existing Particle API key and a supported model. No extra access flag is needed. See Models for current model IDs. Building with a coding agent? Give it the integration brief and protocol reference, or start with a runnable example below.
This is a WebSocket API, not POST /v1/responses or Chat Completions with stream: true. Use a server-side WebSocket client. Keep your API key out of browser code; connect browsers through your own authenticated backend.

The integration in three steps

  1. Connect with Authorization: Bearer $PARTICLE_API_KEY and send response.create.
  2. Save response.id from response.created. When the user sends an update, send response.steer on that same socket, targeting the saved ID.
  3. Keep reading. response.steer.accepted acknowledges the update; a new response.created with previous_response_id pointing to the original identifies the automatic continuation. We call that new response the successor.
Only type, previous_response_id, and input belong in a steer. Do not add model, stream_id, or generation settings. input can be a nonempty string or an array of user messages.
Accepted does not mean applied. Do not send a second response.create for an accepted steer: Particle normally creates the successor for you. The exception is a response waiting for client-owned tool results, described below.

Try a complete example

Choose either example. Both use one conversation lane, send one update after the first response.created, print streamed text, and wait for the successor to finish. Set PARTICLE_MODEL to your chosen model ID to override the example’s default. The automatic trigger keeps this example simple. In your application, send the steer when a user submits new input while the response is active; you can also trigger it after a response.output_text.delta to see the direction change on screen.

Python

Use Python 3.11 or later:

JavaScript (Node.js)

These examples deliberately stop on errors instead of automatically retrying a possibly accepted update. They are a starting point for a single-lane agent, not a tool executor or a reconnect/replay implementation.

What to do with each event

Output already shown is not rewritten. Keep separate response records in your UI, with the user’s steering message between the original and successor. Only one steer can be pending per response; collect further edits locally until the successor is created.

Continue through client-owned tools

A steer does not cancel a tool, undo its effects, or turn partial function arguments into an executable call. Wait for complete call arguments and apply your usual validation and approval policy. If steering arrives after a function call has started streaming, Particle lets that response reach its tool boundary. It then sends an event like this:
Your application executes approved tools. Return exactly one string output for every required call_id on the same connection. Use the original’s stream_id if you assigned one. For structured results, JSON-encode the result into the output string.
Particle inserts the queued steering message before these continuation items, exactly once. Do not put that same message into input again. Unlike an automatic successor, this explicit create uses its own instructions, tools, reasoning settings, cache key, and token budget. Repeat whichever settings you want to keep. You can return the results after the original’s tool-call completion without waiting for response.steer.pending. Hosted tools and approval-protocol events are not supported on this endpoint. Your application owns tool execution and approvals.

Failures, cancellation, and recovery

For response.steer.failed, inspect error.code. Failures after acceptance carry the same steer.id; a rejection before acceptance may not have an ID. To cancel, close the WebSocket. This cancels every active generation and hidden drain on that connection, including other lanes. There is no response.cancel event. Use separate connections if tasks need independent cancellation. Connection history is temporary. Before reconnecting, retain your input, completed output items, tool results, and steering submission state in your own application, consistent with your data policy. On a new socket:
  1. Do not reference an old previous_response_id; omit it or set it to null.
  2. Send the history you want the model to see as response.create.input. Emitted message, textual reasoning, and completed function-call items can be replayed. Preserve required tool-call/result pairs; do not invent a completed call from partial argument deltas.
  3. Include a steering message only after deciding whether it was already incorporated into the history you are replaying. An accepted-but-pending update is not durably stored.
  4. Deduplicate external tool actions in your application. Retrying inference does not make a payment, file write, or other tool side effect idempotent.

Cost and cache behavior

Particle implements steering by replaying the accepted conversation into a new inference request, not by modifying a running model’s decode state. The successor inherits the original request settings and has its own token budget and usage.
Steering is not a way to stop billing for the original. Its upstream generation can finish privately while the successor runs. All of that hidden output remains billable. The original’s early steered terminal has usage: null, not zero usage; use your platform usage records for the settled total. Closing the socket cancels remaining work but does not refund work already performed.
Keep stable instructions and tool definitions at the front of the conversation, and use one prompt_cache_key per conversation. Automatic successors preserve it; explicit creates must repeat it. Routing remains cache-aware, not pinned to a worker. A successor can start before the original’s latest cache state is reusable, so a hit is not guaranteed. Read usage.input_tokens_details.cached_tokens on a terminal response with usage. See Prompt caching.

Agent integration brief

Copy this into your coding agent’s implementation task:
For field shapes, limits, and compatibility boundaries, see Responses WebSocket API. The event lifecycle follows the OpenAI mid-turn steering guide; Particle’s supported surface and billing behavior are specified here.