Replace the example API key with a workspace key and keep model-specific fields unchanged unless the table above marks them optional.
curl -X POST http://omixa.cloud/api/v1/chat/completions \
-H "Authorization: Bearer omx_live_xxx" \
-H "Content-Type: application/json" \
-d '{
"model": "grok-3",
"messages": [
{
"role": "system",
"content": "You are a concise API assistant."
},
{
"role": "user",
"content": "Explain this model in three practical bullet points."
}
],
"stream": true,
"max_tokens": 2048,
"temperature": 0.7,
"tools": [
{
"type": "function",
"function": {
"name": "lookup_order",
"description": "Return order status by ID.",
"parameters": {
"type": "object",
"properties": {
"order_id": {
"type": "string"
}
},
"required": [
"order_id"
]
}
}
}
],
"tool_choice": "auto"
}'
const response = await fetch('http://omixa.cloud/api/v1/chat/completions', {
method: 'POST',
headers: {
'Authorization': 'Bearer omx_live_xxx',
'Content-Type': 'application/json'
},
body: "{\n \"model\": \"grok-3\",\n \"messages\": [\n {\n \"role\": \"system\",\n \"content\": \"You are a concise API assistant.\"\n },\n {\n \"role\": \"user\",\n \"content\": \"Explain this model in three practical bullet points.\"\n }\n ],\n \"stream\": true,\n \"max_tokens\": 2048,\n \"temperature\": 0.7,\n \"tools\": [\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"lookup_order\",\n \"description\": \"Return order status by ID.\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"order_id\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"order_id\"\n ]\n }\n }\n }\n ],\n \"tool_choice\": \"auto\"\n}"
});
const data = await response.json();
import requests
response = requests.post(
'http://omixa.cloud/api/v1/chat/completions',
headers={'Authorization': 'Bearer omx_live_xxx', 'Content-Type': 'application/json'},
json={
"model": "grok-3",
"messages": [
{
"role": "system",
"content": "You are a concise API assistant."
},
{
"role": "user",
"content": "Explain this model in three practical bullet points."
}
],
"stream": True,
"max_tokens": 2048,
"temperature": 0.7,
"tools": [
{
"type": "function",
"function": {
"name": "lookup_order",
"description": "Return order status by ID.",
"parameters": {
"type": "object",
"properties": {
"order_id": {
"type": "string"
}
},
"required": [
"order_id"
]
}
}
}
],
"tool_choice": "auto"
}
)
print(response.json())
$ch = curl_init('http://omixa.cloud/api/v1/chat/completions');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer omx_live_xxx', 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => '{
"model": "grok-3",
"messages": [
{
"role": "system",
"content": "You are a concise API assistant."
},
{
"role": "user",
"content": "Explain this model in three practical bullet points."
}
],
"stream": true,
"max_tokens": 2048,
"temperature": 0.7,
"tools": [
{
"type": "function",
"function": {
"name": "lookup_order",
"description": "Return order status by ID.",
"parameters": {
"type": "object",
"properties": {
"order_id": {
"type": "string"
}
},
"required": [
"order_id"
]
}
}
}
],
"tool_choice": "auto"
}',
CURLOPT_RETURNTRANSFER => true,
]);
$response = curl_exec($ch);
using var client = new HttpClient();
client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", "omx_live_xxx");
var json = @"{
""model"": ""grok-3"",
""messages"": [
{
""role"": ""system"",
""content"": ""You are a concise API assistant.""
},
{
""role"": ""user"",
""content"": ""Explain this model in three practical bullet points.""
}
],
""stream"": true,
""max_tokens"": 2048,
""temperature"": 0.7,
""tools"": [
{
""type"": ""function"",
""function"": {
""name"": ""lookup_order"",
""description"": ""Return order status by ID."",
""parameters"": {
""type"": ""object"",
""properties"": {
""order_id"": {
""type"": ""string""
}
},
""required"": [
""order_id""
]
}
}
}
],
""tool_choice"": ""auto""
}";
var response = await client.PostAsync("http://omixa.cloud/api/v1/chat/completions", new StringContent(json, System.Text.Encoding.UTF8, "application/json"));
var body = await response.Content.ReadAsStringAsync();
payload := []byte(`{
"model": "grok-3",
"messages": [
{
"role": "system",
"content": "You are a concise API assistant."
},
{
"role": "user",
"content": "Explain this model in three practical bullet points."
}
],
"stream": true,
"max_tokens": 2048,
"temperature": 0.7,
"tools": [
{
"type": "function",
"function": {
"name": "lookup_order",
"description": "Return order status by ID.",
"parameters": {
"type": "object",
"properties": {
"order_id": {
"type": "string"
}
},
"required": [
"order_id"
]
}
}
}
],
"tool_choice": "auto"
}`)
req, _ := http.NewRequest("POST", "http://omixa.cloud/api/v1/chat/completions", bytes.NewReader(payload))
req.Header.Set("Authorization", "Bearer omx_live_xxx")
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
Set `"stream": true` and read Server-Sent Events line by line until `data: [DONE]`. Each event is OpenAI-compatible `chat.completion.chunk` JSON.