Fvv API Proxy 使用文档
1. 概述
这是一个请求代理服务,用于中转HTTP请求,支持RESTful API和流式响应(SSE/AI流式输出)。
2. 接口地址
POST https://proxy.fvv.lol
3. 请求参数
| 参数名 |
类型 |
必填 |
默认值 |
说明 |
| url |
string |
是 |
- |
目标API地址,支持http/https |
| method |
string |
否 |
GET |
HTTP方法:GET/POST/PUT/DELETE/PATCH/OPTIONS/HEAD |
| data |
object |
否 |
null |
请求体数据 |
| dataType |
string |
否 |
JSON |
数据类型:JSON/FORM |
| header |
array |
否 |
[] |
请求头数组,格式:["Key: Value"] |
| timeout |
int |
否 |
30 |
请求超时时间(秒) |
| followRedirects |
bool |
否 |
true |
是否跟随重定向 |
| returnHeader |
bool |
否 |
false |
是否返回响应头 |
| stream |
bool |
否 |
false |
是否启用流式传输(SSE/AI流式响应) |
4. 请求示例
使用curl调用:
curl -X POST https://proxy.fvv.lol \
-H "Content-Type: application/json" \
-d '{
"url": "https://api.example.com/users",
"method": "GET",
"header": ["Authorization: Bearer token"],
"timeout": 30
}'
使用JavaScript调用:
fetch('https://proxy.fvv.lol', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
url: 'https://api.example.com/users',
method: 'POST',
data: { name: 'John' },
dataType: 'JSON',
header: ['Content-Type: application/json'],
stream: false
})
}).then(res => res.text()).then(console.log);
5. 流式请求示例(AI接口)
fetch('https://proxy.fvv.lol', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
url: 'https://api.openai.com/v1/chat/completions',
method: 'POST',
data: {
model: 'gpt-3.5-turbo',
messages: [{ role: 'user', content: 'Hello' }],
stream: true
},
header: ['Authorization: Bearer YOUR_API_KEY'],
stream: true,
timeout: 120
})
}).then(response => {
const reader = response.body.getReader();
const decoder = new TextDecoder('utf-8');
reader.read().then(function process({ done, value }) {
if (done) return;
console.log(decoder.decode(value, { stream: true }));
return reader.read().then(process);
});
});
6. 支持的HTTP方法
GET - 获取资源
POST - 创建资源
PUT - 更新资源(完整替换)
DELETE - 删除资源
PATCH - 部分更新资源
OPTIONS - 预检请求
HEAD - 获取响应头
7. 响应说明
成功响应:返回目标API的原始响应内容
错误响应:{"error": "错误信息"}
8. 状态码说明
| 状态码 |
说明 |
| 200 |
请求成功 |
| 400 |
请求参数错误 |
| 403 |
不支持的协议类型 |
| 500 |
服务器内部错误(如缺少curl扩展) |
| 502 |
代理请求失败 |
代理地址: https://proxy.fvv.lol