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

# Chat Completions API

> OpenAI-compatible chat completions endpoint

# Chat Completions API

Radium implements the standard OpenAI Chat Completions API at `POST /v1/chat/completions`. Existing code, prompts and middleware work without changes.

## Endpoint

```
POST https://api.radium.cloud/v1/chat/completions
```

## Request format

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://api.radium.cloud/v1/chat/completions \\
    -H "Authorization: Bearer $RADIUM_API_KEY" \\
    -H "Content-Type: application/json" \\
    -d '{
      "model": "clarke-1.0",
      "messages": [
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "Hello"}
      ]
    }'
  ```

  ```python Python theme={null}
  from openai import OpenAI
  client = OpenAI(api_key="YOUR_RADIUM_API_KEY", base_url="https://api.radium.cloud/v1")
  response = client.chat.completions.create(
      model="clarke-1.0",
      messages=[
          {"role": "system", "content": "You are a helpful assistant."},
          {"role": "user", "content": "Hello"},
      ],
  )
  print(response.choices[0].message.content)
  ```

  ```typescript TypeScript theme={null}
  import OpenAI from "openai";
  const client = new OpenAI({ apiKey: process.env.RADIUM_API_KEY, baseURL: "https://api.radium.cloud/v1" });
  const response = await client.chat.completions.create({
    model: "clarke-1.0",
    messages: [
      { role: "system", content: "You are a helpful assistant." },
      { role: "user", content: "Hello" },
    ],
  });
  console.log(response.choices[0].message.content);
  ```
</CodeGroup>

## Response format

```json theme={null}
{
  "id": "chatcmpl-abc123",
  "object": "chat.completion",
  "created": 1699999999,
  "model": "clarke-1.0",
  "choices": [{
    "index": 0,
    "message": {
      "role": "assistant",
      "content": "Hello! How can I help you today?"
    },
    "finish_reason": "stop"
  }],
  "usage": {
    "prompt_tokens": 19,
    "completion_tokens": 9,
    "total_tokens": 28
  }
}
```

## Limitations

Some advanced parameters may behave differently from OpenAI. See [From OpenAI](/switching/from-openai) for the full parameter compatibility table.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.