海外からのアクセス:www.kdjingpai.com
Ctrl + D このサイトをブックマークする

GPT3.5からAPIへの無料ログイン

https://github.com/missuo/FreeGPT35

https://github.com/aurora-develop/aurora

https://github.com/Dalufishe/freegptjs

https://github.com/PawanOsman/ChatGPT

https://github.com/nashsu/FreeAskInternet

https://github.com/aurorax-neo/free-gpt3.5-2api

https://github.com/aurora-develop/free-gpt3.5-2api

https://github.com/LanQian528/chat2api

https://github.com/k0baya/FreeGPT35-Glitch

https://github.com/cliouo/FreeGPT35-Vercel

https://github.com/hominsu/freegpt35

https://github.com/xsigoking/chatgpt-free-api

https://github.com/skzhengkai/free-chatgpt-api

https://github.com/aurora-develop/aurora-glitch (使用glitch资源)

https://github.com/fatwang2/coze2openai(COZE转API,GPT4)

 

国内モデル・リバース

徹底探索(DeepSeek) API へのインターフェース deepseek-free-api

ムーンショットAI(Kimi.ai)のAPIへのインターフェース kimi-free-api

ジャンピングスター (リープフロッグ・アスク・ステップチャット)APIへのインターフェース step-free-api

アリ・トンイ(Qwen) APIへのインターフェース qwen-free-api

ZhipuAI (知的好奇心を刺激するスピーチ) APIへのインターフェース glm-free-api

メタAI(メタソ) APIへのインターフェース metaso-free-api

バイトジャンプ(ビーンバッグ) APIへのインターフェース doubao-free-api

バイトジャンプ(ドリームAI APIへのインターフェース jimeng-free-api

APIへのスパーク・インターフェース spark-free-api

MiniMax (Conch AI) APIへのインターフェース hailuo-free-api

エモハアAPIインターフェイス emohaa-free-api

チャット・インターフェースを備えたログイン不要のプログラム

https://github.com/Mylinde/FreeGPT

 

cloudflareのワークコードは、再生するために独自のドメイン名を結びつける:

addEventListener(“fetch”, event => {
event.respondWith(handleRequest(event.request))
})

async function handleRequest(request) {
// 确保请求是 POST 请求,并且路径正确
if (request.method === “POST” && new URL(request.url).pathname === “/v1/chat/completions”) {
const url = 'https://multillm.ai-pro.org/api/openai-completion'; // ターゲットAPIアドレス
const headers = new Headers(request.headers);

// 添加或修改需要的 headers
headers.set(‘Content-Type’, ‘application/json’);

// 获取请求的 body 并解析 JSON
const requestBody = await request.json();
const stream = requestBody.stream; // ストリーム引数の取得

// 构造新的请求
const newRequest = new Request(url, {
method: ‘POST’,
headers: headers,
body: JSON.stringify(requestBody) // 変更されたボディを使用する
});

try {
// 向目标 API 发送请求
const response = await fetch(newRequest);

// 根据 stream 参数确定响应类型
if (stream) {
// 处理流式响应
const { readable, writable } = new TransformStream();
response.body.pipeTo(writable);
return new Response(readable, {
headers: response.headers
});
} else {
// 正常返回响应
return new Response(response.body, {
status: response.status,
headers: response.headers
});
}
} catch (e) {
// 如果请求失败,返回错误信息
return new Response(JSON.stringify({ error: ‘Unable to reach the backend API’ }), { status: 502 });
}
} else {
// 如果请求方法不是 POST 或路径不正确,返回错误
return new Response(‘Not found’, { status: 404 });
}
}

POSTの例:

curl –location ‘https://ai-pro-free.aivvm.com/v1/chat/completions’ \
–header ‘Content-Type: application/json’ \
–data ‘{
“model”: “gpt-4-turbo”,
“messages”: [
{
"role": "user", "content": "魯迅はなぜ周秀蓮を殴ったのか?"
}],
“stream”: true
}’

 

擬似ストリーミング・コードを追加する(出力は遅くなる):

addEventListener(“fetch”, event => {
event.respondWith(handleRequest(event.request))
})

async function handleRequest(request) {
if (request.method === “OPTIONS”) {
return new Response(null, {
headers: {
‘Access-Control-Allow-Origin’: ‘*’,
“Access-Control-Allow-Headers”: ‘*’
}, status: 204
})
}
// 确保请求是 POST 请求,并且路径正确
if (request.method === “POST” && new URL(request.url).pathname === “/v1/chat/completions”) {
const url = 'https://multillm.ai-pro.org/api/openai-completion'; // ターゲットAPIアドレス
const headers = new Headers(request.headers);

// 添加或修改需要的 headers
headers.set(‘Content-Type’, ‘application/json’);

// 获取请求的 body 并解析 JSON
const requestBody = await request.json();
const stream = requestBody.stream; // ストリーム引数の取得

// 构造新的请求
const newRequest = new Request(url, {
method: ‘POST’,
headers: headers,
body: JSON.stringify(requestBody) // 変更されたボディを使用する
});

try {
// 向目标 API 发送请求
const response = await fetch(newRequest);

// 根据 stream 参数确定响应类型
if (stream) {
const originalJson = await response.json(); // 一度に完全なデータを読み込む
// 创建一个可读流
const readableStream = new ReadableStream({
start(controller) {
// 发送开始数据
const startData = createDataChunk(originalJson, “start”);
controller.enqueue(new TextEncoder().encode(‘data: ‘ + JSON.stringify(startData) + ‘\n\n’));

// 假设根据 originalJson 处理并发送多个数据块
// 例如,模拟分批次发送数据
const content = originalJson.choices[0].message.content; // これが送信するコンテンツであると仮定する。
const newData = createDataChunk(originalJson, “data”, content);
controller.enqueue(new TextEncoder().encode(‘data: ‘ + JSON.stringify(newData) + ‘\n\n’));

// 发送结束数据
const endData = createDataChunk(originalJson, “end”);
controller.enqueue(new TextEncoder().encode(‘data: ‘ + JSON.stringify(endData) + ‘\n\n’));

controller.enqueue(new TextEncoder().encode(‘data: [DONE]’));
// 标记流的结束
controller.close();
}
});
return new Response(readableStream, {
headers: {
‘Access-Control-Allow-Origin’: ‘*’,
“Access-Control-Allow-Headers”: ‘*’,
‘Content-Type’: ‘text/event-stream’,
‘Cache-Control’: ‘no-cache’,
‘Connection’: ‘keep-alive’
}
});
} else {
// 正常返回响应
return new Response(response.body, {
status: response.status,
headers: response.headers
});
}
} catch (e) {
// 如果请求失败,返回错误信息
return new Response(JSON.stringify({ error: ‘Unable to reach the backend API’ }), { status: 502 });
}
} else {
// 如果请求方法不是 POST 或路径不正确,返回错误
return new Response(‘Not found’, { status: 404 });
}
}

// 根据类型创建不同的数据块
function createDataChunk(json, type, content = {}) {
switch (type) {
case “start”:
return {
id: json.id,
object: “chat.completion.chunk”,
created: json.created,
model: json.model,
choices: [{ delta: {}, index: 0, finish_reason: null }]
};
case “data”:
return {
id: json.id,
object: “chat.completion.chunk”,
created: json.created,
model: json.model,
choices: [{ delta: { content }, index: 0, finish_reason: null }]
};
case “end”:
return {
id: json.id,
object: “chat.completion.chunk”,
created: json.created,
model: json.model,
choices: [{ delta: {}, index: 0, finish_reason: ‘stop’ }]
};
default:
return {};
}
}

0ブックマークに登録
0表彰される

おすすめ

AIツールが見つからない?こちらをお試しください!

キーワードを入力する アクセシビリティこのサイトのAIツールセクションは、このサイトにあるすべてのAIツールを素早く簡単に見つける方法です。

トップに戻る