当前位置:   article > 正文

claude3国内API接口对接

claude3国内API接口对接

众所周知,由于地理位置原因,Claude3不对国内开放,而国内的镜像网站使用又贵的离谱

因此,团队萌生了一个想法:为什么不创建一个一站式的平台,让用户能够通过单一的接口与多个模型交流呢?这样,用户就可以轻松地比较不同模型的表现,并根据需要选择最合适的一个。于是诞生了这个ChatGPT,Claude3聚合API平台

API对接网站:api.atalk-ai.com/

话不多说,先上截图,可以看到不管是ChatGPT还是Claude3的模型它都支持

在这里插入图片描述

通过一个接口即可对接国际主流AI模型,兼容性这边已经帮大家处理好了,无脑对接即可 API文档地址:api.atalk-ai.com/api#/operat…

在这里插入图片描述

对接方式

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"))
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
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();
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
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();
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57

海鲸AI-API聚合平台是我们对AI技术无限探索的一次尝试。它不仅简化了与多个AI模型的交互过程,也为用户提供了一个高效、便捷的解决方案。我相信,随着AI技术的不断进步,海鲸AI将成为您实现创意和解决问题的得力助手。

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Cpp五条/article/detail/640891
推荐阅读
相关标签
  

闽ICP备14008679号