Grok 4.7 API is a multimodal OpenAI Responses-style endpoint ( /grok/v1/responses: input/output items andresponse.*streaming events) that accepts a plain string or a structured input array, supports adjustable reasoning effort, and integrates web search or function calling tools.
input as a plain string, or as an array of message objects. To send an image, add an input_image part next to input_text in the message content; image_url can be a public URL or a data:image/...;base64,... string. Files use an input_file part with file_url.{
"model": "grok-4-7",
"input": [
{
"role": "user",
"content": [
{ "type": "input_text", "text": "What is in this image?" },
{ "type": "input_image", "image_url": "https://file.aiquickdraw.com/custom-page/akr/section-images/1759055072437dqlsclj2.png" }
]
}
]
}text (structured output) is optional; omit it to get a plain-text answer.credits_consumed: the credits charged for this request, calculated from token usage. With stream: true it is on the response.completed event; with stream: false it is a top-level field of the returned response.tools array enables web search or function calling capabilities.{"type": "web_search"} and {"type": "function", ...} in the same tools array.curl --location 'https://api.emix.ai/grok/v1/responses' \
--header 'Content-Type: application/json' \
--data '{
"model": "grok-4-7",
"stream": true,
"input": [
{
"role": "user",
"content": [
{
"type": "input_text",
"text": "Hello, please reply in Chinese"
}
]
}
],
"text": {
"format": {
"type": "json_schema",
"name": "basic_response",
"strict": true,
"schema": {
"type": "object",
"properties": {
"answer": {
"type": "string",
"description": "Response content"
},
"mood": {
"type": "string",
"description": "Mood when responding"
}
},
"required": [
"answer",
"mood"
],
"additionalProperties": false
}
}
}
}'{
"output": [
{
"type": "reasoning",
"id": "rs_xxx",
"summary": []
},
{
"type": "message",
"role": "assistant",
"id": "msg_xxx",
"content": [
{
"type": "output_text",
"text": "Hello! How can I help you today?"
}
],
"status": "completed"
}
],
"usage": {
"total_tokens": 4490,
"output_tokens": 47,
"input_tokens": 4443
},
"credits_consumed": 0.48,
"status": "completed"
}