移动 > 腾讯 > 微信

一个API接口对接ChatGPT3.5/4.0,Claude3,文心一言,通义千问,智谱AI等多款AI模型,打造属于自己的AI应用

67人参与 2024-08-04 微信

今天我要给大家介绍团队的最新项目——一个集成了chatgpt-3.5/4.0claude3文心一言通义千问智谱ai等多个ai模型的api模型聚合平台。仅需使用一个接口就可以对接所有ai模型

网址:https://api.atalk-ai.com/

在这里插入图片描述

为什么要创建这个平台?

随着不同的ai模型陆续问世,每个模型都有其独特的优势和用途。但是,要同时与多个模型交互通常需要切换不同的平台和接口,这不仅耗时而且效率低下。

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

支持的模型

海鲸ai支持的ai模型覆盖了当前市场上的多个主流选项,包括但不限于:

品牌模型
chatgptgpt-3.5-turbo,gpt-4-turbo,gpt-4-turbo-2024-04-09,gpt-4-1106-preview,gpt-4-vision-preview
claude 3claude-3-sonnet-20240229,claude-3-opus-20240229,claude-3-haiku-20240307
文心一言ernie-3.5-8k
通义千问qwen-turbo,qwen-plus,qwen-max
智谱aiglm-3-turbo,glm-4,glm-4v

调用方式

1、获取apikey

可通过登录api聚合平台获取apikey,登录后可获取5元的体验券,来调用api
在这里插入图片描述

2、查看api文档,并进行接口调用

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

在这里插入图片描述

3、各个语言的调用示例

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();

python3

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"))

nodejs

const axios = require('axios').default;

const options = {
  method: 'post',
  url: 'https://api.atalk-ai.com/gpt/completions',
  headers: {authorization: '', 'content-type': 'application/json'},
  data: {
    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
  }
};

try {
  const { data } = await axios.request(options);
  console.log(data);
} catch (error) {
  console.error(error);
}

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技术的不断进步,海鲸ai将成为您实现创意和解决问题的得力助手。

(0)

您想发表意见!!点此发布评论

推荐阅读

文心一言、Kimi等4款AI大模型测评对比及推荐(AI大模型训练)

08-04

淘宝能用微信零钱支付吗?怎么设置?

08-04

微信收藏怎么设置密码?如何加密隐藏?

08-05

微信视频号开店需要多少钱?条件有哪些?

08-05

开封在线教育系统官网首页,互联网在线教育用户运营如何进行?

08-06

小程序配置服务器域名的详细步骤与例子

08-03

猜你喜欢

版权声明:本文内容由互联网用户贡献,该文观点仅代表作者本人。本站仅提供信息存储服务,不拥有所有权,不承担相关法律责任。 如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 2386932994@qq.com 举报,一经查实将立刻删除。

发表评论