免費體驗 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: 審閱廣告、社群視覺、mockup 與設計匯出中的內容細節與一致性。
- 文件影像理解: 分析表單、收據、圖表與影像型參考材料。
- 無障礙工作流程: 產生影像描述與視覺摘要,讓媒體更容易理解與重複使用。
注意 請確保 prompt、上傳影像與應用程式工作流程符合 xAI 的安全與使用準則。如果發生錯誤,請檢查輸入是否含有限制內容、簡化請求,然後再試一次。
Grok 4 Image-to-Text 與競品比較:比較分析
-
Grok 4 Image-to-Text vs. GPT Image-to-Text
GPT image-to-text routes 提供 OpenAI 原生多模態行為。Grok 4 Image-to-Text 提供 xAI 路由,用於視覺理解與受管理 API 工作流程。 -
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 移除託管工作,並為開發者提供穩定受管理路由。