国内可访问国外大模型api服务的代理服务地址及代码

代码语言:html

所属分类:其他

代码描述:国内可访问国外大模型api服务的代理服务地址及代码,支持OpenAI Gemini Groq Claude Cohere xAI Mistral GithubAI,有详细的curl示例代码,这些大模型由于屏蔽了国内的ip,所以只能通过在国外搭建的免费的代理服务才能使用。

代码标签: 国内 访问 国外 大模型 api 服务 代理 服务 地址 代码

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<html lang="zh-CN"><head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
<link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/prism.css">
    <style>
        :root {
            --primary-color: #2563eb;
            --secondary-color: #1e40af;
            --background-color: #f8fafc;
            --card-background: #ffffff;
            --text-color: #1f2937;
            --code-background: #f1f5f9;
        }

        body {
            font-family: system-ui, -apple-system, sans-serif;
            background-color: var(--background-color);
            margin: 0;
            padding: 20px;
            color: var(--text-color);
            line-height: 1.6;
        }

        .container {
            max-width: 1000px;
            margin: auto;
            padding: 20px;
        }

        .header {
            text-align: center;
            margin-bottom: 40px;
            padding: 40px 0;
            background-color: var(--card-background);
            border-radius: 16px;
            box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
        }

        .header h1 {
            margin: 0;
            color: var(--primary-color);
            font-size: 2.5rem;
        }

        .header p {
            color: #64748b;
            margin-top: 10px;
            font-size: 1.1rem;
        }

        .api-section {
            background-color: var(--card-background);
            border-radius: 12px;
            margin-bottom: 20px;
            box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
            overflow: hidden;
        }

        .api-header {
            padding: 15px 20px;
            background-color: var(--primary-color);
            color: white;
            cursor: pointer;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .api-header:hover {
            background-color: var(--secondary-color);
        }

        .api-content {
            padding: 20px;
            display: none;
        }

        .api-content.active {
            display: block;
        }

        .code-block {
            background-color: var(--code-background);
            border-radius: 8px;
            padding: 15px;
            margin: 10px 0;
            position: relative;
        }

        .copy-button {
            position: absolute;
            top: 10px;
            right: 10px;
            background-color: var(--primary-color);
            color: white;
            border: none;
            border-radius: 4px;
            padding: 5px 10px;
            cursor: pointer;
            font-size: 0.875rem;
        }

        .copy-button:hover {
            background-color: var(--secondary-color);
        }

        .api-list {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
            gap: 20px;
            margin: 20px 0;
        }

        .api-card {
            background-color: var(--card-background);
            padding: 20px;
            border-radius: 8px;
            box-shadow: 0 2px 4px rgb(0 0 0 / 0.1);
        }

        .badge {
            display: inline-block;
            padding: 4px 8px;
            background-color: #e2e8f0;
            border-radius: 4px;
            font-size: 0.875rem;
            margin-right: 5px;
            margin-bottom: 5px;
        }

        .endpoint-url {
            font-weight: bold;
            color: var(--primary-color);
        }

        @media (max-width: 768px) {
            .container {
                padding: 10px;
            }
            
            .header {
                padding: 20px 0;
            }
            
            .header h1 {
                font-size: 2rem;
            }
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="header">
            <h1>国外大模型api国内调用代理地址</h1>
            <p>支持多种AI模型API的统一接入服务</p>
        </div>

        <div class="api-list">
            <div class="api-card">
                <h3>支持的API服务</h3>
                <span class="badge">OpenAI</span>
                <span class="badge">Gemini</span>
                <span class="badge">Groq</span>
                <span class="badge">Claude</span>
                <span class="badge">Cohere</span>
                <span class="badge">xAI</span>
                <span class="badge">Mistral</span>
                <span class="badge">GithubAI</span>
            </div>
            <div class="api-card">
                <h3>部署区域</h3>
                <span class="badge">ICN1 (首尔)</span>
            </div>
        </div>

        <div class="api-section">
            <div class="api-header" onclick="toggleSection('openai')">
                <h2>OpenAI API</h2>
                <span>▲</span>
            </div>
            <div class="api-content active" id="openai">
                <p>OpenAI API支持访问 <a href="https://platform.openai.com/docs/guides/text-generation" target="_blank">GPT</a> 模型。</p>
                <h4>基础URL</h4>
                <div class="code-block">
                    <button class="copy-button" onclick="copyCode(this)">复制</button>
                    <code class="endpoint-url">https://docx.vercel.app/openai/v1/</code>
                </div>
                <h4>示例代码</h4>
                <div class="code-block">
                    <button class="copy-button" onclick="copyCode(this)">复制</button>
                    <pre>curl https://docx.vercel.app/openai/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -d '{
    "model": "gpt-4o-2024-08-06",
    "messages": [{"role": "user", "content": "Hello!"}]
  }'</pre>
                </div>
            </div>
        </div>

        <div class="api-section">
            <div class="api-header" onclick="toggleSection('gemini')">
                <h2>Google Gemini API</h2>
                <span>▲</span>
            </div>
            <div class="api-content active" id="gemini">
                <p>支持访问Google的 <a href="https://developers.googleblog.com/en/gemini-is-now-accessible-from-the-openai-library/" target="_blank">Gemini</a> 模型。使用方式与原生API完全一致。</p>
                <h4>基础URL</h4>
                <div class="code-block">
                    <button class="copy-button" onclick="copyCode(this)">复制</button>
                    <code class="endpoint-url">https://docx.vercel.app/gemini/v1beta/</code>
                </div>
                <div class="code-block">
                    <button class="copy-button" onclick="copyCode(this)">复制</button>
                    <pre>curl https://docx.vercel.app/gemini/v1beta/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $GEMINI_API_KEY" \
  -d '{
    "model": "gemini-exp-1114",
    "messages": [
        {"role": "user", "content": "Explain to me how AI works"}
    ]
  }'</pre>
                </div>
            </div>
        </div>

        <div class="api-section">
            <div class="api-header" onclick="toggleSection('claude')">
                <h2>Anthropic Claude API</h2>
                <span>▼</span>
            </div>
            <div class="api-content" id="claude">
                <p>支持访问 <a href="https://docs.anthropic.com/zh-CN/api/getting-started" target="_blank">Claude</a> 系列模型。</p>
                <h4>基础URL</h4>
                <div class="code-block">
                    <button class="copy-button" onclick="copyCode(this)">复制</button>
                    <code class="endpoint-url">https://docx.vercel.app/claude/v1/</code>
                </div>
                <div class="code-block">
                    <button class="copy-button" onclick="copyCode(this)">复制</button>
                    <pre>curl https://docx.vercel.app/claude/v1/messages \
  -H "Content-Type: application/json" \
  -H "x-api-key: $ANTHROPIC_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -d '{
    "model": "claude-3-5-sonnet-20241022",
    "max_tokens": 1024,
    "messages": [{"role": "user", "content": "Hello!"}]
  }'</pre>
                </div>
            </div>
        </div>

        <div class="api-section">
          .........完整代码请登录后点击上方下载按钮下载查看

网友评论0