免费体验 Grok 4 API,用于多模态推理、视觉问答、OCR 和图像理解。为生产 AI 应用提供稳定的 xAI 访问能力。适合专业团队在 AI 工作流中处理应用集成、协作交付、场景验证、内容复核、资料整理、业务分析、多步骤任务、产品探索和日常团队迭代,持续构建、测试、验证、优化并改进 AI 功能体验。先测试模型输出并比较视觉质量,再通过稳定图片、视频或多模态 API 工作流扩展团队创意生产。
Grok 4 相关模型
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-image-to-text',
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
})
});
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('\n\n');
buffer = frames.pop() || '';
for (const frame of frames) {
const lines = frame.split('\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;
console.log(assistantText);
}
}
}
提交示例
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-image-to-text',
'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,
},
stream=True,
)
response.raise_for_status()
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-image-to-text",
"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
}'
Grok 4 Image to Text 价格
| 参数 | 价格 | 原价 | 折扣 |
|---|
README
快速且经济实惠的 Grok 4 Image-to-Text API(xAI 的视觉理解模型)
Flaq AI 上的 Grok 4 Image-to-Text API 为视觉理解、图像分析和多模态推理工作流提供 xAI 模型访问能力。这个 Grok API 集成帮助开发者通过稳定的托管路由,将上传的图像转化为描述、提取细节、答案和结构化摘要。它专为希望获得 xAI 驱动的 image-to-text 能力、而不想构建特定提供商基础设施的团队而设计。
Grok 4 Image-to-Text API 的核心功能
- 视觉理解: 通过多模态模型推理分析上传的图像、截图、对象、布局和视觉细节。
- 基于图像的回答: 针对图像提出有目标的自然语言问题,并获得聚焦的文本响应。
- 实用提取工作流: 将视觉内容转换为适用于应用的描述、摘要、标签和结构化细节。
- 具备对话感知的输出: 通过灵活上下文支持后续问题和迭代式视觉审查。
- 开发者友好的控制: 通过 Flaq AI 上的实用配置引导响应长度、细节层级和任务方向。
- 托管 xAI 集成: 通过具备清晰输入和输出行为的稳定 API 路由添加 Grok image-to-text 能力。
如何在 Flaq AI 上使用 Grok 4 Image-to-Text API 进行视觉分析
- 输入: 上传的图像内容,以及描述分析、提取或推理任务的自然语言指令。
- 输出: 来自上传图像的文本描述、提取细节、视觉推理或结构化摘要。
- 路由配置: 专为聚焦的图像理解工作流而设计,并支持特定路由的图像输入。
- 配置: 支持用于响应长度、细节层级和任务方向的实用输出控制。
- 能力: 通过 xAI Grok API 集成实现图像理解、OCR 风格提取、视觉 QA、截图审查、产品检查和多模态推理。
Grok 4 Image-to-Text API 集成的最佳使用场景
- 截图与界面分析: 从图像中提取 UI 细节、总结屏幕内容并记录产品流程。
- 产品与目录审查: 生成产品描述、识别属性并比较视觉差异。
- 创意资产 QA: 审查广告、社交视觉、模型稿和设计导出中的内容细节与一致性。
- 文档图像理解: 分析表单、收据、图表和基于图像的参考材料。
- 无障碍工作流: 生成图像描述和视觉摘要,让媒体更易理解和复用。
注意 请确保提示词、上传图像和应用工作流符合 xAI 安全与使用指南。如果发生错误,请检查输入是否包含受限内容,简化请求,然后重试。
Grok 4 Image-to-Text 与竞品对比:比较分析
-
Grok 4 Image-to-Text vs. GPT Image-to-Text
GPT image-to-text 路由提供 OpenAI 原生多模态行为。Grok 4 Image-to-Text 为视觉理解和托管 API 工作流提供 xAI 路由。 -
Grok 4 Image-to-Text vs. Gemini Image-to-Text
Gemini image-to-text 对 Google 模型用户和快速视觉分析很有优势。Grok 4 Image-to-Text 为团队的多模态产品功能提供 xAI 替代方案。 -
Grok 4 Image-to-Text vs. Claude File Analysis
Claude file analysis 擅长谨慎的文档和附件推理。Grok 4 Image-to-Text 专注于基于图像的回答和视觉提取工作流。 -
Grok 4 Image-to-Text vs. Qwen Vision Workflows
Qwen vision workflows 提供 Alibaba 模型替代方案。Grok 4 Image-to-Text 适合希望在模型组合中加入 xAI 驱动视觉理解的团队。 -
Grok 4 Image-to-Text vs. Llama Vision Models
Llama vision models 提供开源模型部署灵活性。Grok 4 Image-to-Text 移除托管工作,并为开发者提供稳定的托管路由。