Utilice la API de proxy seguro de deno para cualquier modelo de gran tamaño con el fin de evitar la filtración de información real sobre IP y dominios.

Para resolver el problema de ciertas áreas no pueden solicitar directamente api.openai.com y así sucesivamente gran modelo de API, o porque el agente de fugas de información que conduce al bloqueo de la cuenta, antes de usar CF proxy, puede filtrar su IP, ahora hay una solución más segura.

1.En primer lugar, visita el sitio web oficial de deno para registrar una cuenta.

2. Crear un proyecto

Vaya a https://dash.deno.com/account/projects y haga clic en "New Playground".

使用deno为任意大模型安全的代理API,避免泄露真实IP和域名信息

 

3. Pegue el código y guárdelo

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,避免泄露真实IP和域名信息

 

4. Utilización

El nombre de dominio por defecto es https://hungry-lamb-22.deno.dev/

entrevistashttps://hungry-lamb-22.deno.dev/xai es lo mismo que visitar https://api.x.ai/

Siguiendo el formato del código, puede añadir una nueva dirección de solicitud de modelo grande

 

5. Nombre de dominio personalizado

Vaya a Configuración y vincule su propio nombre de dominio

使用deno为任意大模型安全的代理API,避免泄露真实IP和域名信息

 

Dirección de proxy compartida

dirección del agentedirección de origen
https://api-proxy.me/anthropichttps://api.anthropic.com
https://api-proxy.me/cerebrashttps://api.cerebras.ai
https://api-proxy.me/coherehttps://api.cohere.ai
https://api-proxy.me/discordhttps://discord.com/api
https://api-proxy.me/fireworkshttps://api.fireworks.ai
https://api-proxy.me/geminihttps://generativelanguage.googleapis.com
https://api-proxy.me/groqhttps://api.groq.com/openai
https://api-proxy.me/huggingfacehttps://api-inference.huggingface.co
https://api-proxy.me/metahttps://www.meta.ai/api
https://api-proxy.me/novitahttps://api.novita.ai
https://api-proxy.me/nvidiahttps://integrate.api.nvidia.com
https://api-proxy.me/openaihttps://api.openai.com
https://api-proxy.me/openrouterhttps://openrouter.ai/api
https://api-proxy.me/portkeyhttps://api.portkey.ai
https://api-proxy.me/telegramhttps://api.telegram.org
https://api-proxy.me/togetherhttps://api.together.xyz
https://api-proxy.me/xaihttps://api.x.ai

© declaración de copyright

Artículos relacionados

Sin comentarios

Debe iniciar sesión para participar en los comentarios.
Acceder ahora
ninguno
Sin comentarios...