curl --request POST \
--url https://direct.evolink.ai/v1/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "grok-4.6",
"messages": [
{
"role": "system",
"content": "You are a concise assistant."
},
{
"role": "user",
"content": "Explain prompt caching in one sentence."
}
],
"stream": false,
"max_tokens": 1024,
"reasoning_effort": "high",
"temperature": 0.7,
"top_p": 0.95,
"tools": [
{
"type": "function",
"function": {}
}
]
}
'import requests
url = "https://direct.evolink.ai/v1/chat/completions"
payload = {
"model": "grok-4.6",
"messages": [
{
"role": "system",
"content": "You are a concise assistant."
},
{
"role": "user",
"content": "Explain prompt caching in one sentence."
}
],
"stream": False,
"max_tokens": 1024,
"reasoning_effort": "high",
"temperature": 0.7,
"top_p": 0.95,
"tools": [
{
"type": "function",
"function": {}
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'grok-4.6',
messages: [
{role: 'system', content: 'You are a concise assistant.'},
{role: 'user', content: 'Explain prompt caching in one sentence.'}
],
stream: false,
max_tokens: 1024,
reasoning_effort: 'high',
temperature: 0.7,
top_p: 0.95,
tools: [{type: 'function', function: {}}]
})
};
fetch('https://direct.evolink.ai/v1/chat/completions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://direct.evolink.ai/v1/chat/completions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'grok-4.6',
'messages' => [
[
'role' => 'system',
'content' => 'You are a concise assistant.'
],
[
'role' => 'user',
'content' => 'Explain prompt caching in one sentence.'
]
],
'stream' => false,
'max_tokens' => 1024,
'reasoning_effort' => 'high',
'temperature' => 0.7,
'top_p' => 0.95,
'tools' => [
[
'type' => 'function',
'function' => [
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://direct.evolink.ai/v1/chat/completions"
payload := strings.NewReader("{\n \"model\": \"grok-4.6\",\n \"messages\": [\n {\n \"role\": \"system\",\n \"content\": \"You are a concise assistant.\"\n },\n {\n \"role\": \"user\",\n \"content\": \"Explain prompt caching in one sentence.\"\n }\n ],\n \"stream\": false,\n \"max_tokens\": 1024,\n \"reasoning_effort\": \"high\",\n \"temperature\": 0.7,\n \"top_p\": 0.95,\n \"tools\": [\n {\n \"type\": \"function\",\n \"function\": {}\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://direct.evolink.ai/v1/chat/completions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"grok-4.6\",\n \"messages\": [\n {\n \"role\": \"system\",\n \"content\": \"You are a concise assistant.\"\n },\n {\n \"role\": \"user\",\n \"content\": \"Explain prompt caching in one sentence.\"\n }\n ],\n \"stream\": false,\n \"max_tokens\": 1024,\n \"reasoning_effort\": \"high\",\n \"temperature\": 0.7,\n \"top_p\": 0.95,\n \"tools\": [\n {\n \"type\": \"function\",\n \"function\": {}\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://direct.evolink.ai/v1/chat/completions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"grok-4.6\",\n \"messages\": [\n {\n \"role\": \"system\",\n \"content\": \"You are a concise assistant.\"\n },\n {\n \"role\": \"user\",\n \"content\": \"Explain prompt caching in one sentence.\"\n }\n ],\n \"stream\": false,\n \"max_tokens\": 1024,\n \"reasoning_effort\": \"high\",\n \"temperature\": 0.7,\n \"top_p\": 0.95,\n \"tools\": [\n {\n \"type\": \"function\",\n \"function\": {}\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "chatcmpl-20260812164515123456789AbCdEfGh",
"model": "grok-4.6",
"object": "chat.completion",
"created": 1786538000,
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Prompt caching reuses previously processed prompt prefixes so repeated context is billed at a lower rate.",
"tool_calls": [
{}
]
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 504,
"completion_tokens": 2,
"total_tokens": 526,
"prompt_tokens_details": {
"cached_tokens": 0
}
}
}{
"error": {
"code": 400,
"message": "Invalid request parameters",
"type": "invalid_request_error"
}
}{
"error": {
"code": 401,
"message": "Invalid or expired token",
"type": "authentication_error"
}
}{
"error": {
"code": 402,
"message": "Insufficient quota",
"type": "insufficient_quota_error",
"fallback_suggestion": "https://evolink.ai/dashboard/billing"
}
}{
"error": {
"code": 429,
"message": "Rate limit exceeded",
"type": "rate_limit_error",
"fallback_suggestion": "retry after 60 seconds"
}
}{
"error": {
"code": 500,
"message": "Internal server error",
"type": "internal_server_error",
"fallback_suggestion": "try again later"
}
}{
"error": {
"code": 503,
"message": "Service temporarily unavailable",
"type": "service_unavailable_error",
"fallback_suggestion": "retry after 30 seconds"
}
}Grok Schnittstelle für alle Modelle - Chat Completions vollständige Parameter
- OpenAI-kompatibler Chat-Completions-Endpunkt für xAI-Grok-Textmodelle; Modellauswahl über den Parameter
model(alle Werte siehe Tabelle beim Parametermodel) - Kontextfenster von 500K Token; ab 200K Token im Prompt werden alle Token-Typen zum doppelten Preis abgerechnet
- Prompt-Caching greift automatisch: Token aus dem Cache werden zum günstigeren Cache-Eingabepreis abgerechnet
- Synchroner und Streaming-Modus (SSE)
- Reguläre
function-Tool-Aufrufe werden unterstützt; serverseitige xAI-Tools stehen ausschließlich über die Responses API bereit
curl --request POST \
--url https://direct.evolink.ai/v1/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "grok-4.6",
"messages": [
{
"role": "system",
"content": "You are a concise assistant."
},
{
"role": "user",
"content": "Explain prompt caching in one sentence."
}
],
"stream": false,
"max_tokens": 1024,
"reasoning_effort": "high",
"temperature": 0.7,
"top_p": 0.95,
"tools": [
{
"type": "function",
"function": {}
}
]
}
'import requests
url = "https://direct.evolink.ai/v1/chat/completions"
payload = {
"model": "grok-4.6",
"messages": [
{
"role": "system",
"content": "You are a concise assistant."
},
{
"role": "user",
"content": "Explain prompt caching in one sentence."
}
],
"stream": False,
"max_tokens": 1024,
"reasoning_effort": "high",
"temperature": 0.7,
"top_p": 0.95,
"tools": [
{
"type": "function",
"function": {}
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'grok-4.6',
messages: [
{role: 'system', content: 'You are a concise assistant.'},
{role: 'user', content: 'Explain prompt caching in one sentence.'}
],
stream: false,
max_tokens: 1024,
reasoning_effort: 'high',
temperature: 0.7,
top_p: 0.95,
tools: [{type: 'function', function: {}}]
})
};
fetch('https://direct.evolink.ai/v1/chat/completions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://direct.evolink.ai/v1/chat/completions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'grok-4.6',
'messages' => [
[
'role' => 'system',
'content' => 'You are a concise assistant.'
],
[
'role' => 'user',
'content' => 'Explain prompt caching in one sentence.'
]
],
'stream' => false,
'max_tokens' => 1024,
'reasoning_effort' => 'high',
'temperature' => 0.7,
'top_p' => 0.95,
'tools' => [
[
'type' => 'function',
'function' => [
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://direct.evolink.ai/v1/chat/completions"
payload := strings.NewReader("{\n \"model\": \"grok-4.6\",\n \"messages\": [\n {\n \"role\": \"system\",\n \"content\": \"You are a concise assistant.\"\n },\n {\n \"role\": \"user\",\n \"content\": \"Explain prompt caching in one sentence.\"\n }\n ],\n \"stream\": false,\n \"max_tokens\": 1024,\n \"reasoning_effort\": \"high\",\n \"temperature\": 0.7,\n \"top_p\": 0.95,\n \"tools\": [\n {\n \"type\": \"function\",\n \"function\": {}\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://direct.evolink.ai/v1/chat/completions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"grok-4.6\",\n \"messages\": [\n {\n \"role\": \"system\",\n \"content\": \"You are a concise assistant.\"\n },\n {\n \"role\": \"user\",\n \"content\": \"Explain prompt caching in one sentence.\"\n }\n ],\n \"stream\": false,\n \"max_tokens\": 1024,\n \"reasoning_effort\": \"high\",\n \"temperature\": 0.7,\n \"top_p\": 0.95,\n \"tools\": [\n {\n \"type\": \"function\",\n \"function\": {}\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://direct.evolink.ai/v1/chat/completions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"grok-4.6\",\n \"messages\": [\n {\n \"role\": \"system\",\n \"content\": \"You are a concise assistant.\"\n },\n {\n \"role\": \"user\",\n \"content\": \"Explain prompt caching in one sentence.\"\n }\n ],\n \"stream\": false,\n \"max_tokens\": 1024,\n \"reasoning_effort\": \"high\",\n \"temperature\": 0.7,\n \"top_p\": 0.95,\n \"tools\": [\n {\n \"type\": \"function\",\n \"function\": {}\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "chatcmpl-20260812164515123456789AbCdEfGh",
"model": "grok-4.6",
"object": "chat.completion",
"created": 1786538000,
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Prompt caching reuses previously processed prompt prefixes so repeated context is billed at a lower rate.",
"tool_calls": [
{}
]
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 504,
"completion_tokens": 2,
"total_tokens": 526,
"prompt_tokens_details": {
"cached_tokens": 0
}
}
}{
"error": {
"code": 400,
"message": "Invalid request parameters",
"type": "invalid_request_error"
}
}{
"error": {
"code": 401,
"message": "Invalid or expired token",
"type": "authentication_error"
}
}{
"error": {
"code": 402,
"message": "Insufficient quota",
"type": "insufficient_quota_error",
"fallback_suggestion": "https://evolink.ai/dashboard/billing"
}
}{
"error": {
"code": 429,
"message": "Rate limit exceeded",
"type": "rate_limit_error",
"fallback_suggestion": "retry after 60 seconds"
}
}{
"error": {
"code": 500,
"message": "Internal server error",
"type": "internal_server_error",
"fallback_suggestion": "try again later"
}
}{
"error": {
"code": 503,
"message": "Service temporarily unavailable",
"type": "service_unavailable_error",
"fallback_suggestion": "retry after 30 seconds"
}
}https://direct.evolink.ai und bietet bessere Unterstützung für Textmodelle sowie persistente Verbindungen. https://api.evolink.ai ist der primäre Endpunkt für multimodale Dienste und dient bei Textmodellen als Ausweichadresse.function-Tool-Aufrufe.Autorisierungen
##Alle APIs erfordern Bearer-Token-Authentifizierung##
API-Schlüssel erhalten:
Besuchen Sie die API-Schlüsselverwaltungsseite, um Ihren API-Schlüssel zu erhalten
Zum Anfrage-Header hinzufügen:
Authorization: Bearer YOUR_API_KEY
Body
Aufzurufendes Modell:
| Modell-ID | Positionierung |
|---|---|
grok-4.6 | xAI-Modell für Reasoning und Tool-Aufrufe, Kontextfenster von 500K; zusätzlich mit Reasoning-Stufe xhigh; Wissensstand 2026-02-01 |
grok-4.5 | xAI-Modell für Reasoning und Tool-Aufrufe, Kontextfenster von 500K; Reasoning-Stufen bis high (xhigh wird akzeptiert, aber auf high herabgestuft) |
grok-4.6, grok-4.5 "grok-4.6"
Liste der Chat-Nachrichten. Unterstützt die Rollen system, user und assistant.
1Show child attributes
Show child attributes
[ { "role": "system", "content": "You are a concise assistant." }, { "role": "user", "content": "Explain prompt caching in one sentence." } ]
Ob eine Streaming-Antwort zurückgegeben wird (SSE, chat.completion.chunk-Events). Standard false.
false
Maximale Anzahl der zu generierenden Token.
1024
Reasoning-Tiefe: low / medium / high (Standard) / xhigh. Reasoning lässt sich nicht abschalten. xhigh wird nur von grok-4.6 unterstützt – grok-4.5 akzeptiert den Wert, stuft ihn aber auf high herab. Reasoning-Tokens werden als Ausgabe-Tokens abgerechnet.
low, medium, high, xhigh Sampling-Temperatur (0-2). Höhere Werte erzeugen zufälligere Ausgaben.
0.7
Nucleus-Sampling-Parameter (0-1).
0.95
Reguläre OpenAI-function-Tool-Definitionen (clientseitige Funktionsaufrufe, keine zusätzliche Gebühr pro Aufruf). Serverseitige xAI-Tools stehen ausschließlich über die Responses API bereit.
Show child attributes
Show child attributes
Steuert die Funktionsauswahl: "auto" / "none" / "required" oder ein Objekt, das eine bestimmte Funktion festlegt.
auto, none, required Antwort
Chat-Vervollständigung erfolgreich generiert (JSON-Objekt oder – bei stream=true – ein SSE-Stream von chat.completion.chunk-Events)
Eindeutiger Bezeichner für die Chat-Vervollständigung
"chatcmpl-20260812164515123456789AbCdEfGh"
Tatsächlich verwendeter Modellname
"grok-4.6"
Antworttyp
chat.completion "chat.completion"
Erstellungszeitstempel
1786538000
Liste der Chat-Vervollständigungsoptionen
Show child attributes
Show child attributes
Statistik zur Token-Nutzung. Ab 200K Token im Prompt werden alle Token-Typen (Eingabe, Cache-Eingabe, Ausgabe) zum doppelten Preis abgerechnet.
Show child attributes
Show child attributes