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

# First API call

> Discover your callable models and make a live text call using an OmniRelay key.

## 1. Confirm activation

Sign in to the [console](https://omnirelay.ai/login), verify your email and workspace, and check **Overview → Live model service**. If offered, select Request activation. Verified new registrations enter the setup queue when automatic activation is enabled. You can browse **Model marketplace** before activation, with every model marked unavailable and no call action; a top-up or completed account setup does not by itself activate inference. Contact [support@omnirelay.ai](mailto:support@omnirelay.ai) if review is required.

## 2. Create an API key

After activation is verified, create a dedicated key under **API Keys** (creation is disabled beforehand), with the required models, budget and expiry. Its full value appears at creation or rotation and can be viewed again after confirming it's you; keep it on your server. Customers only need an OmniRelay key, no other credentials.

```bash theme={null}
export OMNIRELAY_API_KEY="YOUR_OMNIRELAY_API_KEY"
export OMNIRELAY_BASE_URL="https://api.omnirelay.ai/v1"
```

## 3. Discover models

Query your own list first. The examples below use `gpt-6-luna`; it must appear in your list with `mode: live`. If the list is empty, check activation and key model restrictions.

```bash theme={null}
curl "$OMNIRELAY_BASE_URL/models" \
  -H "Authorization: Bearer $OMNIRELAY_API_KEY"
```

## 4. Send a text request

Streaming is the recommended default: text arrives as it is generated, and long generations are not cut off by the time limit for a complete non-streamed reply. Leave out `stream` to receive one JSON response instead.

```bash cURL theme={null}
curl -N "$OMNIRELAY_BASE_URL/chat/completions" \
  -H "Authorization: Bearer $OMNIRELAY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"gpt-6-luna","messages":[{"role":"user","content":"Hello OmniRelay"}],"max_completion_tokens":1024,"stream":true,"stream_options":{"include_usage":true}}'
```

```python Python theme={null}
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["OMNIRELAY_API_KEY"],
    base_url=os.environ["OMNIRELAY_BASE_URL"],
    max_retries=0,
)
stream = client.chat.completions.create(
    model="gpt-6-luna",
    messages=[{"role": "user", "content": "Hello OmniRelay"}],
    max_completion_tokens=1024,
    stream=True,
    stream_options={"include_usage": True},
)
for chunk in stream:
    if chunk.choices and chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="", flush=True)
    # Usage and the settled charge arrive in a final chunk without choices.
    if chunk.usage:
        print("\n", chunk.usage, getattr(chunk, "cost_microusd", None))
```

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

const client = new OpenAI({
  apiKey: process.env.OMNIRELAY_API_KEY,
  baseURL: process.env.OMNIRELAY_BASE_URL,
  maxRetries: 0,
});
const stream = await client.chat.completions.create({
  model: "gpt-6-luna",
  messages: [{ role: "user", content: "Hello OmniRelay" }],
  max_completion_tokens: 1024,
  stream: true,
  stream_options: { include_usage: true },
});
for await (const chunk of stream) {
  process.stdout.write(chunk.choices[0]?.delta?.content ?? "");
  // Usage and the settled charge arrive in a final chunk without choices.
  if (chunk.usage) console.log("\n", chunk.usage, chunk.cost_microusd);
}
```

## 5. Check the result and charge

Keep the `X-Request-ID` response header: support uses it to look up a single call, and the **Usage** page shows your totals. `usage` is validated usage; `cost_microusd` is the settled charge (divide by 1,000,000 for USD), distinct from the maximum pre-dispatch hold.

GPT 6 Luna has a 1,050,000-token context, defaults to 32,000 output tokens and allows at most 128,000. Most integrated text models allow up to 128,000 output tokens and default to 32,000 (Gemini 3.1 Pro Preview and Gemini 3.6 Flash: at most 65,536); DeepSeek V4 Pro, GLM 5.3 and Kimi K3 default to and allow at most 4,096; GPT 5.4 Mini defaults to 64 and allows at most 256. When switching models, check `limits`, `capabilities.stream` and `reasoning_efforts`; do not copy GPT-specific options to other models. Live calls must not include `locale` or unsupported fields. Check `capabilities.tools`, `json_object` and `json_schema` before sending function tools or JSON formats.

> [!WARNING]
>
> Live calls are paid and reserve money before dispatch; even a short prompt needs sufficient balance and budget. SDK examples disable automatic retries. After a timeout or stream failure, check the error code in [Errors](https://omnirelay.ai/docs/general/errors.md) before resending.

[Chat completions](https://omnirelay.ai/docs/llms/chat-completions.md) · [List models](https://omnirelay.ai/docs/llms/listing-models.md) · [Usage and billing](https://omnirelay.ai/docs/general/usage-billing.md) · [User manual](https://omnirelay.ai/docs/user-manual.md)


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