conductor-oss/conductor · error · RuntimeException
OpenAI Responses API call failed:
Error message
OpenAI Responses API call failed:
What it means
OpenAIResponsesChatModel.call() wraps an IOException from OpenAIResponsesApi.createResponse() in a RuntimeException with message "OpenAI Responses API call failed: ". This is the primary chat model for the OpenAI provider (using the newer /v1/responses endpoint, not /chat/completions). The IOException originates from error 219 (non-2xx HTTP) or a network failure.
Source
Thrown at ai/src/main/java/org/conductoross/conductor/ai/providers/openai/OpenAIResponsesChatModel.java:70
* converts the response back to Spring AI's {@link ChatResponse}.
*/
@Slf4j
public class OpenAIResponsesChatModel implements ChatModel {
private final OpenAIResponsesApi responsesApi;
public OpenAIResponsesChatModel(OpenAIResponsesApi responsesApi) {
this.responsesApi = responsesApi;
}
@Override
public ChatResponse call(Prompt prompt) {
try {
ResponseRequest request = buildRequest(prompt);
ResponseResult result = responsesApi.createResponse(request);
return toSpringChatResponse(result);
} catch (IOException e) {
throw new RuntimeException("OpenAI Responses API call failed: " + e.getMessage(), e);
}
}
private ResponseRequest buildRequest(Prompt prompt) throws JsonProcessingException {
List<Message> messages = prompt.getInstructions();
ChatOptions options = prompt.getOptions();
// Extract system messages → instructions field
String instructions = null;
List<Message> nonSystemMessages = new ArrayList<>();
for (Message msg : messages) {
if (msg.getMessageType() == MessageType.SYSTEM) {
// Concatenate multiple system messages
String sysText = ((SystemMessage) msg).getText();
instructions = instructions == null ? sysText : instructions + "\n" + sysText;
} else {
nonSystemMessages.add(msg);
}View on GitHub (pinned to cf7c3e4a8a)
Solutions
- Inspect getCause() for the IOException — its message includes the HTTP status and response body (see error 219).
- Verify the model supports the Responses API (gpt-4o, gpt-4o-mini, o1, o3, o4-mini, gpt-5 series).
- Check that the API key is valid and has access to the requested model.
- For 400 errors mentioning temperature with o-series models, the code already auto-retries without temperature — if it still fails, check other unsupported parameters.
Example fix
// before: using a model only available via Chat Completions with Responses API
{"model": "gpt-3.5-turbo", "prompt": "..."}
// after
{"model": "gpt-4o", "prompt": "..."} Defensive patterns
Strategy: retry
Validate before calling
// Validate chat request and model before calling
if (input.getModel() == null || input.getModel().isBlank()) {
throw new IllegalArgumentException("Model name is required");
}
// Verify model supports the Responses API
Set<String> responsesApiModels = Set.of(
"gpt-4o", "gpt-4o-mini", "o1", "o1-mini", "o3", "o3-mini", "o4-mini",
"gpt-5", "gpt-5-mini", "gpt-5-nano");
String modelPrefix = input.getModel().split("-")[0];
if (!responsesApiModels.contains(input.getModel())
&& !input.getModel().startsWith("o1")
&& !input.getModel().startsWith("o3")
&& !input.getModel().startsWith("o4")
&& !input.getModel().startsWith("gpt-4o")
&& !input.getModel().startsWith("gpt-5")) {
log.warn("Model '{}' may not support the Responses API", input.getModel());
} Type guard
null
Try / catch
try {
ChatResponse response = chatModel.call(prompt);
} catch (RuntimeException e) {
Throwable cause = e.getCause();
if (cause instanceof IOException io) {
String msg = io.getMessage();
if (msg.contains("429") || msg.contains("500") || msg.contains("503") || msg.contains("529")) {
return retryWithBackoff(() -> chatModel.call(prompt));
}
log.error("Responses API error: {}", msg);
}
throw e;
} Prevention
- Verify the model supports the Responses API before routing to the OpenAI provider.
- Check the API key is valid and has access to the requested model.
- The code auto-retries without temperature for o-series 400s — but verify other params aren't causing issues.
- Implement retry with backoff for 429/5xx/529 (overloaded) responses.
When it happens
Trigger: The OpenAI provider's chat model call(Prompt) is invoked and POST /v1/responses fails: 401 invalid key, 429 rate limit, 400 invalid model or parameters, model not available for the Responses API, or network error.
Common situations: Expired API key; using a model that doesn't support the Responses API (some older models only work with Chat Completions); rate limit on high-throughput chat tasks; network timeout on long context windows; reasoning-model parameter mismatch (temperature rejected by o-series — note the code already retries without temperature).
Related errors
- Responses API failed with status %d: %s
- Embeddings API call failed:
- Speech API call failed:
- Chat Completions API call failed:
- Image generation API call failed:
AI-assisted analysis of conductor-oss/conductor@cf7c3e4a8a (2026-08-14).
Data as JSON: /api/errors/e8d2e55f76d756ca.
Report an issue: GitHub.