Claude Code 指南
設定 Flaq AI Claude 模型並探索 Claude Code 技能
透過 Flaq AI 穩定、實惠且支援應用程式串流回應的 API,體驗 Anthropic Claude Sonnet 5.5 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: 'claude-sonnet-5.5-file-analysis',
messages: [
{
role: 'user',
content: [
{ type: 'text', text: 'Summarize the key points of this PDF.' },
{
type: 'file',
file: {
filename: 'gptproto.pdf',
file_data: 'https://tos.gptproto.com/resource/gptproto.pdf'
}
}
]
}
],
stream: true,
max_tokens: 1000,
})
});
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;
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': 'claude-sonnet-5.5-file-analysis',
'messages': [
{
'role': 'user',
'content': [
{'type': 'text', 'text': 'Summarize the key points of this PDF.'},
{
'type': 'file',
'file': {
'filename': 'gptproto.pdf',
'file_data': 'https://tos.gptproto.com/resource/gptproto.pdf'
}
},
],
}
],
'stream': True,
'max_tokens': 1000,
},
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": "claude-sonnet-5.5-file-analysis",
"messages": [
{
"role": "user",
"content": [
{ "type": "text", "text": "Summarize the key points of this PDF." },
{
"type": "file",
"file": {
"filename": "gptproto.pdf",
"file_data": "https://tos.gptproto.com/resource/gptproto.pdf"
}
}
]
}
],
"stream": true,
"max_tokens": 1000
}'
| 參數 | 價格 | 原價 | 折扣 |
|---|
Claude Sonnet 5.5 File Analysis API 協助開發者在 Flaq AI 上將上傳的參考資料轉化為實用的 書面回答。將文件或影像與問題結合,即可要求根據 提供的內容產生摘要、說明與比較。以訊息為基礎的介面、串流傳輸及可調整的輸出長度,支援文件 助理與需要將來源檔案轉化為易讀回應的研究工作流程。
以文件為中心的提問: 針對提供的文件提出具體問題,無須手動將每個 相關段落複製到純文字對話中。
彈性的參考輸入: 結合支援的檔案、影像與文字指令,提供 文件審閱任務所需的資料。
摘要與擷取工作流程: 要求概述、重點或提供資料中的指定 資訊,並在提示詞中明確指定輸出格式。
跨文件審閱: 提供相關檔案,並要求模型辨識共同主題、差異或需要 進一步檢視的要點。
對話式追問: 延續相關訊息,以完善摘要,或要求說明 某項具體發現。
串流與長度控制: 逐步顯示生成的分析,並設定適合 所需深度的輸出 token 上限。
輸入: 支援的文件或影像附件,以及可選的文字指令與相關訊息。
輸出: 書面分析、摘要或回答,可選擇串流與非串流回應。
控制項: 透過具體問題、期望格式及可選的輸出 token 上限引導分析。
能力: 文件問答、摘要、資訊擷取,以及對提供的 參考資料進行比較。
報告審閱: 要求提供上傳報告的精簡概述,並針對與團隊相關的章節 繼續提問。
研究閱讀: 比較提供的論文或參考文件,將主要觀點整理為工作 簡報。
專案交接: 將附件中的規格說明與筆記整理成需求及待解問題摘要。
知識助理: 讓使用者透過對話介面查詢上傳的參考檔案。
編輯準備: 在起草文章或簡報前,從來源文件中擷取主題與 支持細節。
注意 使用清晰可讀的來源檔案,並明確指出希望回答的問題。在採用分析結果前,請依原始資料核對引文、數字及 結論。
Claude Sonnet 5.5 File Analysis 與 GPT 6.1 Sol File Analysis Flaq AI 上的兩種路由皆接受檔案與影像,以產生 書面分析。請使用相同的來源文件與問題評估兩者,比較相關性、完整性及 詮釋方式。
Claude Sonnet 5.5 File Analysis 與 Claude Sonnet 5.5 Text-to-Text Text-to-Text 使用直接在訊息中 提供的來源資料。File Analysis 支援附件輸入,適合以文件為中心的任務。
Claude Sonnet 5.5 File Analysis 與 GPT 6.1 Sol Image-to-Text Image-to-Text 著重視覺問答,在 Flaq AI 的設定中 未啟用文件附件。File Analysis 支援以已上傳檔案及影像為核心的 工作流程。
Claude Sonnet 5.5 File Analysis 與 GPT 6.1 Sol Web Search Web Search 用於線上研究,而此 Claude 路由審閱提供的資料,不使用網頁搜尋。請依答案所需證據的來源 進行選擇。
設定 Flaq AI Claude 模型並探索 Claude Code 技能

設定 Flaq AI GPT 模型並探索 Codex 技能
在 Hermes Agent 中使用 Flaq AI LLM 模型
在 ZCode 中使用 GLM 5.2、Kimi K3 和 DeepSeek v4
使用 Flaq AI DeepSeek 模型執行 DeepSeek Harness
將 AI 代理連接至 Flaq 圖片和影片生成工具
在 WorkBuddy 中使用 GPT 6 Astra 和 Claude Fable 5.1