We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
用cf_worker反代apenai api 替换掉https://api.openai.com
我自建了一个https://openai.1rmb.tk
自建
const TELEGRAPH_URL = 'https://api.openai.com'; addEventListener('fetch', event => { event.respondWith(handleRequest(event.request)) }) async function handleRequest(request) { const url = new URL(request.url); url.host = TELEGRAPH_URL.replace(/^https?:\/\//, ''); const modifiedRequest = new Request(url.toString(), { headers: request.headers, method: request.method, body: request.body, redirect: 'follow' }); const response = await fetch(modifiedRequest); const modifiedResponse = new Response(response.body, response); // 添加允许跨域访问的响应头 modifiedResponse.headers.set('Access-Control-Allow-Origin', '*'); return modifiedResponse; }
curl --location 'https://openai.1rmb.tk/v1/chat/completions' \ --header 'Authorization: Bearer sk-xxxxxxxxxxxxxxx' \ --header 'Content-Type: application/json' \ --data '{ "model": "gpt-3.5-turbo", "messages": [{"role": "user", "content": "Hello!"}] }'
Originally posted by @x-dr in anse-app/chatgpt-demo#34 (comment)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
我自建了一个https://openai.1rmb.tk
自建
代码
使用
Originally posted by @x-dr in anse-app/chatgpt-demo#34 (comment)
The text was updated successfully, but these errors were encountered: