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

# Gateway API reference: Anthropic and OpenAI endpoints

> Full reference for Raziel's Anthropic-compatible and OpenAI-compatible gateway endpoints, including auth, request parameters, models, and streaming.

The Raziel gateway exposes two protocol surfaces: a drop-in replacement for the Anthropic Messages API and an OpenAI-compatible chat completions endpoint. Both use your `rz_live_…` key for authentication and support streaming.

## Anthropic-compatible endpoint

Send requests to `https://raziel.fun/gateway/v1/messages` in the same format you would send them to `https://api.anthropic.com/v1/messages`. The gateway forwards the request body unchanged to a live provider and returns the response in the same Anthropic shape.

<Note>
  When using the `razi claude` command, requests go through a local proxy at `localhost:3099`. The `raziel.fun` domain never appears in Claude Code's network traffic.
</Note>

### Request

```http theme={null}
POST https://raziel.fun/gateway/v1/messages
Authorization: Bearer rz_live_xxxxxxxxxxxx
Content-Type: application/json
anthropic-version: 2023-06-01
```

```json theme={null}
{
  "model": "claude-sonnet-4-6",
  "max_tokens": 1024,
  "messages": [
    { "role": "user", "content": "Hello" }
  ]
}
```

### Parameters

<ParamField body="model" type="string" required>
  The model to use. See [available models](#available-models) below.
</ParamField>

<ParamField body="messages" type="array" required>
  Array of message objects with `role` (`user` or `assistant`) and `content`.
</ParamField>

<ParamField body="max_tokens" type="integer" required>
  Maximum number of tokens to generate in the response.
</ParamField>

<ParamField body="stream" type="boolean">
  Set to `true` to receive a server-sent events stream. The gateway passes streaming through transparently.
</ParamField>

<ParamField body="system" type="string">
  System prompt passed directly to the model.
</ParamField>

<ParamField body="temperature" type="number">
  Sampling temperature between 0 and 1.
</ParamField>

<ParamField body="tools" type="array">
  Tool definitions for function calling. Passed through to the provider unchanged.
</ParamField>

### Example: streaming request

<CodeGroup>
  ```bash curl theme={null}
  curl https://raziel.fun/gateway/v1/messages \
    -H "Authorization: Bearer rz_live_xxxxxxxxxxxx" \
    -H "Content-Type: application/json" \
    -H "anthropic-version: 2023-06-01" \
    -d '{
      "model": "claude-sonnet-4-6",
      "max_tokens": 512,
      "stream": true,
      "messages": [{"role": "user", "content": "Hello"}]
    }'
  ```

  ```python python theme={null}
  import anthropic

  client = anthropic.Anthropic(
      base_url="https://raziel.fun/gateway",
      api_key="rz_live_xxxxxxxxxxxx",
  )

  message = client.messages.create(
      model="claude-sonnet-4-6",
      max_tokens=512,
      messages=[{"role": "user", "content": "Hello"}],
  )
  print(message.content[0].text)
  ```
</CodeGroup>

***

## OpenAI-compatible endpoint

The gateway also speaks the OpenAI chat completions format at `https://raziel.fun/gateway/openai/v1`. Use it with any client that accepts a custom base URL — the OpenAI SDK, Hermes, Continue, LibreChat, and others.

### Endpoints

| Method | Path                                  | Description              |
| ------ | ------------------------------------- | ------------------------ |
| `POST` | `/gateway/openai/v1/chat/completions` | Create a chat completion |
| `GET`  | `/gateway/openai/v1/models`           | List available models    |

### Request

```http theme={null}
POST https://raziel.fun/gateway/openai/v1/chat/completions
Authorization: Bearer rz_live_xxxxxxxxxxxx
Content-Type: application/json
```

```json theme={null}
{
  "model": "claude-sonnet-4-6",
  "messages": [
    { "role": "user", "content": "Hello" }
  ],
  "max_tokens": 512
}
```

### Parameters

<ParamField body="model" type="string" required>
  The model identifier. See [available models](#available-models) below.
</ParamField>

<ParamField body="messages" type="array" required>
  Array of message objects with `role` and `content`.
</ParamField>

<ParamField body="max_tokens" type="integer">
  Maximum number of tokens to generate.
</ParamField>

<ParamField body="temperature" type="number">
  Sampling temperature between 0 and 2.
</ParamField>

<ParamField body="stream" type="boolean">
  Set to `true` to receive a server-sent events stream.
</ParamField>

<ParamField body="tools" type="array">
  OpenAI-format tool definitions for function calling.
</ParamField>

<ParamField body="tool_choice" type="string | object">
  Tool selection strategy: `"auto"`, `"none"`, `"required"`, or a specific tool object.
</ParamField>

<ParamField body="stop" type="string | array">
  Up to 4 sequences where the API will stop generating.
</ParamField>

<ParamField body="top_p" type="number">
  Nucleus sampling parameter.
</ParamField>

<Warning>
  The following fields are accepted but silently ignored: `logprobs`, `n`, `response_format`, `presence_penalty`, `frequency_penalty`, `seed`. Requests that include them will succeed, but these parameters have no effect.
</Warning>

### Example

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

  client = OpenAI(
      base_url="https://raziel.fun/gateway/openai/v1",
      api_key="rz_live_xxxxxxxxxxxx",
  )

  resp = client.chat.completions.create(
      model="claude-sonnet-4-6",
      messages=[{"role": "user", "content": "Hello"}],
  )
  print(resp.choices[0].message.content)
  ```

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

  const client = new OpenAI({
    baseURL: "https://raziel.fun/gateway/openai/v1",
    apiKey: "rz_live_xxxxxxxxxxxx",
  });

  const resp = await client.chat.completions.create({
    model: "claude-sonnet-4-6",
    messages: [{ role: "user", content: "Hello" }],
  });
  console.log(resp.choices[0].message.content);
  ```

  ```bash curl theme={null}
  curl https://raziel.fun/gateway/openai/v1/chat/completions \
    -H "Authorization: Bearer rz_live_xxxxxxxxxxxx" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "claude-sonnet-4-6",
      "messages": [{"role": "user", "content": "Hello"}]
    }'
  ```
</CodeGroup>

***

## Available models

| Model ID                    | Description                                        |
| --------------------------- | -------------------------------------------------- |
| `claude-opus-4-7`           | Claude Opus 4.7 — most capable                     |
| `claude-sonnet-4-6`         | Claude Sonnet 4.6 — balanced performance and speed |
| `claude-haiku-4-5-20251001` | Claude Haiku 4.5 — fastest responses               |

Use `GET /gateway/openai/v1/models` to retrieve the current model list programmatically.

***

## Authentication

Both endpoints use the same `Authorization: Bearer` scheme.

```http theme={null}
Authorization: Bearer rz_live_xxxxxxxxxxxx
```

Alternatively, for the Anthropic-compatible endpoint you can pass your key as `x-api-key`:

```http theme={null}
x-api-key: rz_live_xxxxxxxxxxxx
```

Issue and manage keys from **Customer → API Keys** in the dashboard. Keys are shown in full only once at creation — store them immediately.
