# OpenAI Responses API

> Call models through POST /v1/responses on GoiAPI (Codex CLI, OpenAI SDK responses.create); supported features, streaming events and limitations.

Source: https://goiapi.com/en/docs/openai-responses

An endpoint compatible with the OpenAI Responses API, for recent versions of [Codex CLI](https://goiapi.com/en/docs/integrations/codex) and `client.responses.create()` in the OpenAI SDK. Set the **base URL** to `https://api.goiapi.com/v1` and use your API key. Every model on [Models](https://goiapi.com/en/models) can be called through this endpoint, including models not made by OpenAI.

```http
POST https://api.goiapi.com/v1/responses
```

## Body

`model` and `input` are required. `input` is a string, or a list of messages and items like the ones Codex sends.

```bash
curl https://api.goiapi.com/v1/responses \
  -H "Authorization: Bearer <API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-haiku-5-5",
    "instructions": "Answer briefly",
    "input": "Write a Python function that reverses a string",
    "max_output_tokens": 1024
  }'
```

Set `max_output_tokens`: funds are reserved based on this value before the model is called. See [Limits and balance](https://goiapi.com/en/docs/limits-and-balance).

## Supported

- `instructions`, and `input` as a string or a list: `user`, `assistant`, `system` and `developer` messages with `input_text`, `output_text`, `input_image` (URL or base64) and `input_file` (base64) content.
- Tool calling: `tools` of type `function` and `custom` (such as Codex's `apply_patch`), `tool_choice`, `parallel_tool_calls`; `function_call`, `function_call_output`, `custom_tool_call` and `custom_tool_call_output` items in `input`.
- `reasoning.effort`; the reasoning the model returns is in the `reasoning` item (`summary` field).
- `max_output_tokens`, `temperature`, `top_p`, `text.format` (`json_object`, `json_schema`), `prompt_cache_key`.
- Streaming (`"stream": true`): the events `response.created`, `response.output_item.added`, `response.output_text.delta`, `response.function_call_arguments.delta`, `response.reasoning_summary_text.delta`, `response.output_item.done`, then `response.completed` (or `response.incomplete` when `max_output_tokens` is reached).
- `usage` in the Responses format (`input_tokens`, `output_tokens`, `input_tokens_details.cached_tokens`, and so on).

## Not supported

Responses are not stored, so every call must include the full conversation in `input` (Codex CLI already does this).

- `previous_response_id`, `conversation`, `prompt`, `background: true` and `item_reference` items: return a `400` error.
- OpenAI built-in tools (`web_search`, `file_search`, `local_shell`, `code_interpreter`, `computer_use`, `mcp`, `image_generation`): ignored; the model does not see them.
- `reasoning` items sent back in `input`, and `encrypted_content`: ignored.
- Images or files referenced by `file_id`: return a `400` error. Send a URL or base64 data instead.
- `GET /v1/responses/{id}`, and cancelling or deleting responses.

## Errors

Errors that occur before the response starts use the standard OpenAI error format (see [Error codes](https://goiapi.com/en/docs/error-codes)). Once the stream has started, errors arrive as a `response.failed` event:

```text
event: response.failed
data: {"type":"response.failed","response":{"status":"failed","error":{"code":"service_unavailable","message":"…"},…}}
```

## Billing

You pay for the tokens the model actually uses, the same as with [`/v1/chat/completions`](https://goiapi.com/en/docs/openai-chat-completions). If you disconnect midway, you are charged for the tokens used up to that point (input plus the output generated so far), subject to the minimum charge per request. A failed request that returns no content is not charged, except a request you cancel yourself. Details are in the [Refund Policy](https://goiapi.com/en/refund-policy).
