Docs / API Reference / Chat Completions
POST
/v1/chat/completionsChat Completions
OpenAI-compatible endpoint for LLM chat. Supports streaming and tool calling. Drop-in replacement: change only the base URL and API key. On RelayDance the chat models are the Grok family (for example grok-4.3).
#Request body
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Model ID from your key's model list |
messages | array | Yes | Array of {role, content} objects. Roles: system | user | assistant |
temperature | number | No | Sampling temperature 0 to 2. Default: 1 |
max_tokens | integer | No | Max tokens to generate. Model limit applies if omitted |
stream | boolean | No | If true, stream tokens via SSE. Default: false |
top_p | number | No | Nucleus sampling, alternative to temperature |
stop | string | array | No | Up to 4 stop sequences |
tools | array | No | OpenAI tool-use schema for function calling |
#Example request
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 2 sentences."}
],
"temperature": 0.7,
"max_tokens": 256
}'#Response (non-streaming)
response.jsonjson
{
"id": "chatcmpl-abc123",
"object": "chat.completion",
"created": 1749300000,
"model": "grok-4.3",
"choices": [
{
"index": 0,
"message": { "role": "assistant", "content": "Quantum computing uses quantum bits..." },
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 32,
"completion_tokens": 48,
"total_tokens": 80
}
}#Streaming
Set stream: true to receive tokens as Server-Sent Events:
stream_response.txttext
data: {"id":"chatcmpl-abc123","choices":[{"delta":{"content":"Quantum"},"index":0}]}
data: {"id":"chatcmpl-abc123","choices":[{"delta":{"content":" computing"},"index":0}]}
...
data: [DONE]#Tool calling
tools.jsonjson
{
"model": "grok-4.3",
"messages": [{"role": "user", "content": "What's the weather in Tokyo?"}],
"tools": [
{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get the current weather for a location",
"parameters": {
"type": "object",
"properties": {
"location": {"type": "string", "description": "City name"}
},
"required": ["location"]
}
}
}
]
}Tool calling and parameter support vary by model. Unsupported parameters are ignored upstream.