GPT 5.5 API
由 OpenAI 提供支持的 GPT 5.5 大模型完整 API 参考。
模型版本
此 API 支持四种模型版本:
快速对比
GPT 5.5 Text to Text
接口地址
POST /api/v1/chat/completions
请求参数
必填参数
消息支持
可选
请求示例
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: 'gpt-5.5-text-to-text',
messages: [
{
role: 'user',
content: 'Write a short launch announcement for a new AI feature.'
}
],
stream: true,
max_tokens: 2048
})
});
GPT 5.5 Image to Text
接口地址
POST /api/v1/chat/completions
请求参数
必填参数
消息支持
可选
请求示例
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: 'gpt-5.5-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
})
});
GPT 5.5 Web Search
接口地址
POST /api/v1/chat/completions
请求参数
必填参数
消息支持
可选
请求示例
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: 'gpt-5.5-web-search',
messages: [
{
role: 'user',
content: 'Find recent product launch trends in AI developer tools.'
}
],
stream: true,
max_tokens: 2048
})
});
GPT 5.5 File Analysis
接口地址
POST /api/v1/chat/completions
请求参数
必填参数
消息支持
可选
请求示例
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: 'gpt-5.5-file-analysis',
messages: [
{
role: 'user',
content: [
{ type: 'text', text: 'Summarize this document and list the key action items.' },
{
type: 'file',
file: {
filename: 'demo.pdf',
file_data: 'https://example.com/demo.pdf'
}
}
]
}
],
stream: true,
max_tokens: 2048
})
});
响应格式
GPT 5.5 大模型返回 OpenAI 兼容生成响应。stream: true 时响应为 Server-Sent Events;stream: false 时响应为单个 JSON 对象。
成功响应
data: {"id":"chatcmpl-...","object":"chat.completion.chunk","created":1710000000,"model":"gpt-5.5-image-to-text","choices":[{"index":0,"delta":{"role":"assistant"},"finish_reason":null}]}
data: {"id":"chatcmpl-...","object":"chat.completion.chunk","created":1710000000,"model":"gpt-5.5-image-to-text","choices":[{"index":0,"delta":{"content":"The image shows"},"finish_reason":null}]}
data: {"id":"chatcmpl-...","object":"chat.completion.chunk","created":1710000000,"model":"gpt-5.5-image-to-text","choices":[{"index":0,"delta":{},"finish_reason":"stop"}]}
data: {"id":"chatcmpl-...","object":"chat.completion.chunk","created":1710000000,"model":"gpt-5.5-image-to-text","choices":[],"usage":{"prompt_tokens":12,"completion_tokens":8,"total_tokens":20}}
data: [DONE]
错误响应
event: error
data: {"error":{"message":"API requests too frequent, exceeding rate limit","type":"rate_limit_error","code":"1302","param":null}}
最佳实践
- 保持消息结构化: 使用
messages[] 表示对话历史,而不是把上下文压平成一个 prompt。
- 将文件和图像附加到消息: 将
image_url 和 file 部分放在引入它们的消息中。
- 使用 SSE 解析: 追加
choices[0].delta.content 进行增量展示,并将 data: [DONE] 视为成功完成。
- 仅发送受支持的输入: 将文本、图像和文件部分与所选模型版本匹配。
- 在本地保存请求状态: chunk 包含 completion
id,但客户端仍应通过当前活跃请求状态路由 chunk。