Docs / LLM / Chat
LLM / Chat
RelayDance serves chat models through a fully OpenAI-compatible API. If you already use the OpenAI SDK, change the base URL and API key; no other code changes are needed.
On RelayDance the text models are the Grok family from xAI, for example
grok-4.3. Call GET /v1/models with your key for the exact list.#Base URL
https://relaydance.com/v1#Python
main.pypython
from openai import OpenAI
import os
client = OpenAI(
api_key=os.environ["RELAYDANCE_API_KEY"],
base_url="https://relaydance.com/v1",
)
response = client.chat.completions.create(
model="grok-4.3",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Explain quantum computing in simple terms."},
],
temperature=0.7,
max_tokens=1024,
)
print(response.choices[0].message.content)#Python: streaming
stream.pypython
stream = client.chat.completions.create(
model="grok-4.3",
messages=[{"role": "user", "content": "Write a short story about a robot."}],
stream=True,
)
for chunk in stream:
content = chunk.choices[0].delta.content
if content:
print(content, end="", flush=True)#Node.js / TypeScript
index.tstypescript
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.RELAYDANCE_API_KEY,
baseURL: "https://relaydance.com/v1",
});
const response = await client.chat.completions.create({
model: "grok-4.3",
messages: [
{ role: "system", content: "You are a helpful assistant." },
{ role: "user", content: "Explain quantum computing in simple terms." },
],
});
console.log(response.choices[0].message.content);#cURL
terminalbash
curl https://relaydance.com/v1/chat/completions \
-H "Authorization: Bearer $RELAYDANCE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "grok-4.3",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Explain quantum computing in simple terms."}
],
"temperature": 0.7,
"max_tokens": 1024
}'#Common parameters
| Parameter | Type | Description |
|---|---|---|
model | string | Model ID from your key's model list |
messages | array | Chat messages with role (system | user | assistant) and content |
temperature | number | Sampling temperature 0 to 2. Higher means more random |
max_tokens | integer | Maximum tokens to generate |
stream | boolean | If true, tokens are sent as SSE chunks |
top_p | number | Nucleus sampling, alternative to temperature |
stop | string | array | Up to 4 stop sequences |
tools | array | Tools the model may call (OpenAI tool-use schema) |
Parameter support varies by model; unsupported parameters are ignored upstream. See the Chat Completions reference for request and response shapes.