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

# OpenAI compatibility

> Use OpenAI SDKs with Chat Completions or stateless Responses.

Configure the [OpenAI Python SDK](https://github.com/openai/openai-python) or [JavaScript SDK](https://github.com/openai/openai-node) with your derestricted API key and a custom base URL.

<CodeGroup>
  ```python Python theme={"system"}
  import os
  from openai import OpenAI

  client = OpenAI(
      api_key=os.environ["DERESTRICTED_API_KEY"],
      base_url="https://api.derestricted.ai/v1",
  )
  ```

  ```javascript JavaScript theme={"system"}
  import OpenAI from "openai";

  const client = new OpenAI({
    apiKey: process.env.DERESTRICTED_API_KEY,
    baseURL: "https://api.derestricted.ai/v1",
  });
  ```
</CodeGroup>

Use `model: "derestricted-llm"`. The service hosts one deployment; changing the model string does not select an OpenAI model.

## Supported request formats

| Feature                             | Behavior                                                                      |
| ----------------------------------- | ----------------------------------------------------------------------------- |
| `client.chat.completions.create()`  | Text conversations, streaming, usage, and client tool-call messages.          |
| `client.responses.create()`         | Text input/instructions, streaming, and client-managed multi-turn input.      |
| `stream: false`                     | Returns a complete JSON response.                                             |
| `stream: true`                      | Returns SSE chunks/events in the chosen format.                               |
| Chat `stream_options.include_usage` | Adds the final usage chunk.                                                   |
| Chat `max_completion_tokens`        | Accepted as an alias for `max_tokens`; takes precedence if both are supplied. |
| `n`                                 | Only `1` is supported.                                                        |

## Responses is stateless

Send the required conversation history on every request. `previous_response_id` is ignored; the API does not resume a stored conversation. `store`, `background`, `include`, and prompt-cache control fields are ignored. Response retrieval, deletion, cancellation endpoints, and background jobs are not provided.

For tools, pass the relevant function definitions, prior calls, and your application's function results in the request history. The service does not execute tools on your behalf or provide OpenAI-hosted search, code execution, or file tools.

## Fields with different behavior

* Chat reasoning controls such as `reasoning_effort`, `reasoning`, and `thinking` are ignored. Responses `reasoning` and `text.verbosity` are also ignored. They do not override the deployed model's reasoning configuration.
* Routing and attribution overrides such as `api_base`, `base_url`, `api_key`, `extra_headers`, `user`, and `metadata` are removed. The authenticated API key determines account ownership and billing.
* Media-generation controls such as `audio` and `modalities` are removed. These endpoints document text input/output; multimodal workflows are not supported.
* JSON Schema structured output requests are rejected. Do not rely on strict schema enforcement for tool arguments or generated text; validate them in your application.

See [Chat Completions](/api/chat-completions), [Responses](/api/responses), and [request limits](/api/introduction#current-request-limits) for examples and bounds.
