試用 xAI 的 Grok 4.6 API,透過 Flaq AI 穩定的統一 API,進行 Image-to-Text、視覺問答、OCR、分析與串流多模態回應。協助理解圖片內容並擷取重要文字資訊。
Grok 4.6 相關模型
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.6-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.6-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.6-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.6 Image to Text 價格
| 參數 | 價格 | 原價 | 折扣 |
|---|
README
Grok 4.6 Image-to-Text API(視覺推理與分析)
Grok 4.6 Image-to-Text API 在 Flaq AI 上將 xAI 面向推理的文字模型與圖像理解能力相結合。它讓 應用程式能將針對性的視覺輸入與指示一併傳送,然後接收用於說明、擷取、比較 或分析圖像內容的文字。這項 Grok 視覺 API 整合專為需要將視覺依據 轉化為可執行回覆、技術觀察或結構化後續步驟的工作流程而設計。
Grok 4.6 Image-to-Text API 的主要功能
-
以圖像為依據的分析: 針對所提供的圖像提出問題,並取得與可見細節、 版面配置、物件及上下文相關的文字回覆。
-
視覺轉文字推理: 將圖像與自然語言指示結合,用於說明、比較、 疑難排解及分析工作流程。
-
專注的圖像輸入: 為路由提供已設定的圖像輸入與明確的任務指示,讓 圖像問答工作流程能直接完成整合。
-
技術檢查輔助: 將視覺上下文用於介面審查、螢幕截圖解讀、圖表 說明、產品意見分類,以及類似的文字輸出任務。
-
可控的對話請求: 將圖像問題與結構化訊息上下文配對,讓應用程式能 提供任務框架、先前需求及後續提示詞。
-
以文字為優先的結果: 接收可供審查、顯示、路由或下游工作流程使用的產生文字, 而非將此路由當作圖像生成端點。
如何在 Flaq AI 上使用 Grok 4.6 Image-to-Text API
-
輸入: 一張受支援的圖像,以及以自然語言描述問題、擷取目標或 分析任務的請求。
-
輸出: 用於描述、說明、比較或分析所提供視覺內容的文字回覆。
-
圖像傳送: 在應用程式工作流程中使用已設定的 Flaq AI 請求格式傳入圖像。
-
能力: 螢幕截圖分析、視覺問答、以圖像為依據的說明、內容審查及 細節擷取。
Grok 4.6 Image-to-Text API 整合的最佳使用情境
-
螢幕截圖與 UI 審查: 說明介面、識別可見狀態、彙整意見,或將螢幕截圖 轉化為可供開發人員直接處理的問題描述。
-
產品與目錄輔助: 擷取可觀察到的產品細節、產生屬性草稿,並為人工 審查視覺提交內容提供支援。
-
技術支援分類: 協助團隊解讀錯誤螢幕截圖、裝置照片或設定圖像,之後再將 案例轉交給操作人員。
-
文件與圖表說明: 將圖形、圖表、投影片及視覺參考資料轉化為清楚的文字 觀察結果及後續問題。
-
內容營運: 支援審核佇列、無障礙內容起草及圖像描述工作流程,同時 保留由人工進行最終審查。
注意 在將圖像理解結果用於影響重大、安全關鍵、法律、醫療或 金融決策之前,應加以審查。請勿將產生的文字作為專業檢查的替代品。
Grok 4.6 Image-to-Text API 與競品比較:比較分析
-
Grok 4.6 Image-to-Text 與 Grok 4.5 Image-to-Text 比較
Grok 4.5 為視覺 問答工作流程提供成熟的選擇。Grok 4.6 則是更新一代的模型,適合希望評估更強圖像 推理請求能力的團隊。 -
Grok 4.6 Image-to-Text 與 Gemini 3.7 Flash Image-to-Text 比較
Gemini 3.7 Flash 提供高效率的多模態模型 家族。Grok 4.6 Image-to-Text 則提供專注的 Flaq 路由,適合希望在 視覺輸入、文字輸出工作流程中測試 xAI 視覺推理的團隊。 -
Grok 4.6 Image-to-Text 與 GPT 5.6 Terra Image-to-Text 比較
GPT 5.6 Terra 視覺模型常用於通用多模態任務。 如果工作流程在視覺分析之外也重視 xAI 面向推理與程式設計的模型家族, Grok 4.6 便是實用的替代方案。 -
Grok 4.6 Image-to-Text 與 Claude Vision 比較
Claude 視覺模型非常適合說明及 文件類任務。Grok 4.6 Image-to-Text 為開發人員提供另一個 API 選項,可用於以圖像為依據的問題、 審查及營運工作流程。 -
Grok 4.6 Image-to-Text 與 Gemini 3.6 Flash Image-to-Text 比較
Gemini 3.6 Flash 兼顧廣泛的多模態能力 與高效率運作。當視覺請求還需要詳細的文字技術 推理時,Grok 4.6 是值得評估的有力候選模型。