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

# API reference

> Open Inference exposes an OpenAI-compatible API for inference.

## Base URL

```
https://api.openinference.xyz/v1
```

## Authentication

Every request must include your API key in the `Authorization` header.

```
Authorization: Bearer $OPENINFERENCE_API_KEY
```

You can create and manage API keys from the [Open Inference console](https://openinference.xyz/console).

## Endpoints

<CardGroup cols={2}>
  <Card title="Chat completions" icon="message" href="/api-reference/endpoint/chat-completions">
    Generate a chat response from a model given a list of messages.
  </Card>

  <Card title="Completions" icon="text" href="/api-reference/endpoint/completions">
    Generate a text completion given a prompt.
  </Card>
</CardGroup>

## OpenAI compatibility

The Open Inference API is compatible with the OpenAI SDK. Point `base_url` to `https://api.openinference.xyz/v1` and use your Open Inference API key.

<CodeGroup>
  ```python Python theme={null}
  from openai import OpenAI

  client = OpenAI(
      base_url="https://api.openinference.xyz/v1",
      api_key="your-api-key",
  )
  ```

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

  const client = new OpenAI({
    baseURL: "https://api.openinference.xyz/v1",
    apiKey: process.env.OPENINFERENCE_API_KEY,
  });
  ```

  ```bash curl theme={null}
  curl https://api.openinference.xyz/v1/chat/completions \
    -H "Authorization: Bearer $OPENINFERENCE_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"model": "openai/gpt-oss-120b", "messages": [{"role": "user", "content": "Hello"}]}'
  ```
</CodeGroup>

## Rate limits

Rate limits depend on your plan. Contact [sales](https://openinference.xyz/contact) for details on dedicated capacity.

## Errors

The API returns standard HTTP status codes.

| Code  | Description                |
| ----- | -------------------------- |
| `401` | Invalid or missing API key |
| `429` | Rate limit exceeded        |
| `500` | Internal server error      |
