OpenAI-compatible gateway

Build once. Route to every model.

A focused guide to connect your application to Xyrus Router, authenticate requests, stream completions, and discover available models.

Base URL

https://ai-gateway-production-df56.up.railway.app/v1

01 / Quick start

Make your first request

Create an API key, choose a model, and send an OpenAI-compatible request to the Railway gateway.

01

Create a key

Generate a credential from the dashboard.

02

Choose a model

Use any ID returned by /models.

03

Send a request

Keep your existing OpenAI client.

Request example
curl https://ai-gateway-production-df56.up.railway.app/v1/chat/completions   -H "Content-Type: application/json"   -H "Authorization: Bearer API_KEY_ANDA"   -d '{"model":"xyrz/gpt-5.6-luna","messages":[{"role":"user","content":"Halo"}]}'

02 / Authentication

Use a bearer token

Every chat request needs your API key in the Authorization header.

Authorization: Bearer API_KEY_ANDA

Generate your key from the dashboard. Keep it server-side and never commit it to source control.

03 / Chat completions

One endpoint, familiar shape

Xyrus Router accepts the same core request format used by OpenAI-compatible clients.

POST https://ai-gateway-production-df56.up.railway.app/v1/chat/completions
FieldTypeDescription
modelstringModel ID from the model catalog.
messagesarrayMessages with role and content.
streambooleanEnable SSE streaming responses.
max_tokensintegerMaximum tokens in the response.
temperaturefloatSampling temperature from 0 to 2.

04 / Streaming

Stream tokens over SSE

Set stream to true to receive incremental completion chunks.

Standard Server-Sent Events

Read each data: line as JSON and stop when the server sends data: [DONE].

05 / Models

Discover available models

Use the model catalog before routing traffic to confirm IDs and provider availability.

GET https://ai-gateway-production-df56.up.railway.app/v1/models

This endpoint does not require authentication. It returns model IDs, providers, context windows, and billing multiples (billed tokens = (input + output) × multiple).

06 / Errors

Predictable error responses

Errors use standard HTTP status codes with a machine-readable error code.

StatusCodeMeaning
401invalid_api_keyMissing or invalid API key.
404model_not_foundModel is not supported by the gateway.
429rate_limit_exceededThe API key rate limit was reached.
502provider_errorThe upstream provider returned an error.
503provider_not_configuredThe provider is not configured on this server.