Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AI服务API对比 #474

Open
alanhe421 opened this issue Jun 14, 2023 · 4 comments
Open

AI服务API对比 #474

alanhe421 opened this issue Jun 14, 2023 · 4 comments

Comments

@alanhe421
Copy link
Owner

alanhe421 commented Jun 14, 2023

百度文心一言

虽然垃圾,但也有一定市场

https://cloud.baidu.com/doc/WENXINWORKSHOP/s/flfmc9do2

image

curl https://aip.baidubce.com/oauth/2.0/token?grant_type=client_credentials&client_id=【API Key】&client_secret=【Secret Key】

https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/eb-instant

curl -XPOST https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/completions?access_token={access_token} -d '{
   "messages": [
    {"role":"user","content":"介绍一下你自己"}
   ]
}'
@alanhe421
Copy link
Owner Author

alanhe421 commented Jun 14, 2023

@alanhe421
Copy link
Owner Author

OpenAI

curl https://api.openai.com/v1/engines/davinci-codex/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_OPENAI_API_KEY" \
-d '{
  "prompt": "Translate the following English text to French: '{}'",
  "max_tokens": 60
}'

@alanhe421
Copy link
Owner Author

alanhe421 commented Jun 15, 2023

ChatGLM

https://github.com/THUDM/ChatGLM-6B/tree/main#api%E9%83%A8%E7%BD%B2

curl -X POST "http://127.0.0.1:8000" \
     -H 'Content-Type: application/json' \
     -d '{"prompt": "你好", "history": []}'

@alanhe421
Copy link
Owner Author

alanhe421 commented Nov 20, 2023

通义千问

https://help.aliyun.com/zh/dashscope/developer-reference/api-details?spm=a2c4g.11186623.0.i0#341800c0f8w0r

import fetch from 'node-fetch';

fetch('https://dashscope.aliyuncs.com/api/v1/services/aigc/text-generation/generation', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer xxxxx',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    model: 'qwen-turbo',
    input: {
      messages: [
        {
          "role": "system",
          "content": "你是WebShell AI助手."
        },
        {
          "role": "user",
          "content": "如何安装szrz?"
        }
      ]
    },
    parameters: {
      result_format: 'message'
    }
  })
})
  .then(res=>res.json()).then(res => {
    return res.output.choices[0].message;
  }).then(console.log)
  .catch(console.error);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant