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