快速开始
- 右上角「⚙️」填入智谱AI Key
- 输入文本或粘贴/上传截图
- 点击「开始翻译」
部署 API 代理 (解决跨域/保护Key)
Cloudflare Workers 代理代码:
export default {
async fetch(request, env) {
if (request.method === 'OPTIONS') {
return new Response(null, { headers: { 'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Methods': 'POST, OPTIONS', 'Access-Control-Allow-Headers': 'Content-Type, Authorization' } });
}
try {
const reqData = await request.json();
const apiKey = env.ZHIPU_API_KEY || '在这里填你的Key';
const url = 'https://open.bigmodel.cn/api/paas/v4/chat/completions';
const resp = await fetch(url, {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${apiKey}` },
body: JSON.stringify(reqData)
});
return new Response(resp.body, {
headers: { 'Content-Type': 'text/event-stream', 'Access-Control-Allow-Origin': '*' }
});
} catch (err) {
return new Response(JSON.stringify({error: err.message}), { status: 500, headers: { 'Content-Type': 'application/json', 'Access-Control-Allow-Origin': '*' }});
}
}
}