> ## Documentation Index
> Fetch the complete documentation index at: https://docs.prisminference.com/llms.txt
> Use this file to discover all available pages before exploring further.

# OpenAI Responses

> Use Prism through the OpenAI Responses API wire format.

Prism exposes a stateless OpenAI Responses-compatible endpoint. Use it with
OpenAI SDK clients that call `client.responses.create()`.

## Create a response

```http theme={"theme":{"light":"github-light","dark":"github-dark"}}
POST https://api.prisminference.com/v1/responses
```

<CodeGroup>
  ```typescript TypeScript theme={"theme":{"light":"github-light","dark":"github-dark"}}
  import OpenAI from "openai";

  const client = new OpenAI({
    apiKey: process.env.PRISM_API_KEY,
    baseURL: "https://api.prisminference.com/v1",
  });

  const response = await client.responses.create({
    model: "prism/deepseek-v4-flash",
    instructions: "You are a senior TypeScript engineer.",
    input: "Write a bounded concurrency helper.",
    store: false,
  });

  console.log(response.output_text);
  ```

  ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
  import os
  from openai import OpenAI

  client = OpenAI(
      api_key=os.environ["PRISM_API_KEY"],
      base_url="https://api.prisminference.com/v1",
  )

  response = client.responses.create(
      model="prism/deepseek-v4-flash",
      instructions="You are a senior Python engineer.",
      input="Write a bounded concurrency helper.",
      store=False,
  )

  print(response.output_text)
  ```

  ```bash cURL theme={"theme":{"light":"github-light","dark":"github-dark"}}
  curl --fail-with-body "https://api.prisminference.com/v1/responses" \
    -H "Authorization: Bearer $PRISM_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "prism/deepseek-v4-flash",
      "instructions": "You are a senior TypeScript engineer.",
      "input": "Write a bounded concurrency helper.",
      "store": false
    }'
  ```
</CodeGroup>

Assistant text is available in `output_text` and in the `output` message item.
Function calls are returned as `function_call` output items.

## Body parameters

| Field                 | Type              | Required | Description                                                     |
| --------------------- | ----------------- | -------- | --------------------------------------------------------------- |
| `model`               | string            | Yes      | A supported [Prism model ID](/models).                          |
| `input`               | string or item\[] | Yes      | Text, messages, prior function calls, and function outputs.     |
| `instructions`        | string            | No       | System or developer instructions.                               |
| `stream`              | boolean           | No       | Return Responses API Server-Sent Events.                        |
| `max_output_tokens`   | integer           | No       | Maximum generated tokens, including reasoning tokens.           |
| `tools`               | function tool\[]  | No       | Functions available to the model.                               |
| `tool_choice`         | string or object  | No       | Control whether and which function is called.                   |
| `parallel_tool_calls` | boolean           | No       | Allow independent function calls in one turn.                   |
| `text.format`         | object            | No       | Request text, JSON object, or JSON Schema output.               |
| `reasoning.effort`    | string            | No       | `low`, `medium`, or `high`.                                     |
| `temperature`         | number            | No       | Sampling temperature from 0 to 2.                               |
| `top_p`               | number            | No       | Nucleus sampling probability from 0 to 1.                       |
| `store`               | boolean           | No       | `true` is unsupported; Prism does not persist response content. |

## Continue a tool loop

Return prior output items explicitly in the next request:

```typescript theme={"theme":{"light":"github-light","dark":"github-dark"}}
const call = response.output.find((item) => item.type === "function_call");

if (call?.type === "function_call") {
  const result = await runFunction(call.name, JSON.parse(call.arguments));

  const final = await client.responses.create({
    model: "prism/deepseek-v4-flash",
    input: [
      { role: "user", content: "What is the weather in San Francisco?" },
      call,
      {
        type: "function_call_output",
        call_id: call.call_id,
        output: JSON.stringify(result),
      },
    ],
    tools,
    store: false,
  });

  console.log(final.output_text);
}
```

## Stream a response

```typescript theme={"theme":{"light":"github-light","dark":"github-dark"}}
const stream = await client.responses.create({
  model: "prism/deepseek-v4-flash",
  input: "Explain optimistic locking.",
  stream: true,
  store: false,
});

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

Streams use typed Responses events, including `response.created`,
`response.output_item.added`, `response.output_text.delta`,
`response.output_item.done`, and `response.completed`.

## Stateless compatibility

Prism applies zero data retention and does not implement stored Responses
resources. Keep the conversation in your application and resend the required
input items on each request.

The following OpenAI features are not supported:

* `previous_response_id`
* `store: true`
* `background: true`
* hosted OpenAI tools such as web search, file search, and computer use
* response retrieval, cancellation, deletion, and input-item subresources

Unsupported fields return an OpenAI-compatible `400` error rather than being
silently ignored.
