Quickstart
From an API key to your first chat completion — unary and streaming — using nothing but curl.
This guide takes you from zero to your first completion in a couple of minutes.
Get an API key
Create an OpenRelay API key in the dashboard under
Settings → API Keys. Keys are prefixed with vl_ and are shown in full only
once — store it somewhere safe.
export OPENRELAY_API_KEY="vl_your_api_key"See Authentication for the details.
Make your first request
Send a chat completion to https://inference.openrelay.inc/v1/chat/completions:
curl https://inference.openrelay.inc/v1/chat/completions \
-H "Authorization: Bearer $OPENRELAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "openrelay/gpt-oss-120b",
"messages": [
{ "role": "user", "content": "Write a haiku about distributed systems." }
]
}'{
"id": "chatcmpl-…",
"object": "chat.completion",
"model": "openrelay/gpt-oss-120b",
"choices": [
{
"index": 0,
"message": { "role": "assistant", "content": "Nodes whisper in sync…" },
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 16,
"completion_tokens": 19,
"total_tokens": 35
}
}The model field in the response is always the public id you requested.
Stream the response
Set "stream": true to receive the completion as Server-Sent Events. The
stream ends with a final usage chunk and a data: [DONE] sentinel:
curl -N https://inference.openrelay.inc/v1/chat/completions \
-H "Authorization: Bearer $OPENRELAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "openrelay/gpt-oss-120b",
"stream": true,
"messages": [
{ "role": "user", "content": "Count to five." }
]
}'data: {"id":"chatcmpl-…","object":"chat.completion.chunk","model":"openrelay/gpt-oss-120b","choices":[{"index":0,"delta":{"content":"1"}}]}
data: {"id":"chatcmpl-…","object":"chat.completion.chunk","model":"openrelay/gpt-oss-120b","choices":[{"index":0,"delta":{"content":" 2"}}]}
…
data: {"id":"chatcmpl-…","object":"chat.completion.chunk","model":"openrelay/gpt-oss-120b","choices":[],"usage":{"prompt_tokens":12,"completion_tokens":9,"total_tokens":21}}
data: [DONE]-N disables curl's output buffering so you see tokens arrive live. See
Streaming for the format details.
Next steps
- Use your existing OpenAI client → Using OpenAI SDKs
- Every request parameter and response field → Chat Completions
- What's available and what it costs → Models and Pricing & billing