API Overview
Base URL
https://api.ru-llm.relay2.xyzReplace this with your self-hosted gateway URL if applicable.
API surfaces
ru-llm exposes two fully compatible API surfaces on the same gateway:
| Surface | Base path | Protocol |
|---|---|---|
| OpenAI-compatible | /v1 | OpenAI Chat Completions API |
| Anthropic-compatible | /v1 | Anthropic Messages API |
The surface is determined by the endpoint you call, not by configuration.
Authentication
All requests require an sk-ru-… API key. Both surfaces accept either header:
Authorization: Bearer sk-ru-YOUR_KEYx-api-key: sk-ru-YOUR_KEYCreate and manage keys in the console → API Keys.
Endpoints
OpenAI-compatible
| Method | Path | Description |
|---|---|---|
POST | /v1/chat/completions | Chat completion (streaming or non-streaming) |
GET | /v1/models | List available models |
Anthropic-compatible
| Method | Path | Description |
|---|---|---|
POST | /v1/messages | Messages API (streaming or non-streaming) |
GET | /v1/models | List available models |
Cross-dialect routing
This means your existing OpenAI SDK code can access Claude models without any changes to the SDK — just point base_url at the gateway and switch the model ID.
Content types
All request and response bodies are JSON (Content-Type: application/json). Streaming responses use text/event-stream (Server-Sent Events).
Versioning
- OpenAI surface: no version header required.
- Anthropic surface: pass
anthropic-version: 2023-06-01(or later) in request headers.