Try the Grok 4.7 API on Best Image AI. Ask questions about screenshots, work through code, and carry text and images through the same conversation with xAI. Stream replies.
Grok 4.7 API brings xAI's frontier reasoning model to Best Image AI. Grok 4.7 accepts text and images and returns text—for example, it can review a UI screenshot alongside a bug report and suggest a fix. With a 500,000-token shared context window, configurable reasoning effort, tool calling, and streaming output, Grok 4.7 is built for demanding software engineering, visual inspection, and complex knowledge work.
Note Review generated outputs before applying them to production code, legal, medical, financial, or safety-critical decisions. Usage is billed by input and output tokens, and all requests must comply with applicable xAI and Best Image AI policies.
Grok 4.7 vs. Grok 4.6
Grok 4.6 offers separate routes for text-only and image-grounded prompts. Grok 4.7 accepts both text and image inputs through a single API and supports configurable reasoning effort, tool calling, and a 500,000-token shared context window.
Grok 4.7 vs. Claude Sonnet 5.5
Claude Sonnet 5.5 is widely used for careful long-form writing and coding workflows. Grok 4.7 offers xAI's unified text-and-image reasoning interface with adjustable reasoning effort and tool calling for teams evaluating frontier engineering performance.
Grok 4.7 vs. GPT 6.1 Sol
GPT 6.1 Sol supports general-purpose text, vision, and file workflows across OpenAI's lineup. Grok 4.7 provides a focused xAI option centered on configurable reasoning depth, long shared context, and mixed text-and-image developer workflows.
Grok 4.7 vs. Gemini 3.7 Flash
Gemini 3.7 Flash emphasizes high-speed multimodal processing across text, images, and files. Grok 4.7 targets deeper configurable reasoning and coding-intensive tasks alongside visual input within a single conversational API.
const response = await fetch('https://api.flaq.ai/api/v1/chat/completions', {
method: 'POST',
headers: {
Authorization: 'Bearer YOUR_API_KEY',
Accept: 'text/event-stream',
'Content-Type': 'application/json'
},
body: JSON.stringify({
model: 'grok-4.7',
messages: [
{
role: 'user',
content: [
{ type: 'text', text: 'Describe the image and extract any visible text.' },
{
type: 'image_url',
image_url: {
url: 'https://example.com/sample-image.jpg'
}
}
]
}
],
stream: true,
max_tokens: 2048,
reasoning_effort: 'medium'
})
});
if (!response.ok) {
const errorBody = await response.json().catch(() => null);
throw new Error(errorBody?.error?.message ?? errorBody?.message ?? `HTTP ${response.status}`);
}
const reader = response.body.getReader();
const decoder = new TextDecoder();
let buffer = '';
let assistantText = '';
while (true) {
const { done, value } = await reader.read();
if (done) break;
buffer += decoder.decode(value, { stream: true });
const frames = buffer.split(/\r?\n\r?\n/);
buffer = frames.pop() || '';
for (const frame of frames) {
const lines = frame.split(/\r?\n/).filter(Boolean);
let eventName = 'message';
const dataLines = [];
for (const line of lines) {
if (line.startsWith('event:')) {
eventName = line.slice(6).trim();
} else if (line.startsWith('data:')) {
dataLines.push(line.replace(/^data:\s*/, ''));
}
}
const raw = dataLines.join('\n').trim();
if (raw === '[DONE]') {
console.log('\nFinal text:', assistantText);
continue;
}
let payload;
try {
payload = JSON.parse(raw);
} catch {
continue;
}
if (eventName === 'error' || payload.error) {
const msg = payload.error?.message ?? payload.message ?? 'Chat request failed';
throw new Error(msg);
}
const delta = payload.choices?.[0]?.delta;
if (delta?.content) {
assistantText += delta.content;
}
}
}
import json
import requests
response = requests.post(
'https://api.flaq.ai/api/v1/chat/completions',
headers={
'Authorization': 'Bearer YOUR_API_KEY',
'Accept': 'text/event-stream',
'Content-Type': 'application/json',
},
json={
'model': 'grok-4.7',
'messages': [
{
'role': 'user',
'content': [
{'type': 'text', 'text': 'Describe the image and extract any visible text.'},
{
'type': 'image_url',
'image_url': {
'url': 'https://example.com/sample-image.jpg'
}
},
],
}
],
'stream': True,
'max_tokens': 2048,
'reasoning_effort': 'medium',
},
stream=True,
)
response.raise_for_status()
response.encoding = 'utf-8'
event_name = 'message'
assistant_text = ''
for raw_line in response.iter_lines(decode_unicode=True):
if not raw_line:
event_name = 'message'
continue
if raw_line.startswith('event:'):
event_name = raw_line.replace('event:', '', 1).strip()
continue
if raw_line.startswith('data:'):
raw_data = raw_line.replace('data:', '', 1).strip()
if raw_data == '[DONE]':
print('\nFinal text:', assistant_text)
continue
payload = json.loads(raw_data)
if event_name == 'error' or payload.get('error'):
error = payload.get('error') or payload
raise RuntimeError(error.get('message', 'Chat request failed'))
choices = payload.get('choices') or []
if choices:
delta = choices[0].get('delta') or {}
content = delta.get('content')
if content:
assistant_text += content
print(content, end='', flush=True)
curl -N -X POST "https://api.flaq.ai/api/v1/chat/completions" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Accept: text/event-stream" \
-H "Content-Type: application/json" \
-d '{
"model": "grok-4.7",
"messages": [
{
"role": "user",
"content": [
{ "type": "text", "text": "Describe the image and extract any visible text." },
{
"type": "image_url",
"image_url": {
"url": "https://example.com/sample-image.jpg"
}
}
]
}
],
"stream": true,
"max_tokens": 2048,
"reasoning_effort": "medium"
}'
Live parameters, supported inputs, and capabilities for Grok 4.7 on Best Image AI.
Try the model in the Playground before making an API request.
Use one credit balance across video, image, and LLM models. Purchased credits never expire. If a task fails due to a system error, your balance is not deducted.
Copy the model ID below into your API request for Grok 4.7.
Everything you need to know about capabilities, pricing, failed tasks, and API usage.
Try the Grok 4.7 API on Best Image AI. Ask questions about screenshots, work through code, and carry text and images through the same conversation with xAI. Stream replies.
Supported tasks: Text To Text, Image to Text. Available inputs and settings include Input, Image, contextMessages. See the specifications for their supported values.
Billing model: Per 1M input tokens / 1M output tokens by Token. The pricing table above lists rates and the settings that determine which rate applies.
If a task fails due to a system error, your balance will not be deducted.
Use grok-4.7 as the model ID in your request. Refer to the API documentation for authentication and request details.
Purchased credits do not expire. Commercial use of outputs is subject to Best Image AI’s terms of service and the applicable model provider’s terms.