Responses API compatibility

OpenAI Responses API proxy for reliable agent workflows

Build agent and tool workflows on an OpenAI-compatible Responses API endpoint while preserving event order, terminal completion and request-level diagnostics.

Why use the Responses API for agents

Responses API provides a unified event model for input, generated content, tools and completion. It is a better fit for modern agent clients than treating every interaction as a simple chat message. CLODEX exposes an OpenAI-compatible route at https://clodex.xyz/v1/responses for models and channels that support it.

Compatibility must include failure behavior, not only successful JSON. Clients should distinguish validation errors, rate limits, upstream failures, timeouts, cancellations and a stream that closes before its documented terminal event.

Create a response with the OpenAI SDK

Begin with a non-streaming request and confirm the returned model, status and usage. Then add streaming and verify that the client waits for response.completed rather than treating socket closure as success.

from openai import OpenAI

client = OpenAI(
    api_key="clodex_YOUR_KEY",
    base_url="https://clodex.xyz/v1",
)

response = client.responses.create(
    model="gpt-5.6-sol",
    input="Find the race condition in this worker design",
)
print(response.output_text)

Detect truncated Responses API streams

A valid stream contains ordered SSE events and a terminal completion event. If the transport ends after response.created or output deltas but before completion, the response is truncated. Do not charge application-level success, execute irreversible tools or discard the request ID.

Retry policy depends on progress. A request that failed before any upstream event is different from one that generated output or invoked a tool. Preserve the last event type and failure phase so operators can choose a safe recovery path.

  • Require the terminal event defined by the protocol.
  • Store request ID and the last valid upstream event.
  • Use bounded backoff for transient connect and 5xx failures.
  • Do not automatically replay non-idempotent tool actions.

Responses API proxy observability

Measure time to response.created, time to first output token, total latency and terminal status. These stages separate queue delay from upstream generation and client transport problems. A single total-latency number cannot explain where a slow request spent its time.

Keep raw secrets and sensitive prompts out of operational logs. Safe metadata, error codes and sanitized event names are usually enough to correlate the client, gateway and upstream layers during an incident.

Add a replay-free contract test that simulates cancellation and truncated SSE input. The test should prove that partial output is not marked complete and that non-idempotent tools are not executed after an ambiguous disconnect.

Frequently asked questions

What is the CLODEX Responses API URL?

Use POST https://clodex.xyz/v1/responses with a CLODEX API key.

How do I know a streamed response completed?

Wait for the documented terminal event such as response.completed; EOF alone is not success.

Can I retry every truncated stream?

No. Check whether output or tool actions already occurred and retry only when the operation is safe.

Connect CLODEX API to your application

One key-management layer, compatible endpoints and several LLM families for apps, agents and developer tools.