在 Best Image AI 上试用 Grok 4.7 API。向 xAI 模型提问,解读截图、分析代码,在同一段对话中结合文字和图片继续追问。可用界面或报错截图补充代码上下文,并流式接收回答。
通过 Best Image AI 上的 Grok 4.7 API,你可以调用 xAI 的前沿推理模型。Grok 4.7 接收文本和图像,返回文本。例如,它可以结合界面截图和缺陷报告分析问题,提出修复建议。Grok 4.7 提供 500,000 token 的输入输出共享上下文窗口,支持调节推理强度、调用工具和流式输出,适用于高难度软件工程任务、视觉审查和复杂的知识工作。
注意 将生成结果用于生产代码或法律、医疗、金融及安全关键决策前,请先审核。费用按输入和输出 token 数计算,所有请求都必须遵守 xAI 和 Best Image AI 的适用政策。
Grok 4.7 与 Grok 4.6
Grok 4.6 为纯文本提示和需要结合图像的提示提供不同接口。Grok 4.7 通过同一 API 接收文本和图像输入,支持调节推理强度和调用工具,并提供 500,000 token 的共享上下文窗口。
Grok 4.7 与 Claude Sonnet 5.5
Claude Sonnet 5.5 广泛用于需要细致处理的长文写作和编程工作流。对于评估前沿模型工程能力的团队,Grok 4.7 提供了 xAI 的统一图文推理接口,并支持调节推理强度和调用工具。
Grok 4.7 与 GPT 6.1 Sol
在 OpenAI 的模型系列中,GPT 6.1 Sol 支持通用文本、视觉和文件处理工作流。Grok 4.7 则是 xAI 提供的选择,侧重可调节的推理深度、长共享上下文,以及结合图文输入的开发工作流。
Grok 4.7 与 Gemini 3.7 Flash
Gemini 3.7 Flash 侧重对文本、图像和文件进行高速多模态处理。Grok 4.7 可通过同一对话 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"
}'
查看 Grok 4.7 在 Best Image AI 上当前可用的参数、支持的输入和功能。
在 Best Image AI 上试用 Grok 4.7 API。向 xAI 模型提问,解读截图、分析代码,在同一段对话中结合文字和图片继续追问。可用界面或报错截图补充代码上下文,并流式接收回答。
支持的任务:文本转文本, 图像转文本。可用的输入和设置包括 输入, 图像, contextMessages。支持的取值请参阅规格说明。
计费方式:按 100 万输入 token / 100 万输出 token 计费,费率取决于 Token。上方价格表列出了各项费率及决定所适用费率的设置。
如果任务因系统错误失败,余额不会扣减。
在请求中使用 grok-4.7 作为模型 ID。有关身份验证和请求的详细说明,请参阅 API 文档。
购买的点数不会过期。生成结果的商业用途须遵守 Best Image AI 服务条款和适用的模型提供方条款。