Claude3 国内 API 接口对接指南
February 13th, 2025

背景概述

由于地理位置限制,Claude3 并未对国内用户开放。同时,国内镜像网站的使用成本高昂,让许多用户望而却步。为了解决这一问题,我们团队开发了一个一站式的 API 聚合平台,用户可以通过单一接口与多个主流 AI 模型进行交互,轻松比较不同模型的表现,选择最适合自己的方案。


平台特色

  • 多模型支持:集成 ChatGPT、Claude3 等多种主流 AI 模型。

  • 简化对接:提供统一接口,兼容性已优化,无需额外处理。

  • 高效便捷:用户可根据需求快速切换模型,提升使用体验。


平台展示

以下是平台的截图,展示了对 ChatGPT 和 Claude3 模型的支持:

平台截图
平台截图

API 对接教程

Python 示例

python import http.client

conn = http.client.HTTPSConnection("api.atalk-ai.com")

payload = "{\n "messages": [\n {\n "role": "system",\n "content": "You are a helpful assistant."\n },\n {\n "role": "assistant",\n "content": "can i help you ?"\n },\n {\n "role": "user",\n "content": "Hello!"\n }\n ],\n "model": "gpt-3.5-turbo",\n "max_tokens": 1000,\n "stream": true,\n "temperature": 0.2\n}"

headers = { 'Authorization': "", 'Content-Type': "application/json" }

conn.request("POST", "/gpt/completions", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8"))

Java 示例

java AsyncHttpClient client = new DefaultAsyncHttpClient();

client.prepare("POST", "https://api.atalk-ai.com/gpt/completions") .setHeader("Authorization", "") .setHeader("Content-Type", "application/json") .setBody("{\n "messages": [\n {\n "role": "system",\n "content": "You are a helpful assistant."\n },\n {\n "role": "assistant",\n "content": "can i help you ?"\n },\n {\n "role": "user",\n "content": "Hello!"\n }\n ],\n "model": "gpt-3.5-turbo",\n "max_tokens": 1000,\n "stream": true,\n "temperature": 0.2\n}") .execute() .toCompletableFuture() .thenAccept(System.out::println) .join();

client.close();

PHP 示例

php <?php $client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.atalk-ai.com/gpt/completions', [ 'body' => '{ "messages": [ { "role": "system", "content": "You are a helpful assistant." }, { "role": "assistant", "content": "can i help you ?" }, { "role": "user", "content": "Hello!" } ], "model": "gpt-3.5-turbo", "max_tokens": 1000, "stream": true, "temperature": 0.2 }', 'headers' => [ 'Authorization' => '', 'Content-Type' => 'application/json', ], ]);

echo $response->getBody();


平台价值

海鲸 AI-API 聚合平台是我们对 AI 技术的一次深度探索。它不仅简化了多模型交互的流程,还为用户提供了一个高效、便捷的解决方案。随着 AI 技术的不断发展,海鲸 AI 将成为您实现创意和解决问题的得力助手。


👉 野卡 | 一分钟注册,轻松订阅海外线上服务

Subscribe to weilai
Receive the latest updates directly to your inbox.
Mint this entry as an NFT to add it to your collection.
Verification
This entry has been permanently stored onchain and signed by its creator.
More from weilai

Skeleton

Skeleton

Skeleton