AIパーソナル・ラーニング
と実践的なガイダンス
資源推薦1

denoのセキュアなプロキシAPIをあらゆる大規模モデルに使用し、実際のIPやドメイン情報の漏洩を回避する。

特定の地域の問題を解決するために直接api.openai.comなどのビッグモデルのAPIを要求することはできません、またはエージェントは、CFプロキシを使用する前に、アカウントのブロックにつながる情報をリークするため、あなたのIPをリークする可能性があり、今より安全なソリューションがあります。

1.まずdeno公式サイトにアクセスし、アカウントを登録する。


2.プロジェクトの作成

https://dash.deno.com/account/projects、"New Playground "をクリック。

Denoを使用して、あらゆる大規模モデルのAPIをプロキシし、-1を通じて実際のIPブロッキングの漏洩を回避する。

 

3.コードを貼り付けて保存する

import { serve } from "https://deno.land/std/http/server.ts";

const apiMapping = {
'/discord': 'https://discord.com/api',
'/telegram': 'https://api.telegram.org',
'/openai': 'https://api.openai.com',
'/claude': 'https://api.anthropic.com',
'/gemini': 'https://generativelanguage.googleapis.com',
'/meta': 'https://www.meta.ai/api',
'/groq': 'https://api.groq.com/openai',
'/xai': 'https://api.x.ai',
'/cohere': 'https://api.cohere.ai',
'/huggingface': 'https://api-inference.huggingface.co',
'/together': 'https://api.together.xyz',
'/novita': 'https://api.novita.ai',
'/portkey': 'https://api.portkey.ai',
'/fireworks': 'https://api.fireworks.ai',
'/openrouter': 'https://openrouter.ai/api'
};

serve(async (request) => {
const url = new URL(request.url);
const pathname = url.pathname;

if (pathname === '/' || pathname === '/index.html') {
return new Response('Service is running!', {
status: 200,
headers: { 'Content-Type': 'text/html' }
});
} 

if (pathname === '/robots.txt') {
return new Response('User-agent: *\nDisallow: /', {
status: 200,
headers: { 'Content-Type': 'text/plain' }
});
}

const [prefix, rest] = extractPrefixAndRest(pathname, Object.keys(apiMapping));
if (!prefix) {
return new Response('Not Found', { status: 404 });
}

const targetUrl = `${apiMapping[prefix]}${rest}`;

try {
const headers = new Headers();
const allowedHeaders = ['accept', 'content-type', 'authorization'];
for (const [key, value] of request.headers.entries()) {
if (allowedHeaders.includes(key.toLowerCase())) {
headers.set(key, value);
}
}

const response = await fetch(targetUrl, {
method: request.method,
headers: headers,
body: request.body
});

const responseHeaders = new Headers(response.headers);
responseHeaders.set('X-Content-Type-Options', 'nosniff');
responseHeaders.set('X-Frame-Options', 'DENY');
responseHeaders.set('Referrer-Policy', 'no-referrer');

return new Response(response.body, {
status: response.status,
headers: responseHeaders
});

} catch (error) {
console.error('Failed to fetch:', error);
return new Response('Internal Server Error', { status: 500 });
}
});

function extractPrefixAndRest(pathname, prefixes) {
for (const prefix of prefixes) {
if (pathname.startsWith(prefix)) {
return [prefix, pathname.slice(prefix.length)];
}
}
return [null, null];
}

 

Denoを使用して、あらゆる大規模モデルのAPIをプロキシし、-1を通じて実際のIPブロッキングの漏洩を回避する。

 

4.使用方法

デフォルトのドメイン名は https://hungry-lamb-22.deno.dev/ です。

インタビューhttps://hungry-lamb-22.deno.dev/xai を訪れるのと同じである。 https://api.x.ai/

コードのフォーマットに従って、新しいビッグモデルのリクエストアドレスを追加することができます。

 

5.カスタムドメイン名

設定から独自ドメイン名をバインドする

実際のIPとドメイン情報の漏洩を避けるため、大規模なモデルのセキュアなプロキシAPIにはdenoを使用する-1

 

共有プロキシアドレス

チーフAIシェアリングサークルこのコンテンツは作者によって非表示にされています。コンテンツを表示するには認証コードを入力してください。
キャプチャ
このサイトWeChat公開番号に注意してください、返信"CAPTCHA、チャレンジ・レスポンス・テストの一種(コンピューティング)"、認証コードを取得します。WeChatで"チーフAIシェアリングサークル「またはルックスAI"またはWeChatは、QRコードの右側をスキャンすると、このサイトWeChatの公開番号に注意を払うことができます。

目次3
無断転載を禁じます:チーフAIシェアリングサークル " denoのセキュアなプロキシAPIをあらゆる大規模モデルに使用し、実際のIPやドメイン情報の漏洩を回避する。

チーフAIシェアリングサークル

チーフAIシェアリングサークルは、AI学習に焦点を当て、包括的なAI学習コンテンツ、AIツール、実践指導を提供しています。私たちの目標は、高品質のコンテンツと実践的な経験の共有を通じて、ユーザーがAI技術を習得し、AIの無限の可能性を一緒に探求することです。AI初心者でも上級者でも、知識を得てスキルを向上させ、イノベーションを実現するための理想的な場所です。

お問い合わせ
ja日本語