Grok Quick Response (All Models)
curl --request POST \
--url https://direct.evolink.ai/v1/responses \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "grok-4.7",
"input": "Explain what makes Grok 4.5 different in two sentences."
}
'import requests
url = "https://direct.evolink.ai/v1/responses"
payload = {
"model": "grok-4.7",
"input": "Explain what makes Grok 4.5 different in two sentences."
}
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.7',
input: 'Explain what makes Grok 4.5 different in two sentences.'
})
};
fetch('https://direct.evolink.ai/v1/responses', 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/responses",
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.7',
'input' => 'Explain what makes Grok 4.5 different in two sentences.'
]),
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/responses"
payload := strings.NewReader("{\n \"model\": \"grok-4.7\",\n \"input\": \"Explain what makes Grok 4.5 different in two sentences.\"\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/responses")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"grok-4.7\",\n \"input\": \"Explain what makes Grok 4.5 different in two sentences.\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://direct.evolink.ai/v1/responses")
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.7\",\n \"input\": \"Explain what makes Grok 4.5 different in two sentences.\"\n}"
response = http.request(request)
puts response.read_body{
"id": "55d44212-8d5e-90cc-975f-36d341ce21f5",
"object": "response",
"status": "completed",
"model": "grok-4.7",
"created_at": 1786538000,
"output": [
{
"id": "<string>",
"type": "message",
"status": "completed",
"content": [
{}
],
"encrypted_content": "<string>"
}
],
"usage": {
"input_tokens": 1692,
"output_tokens": 54,
"total_tokens": 1746,
"input_tokens_details": {
"cached_tokens": 512
},
"output_tokens_details": {
"reasoning_tokens": 35
}
}
}{
"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"
}
}Responses API
Grok All-Model API - Responses Quickstart
- Call xAI Grok text models using the OpenAI Responses API format (pick the model via the
modelparameter) - Reasoning + tool-use models with a 500K-token context window
- xAI server-side tools run on xAI infrastructure:
web_search,x_search,code_execution,attachment_search, andcollections_search. X Search is billed by posts and user profiles fetched; other tools are billed per successful call. - Need tools and all parameters? See the full parameter documentation
- Under xAI’s official API contract,
grok-4.7returnsreasoningitems containingencrypted_contentby default; the fields actually returned depend on the current route.
POST
/
v1
/
responses
Grok Quick Response (All Models)
curl --request POST \
--url https://direct.evolink.ai/v1/responses \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "grok-4.7",
"input": "Explain what makes Grok 4.5 different in two sentences."
}
'import requests
url = "https://direct.evolink.ai/v1/responses"
payload = {
"model": "grok-4.7",
"input": "Explain what makes Grok 4.5 different in two sentences."
}
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.7',
input: 'Explain what makes Grok 4.5 different in two sentences.'
})
};
fetch('https://direct.evolink.ai/v1/responses', 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/responses",
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.7',
'input' => 'Explain what makes Grok 4.5 different in two sentences.'
]),
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/responses"
payload := strings.NewReader("{\n \"model\": \"grok-4.7\",\n \"input\": \"Explain what makes Grok 4.5 different in two sentences.\"\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/responses")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"grok-4.7\",\n \"input\": \"Explain what makes Grok 4.5 different in two sentences.\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://direct.evolink.ai/v1/responses")
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.7\",\n \"input\": \"Explain what makes Grok 4.5 different in two sentences.\"\n}"
response = http.request(request)
puts response.read_body{
"id": "55d44212-8d5e-90cc-975f-36d341ce21f5",
"object": "response",
"status": "completed",
"model": "grok-4.7",
"created_at": 1786538000,
"output": [
{
"id": "<string>",
"type": "message",
"status": "completed",
"content": [
{}
],
"encrypted_content": "<string>"
}
],
"usage": {
"input_tokens": 1692,
"output_tokens": 54,
"total_tokens": 1746,
"input_tokens_details": {
"cached_tokens": 512
},
"output_tokens_details": {
"reasoning_tokens": 35
}
}
}{
"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"
}
}BaseURL: The default BaseURL is
https://direct.evolink.ai, which has better support for text models and long-lived connections. https://api.evolink.ai is the primary endpoint for multimodal services and serves as a fallback address for text models.Authorizations
##All APIs require Bearer Token authentication##
Get API Key:
Visit API Key Management Page to get your API Key
Add to request header:
Authorization: Bearer YOUR_API_KEY
Body
application/json
Model to call:
| Model ID | Positioning |
|---|---|
grok-4.7 | xAI reasoning and tool-use model; 500K-token context window; supports xhigh; knowledge cutoff: 2026-05 |
grok-4.6 | xAI reasoning + tool-use model, 500K context window; knowledge cutoff 2026-02-01 |
grok-4.5 | xAI reasoning + tool-use model, 500K context window |
Available options:
grok-4.7, grok-4.6, grok-4.5 Example:
"grok-4.7"
Input text for the model
Example:
"Explain what makes Grok 4.5 different in two sentences."
Response
Response generated successfully
Unique identifier for the response
Example:
"55d44212-8d5e-90cc-975f-36d341ce21f5"
Response type
Available options:
response Example:
"response"
Response status
Available options:
completed, incomplete, failed Example:
"completed"
Model name actually used
Example:
"grok-4.7"
Creation timestamp
Example:
1786538000
Output items. Grok reasoning models typically return reasoning items (summarized thinking) followed by a message item with the final answer.
Show child attributes
Show child attributes
Token usage statistics. Prompts of 200K tokens or more are billed at 2x for all token types.
Show child attributes
Show child attributes