Claude Code 指南
配置 Flaq AI Claude 模型并探索 Claude Code 技能
免费体验 Grok 4 API,用于多模态推理、视觉问答、OCR 和图像理解。为生产 AI 应用提供稳定的 xAI 访问能力。适合专业团队在 AI 工作流中处理应用集成、协作交付、场景验证、内容复核、资料整理、业务分析、多步骤任务、产品探索和日常团队迭代,持续构建、测试、验证、优化并改进 AI 功能体验。先测试模型输出并比较视觉质量,再通过稳定图片、视频或多模态 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
}'
| 参数 | 价格 | 原价 | 折扣 |
|---|
Flaq AI 上的 Grok 4 Image-to-Text API 为视觉理解、图像分析和多模态推理工作流提供 xAI 模型访问能力。这个 Grok API 集成帮助开发者通过稳定的托管路由,将上传的图像转化为描述、提取细节、答案和结构化摘要。它专为希望获得 xAI 驱动的 image-to-text 能力、而不想构建特定提供商基础设施的团队而设计。
注意 请确保提示词、上传图像和应用工作流符合 xAI 安全与使用指南。如果发生错误,请检查输入是否包含受限内容,简化请求,然后重试。
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 移除托管工作,并为开发者提供稳定的托管路由。