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

支持豆包系列大模型API #1436

Open
5 tasks done
klb3713 opened this issue May 15, 2024 · 17 comments · May be fixed by #1438
Open
5 tasks done

支持豆包系列大模型API #1436

klb3713 opened this issue May 15, 2024 · 17 comments · May be fixed by #1438
Labels
enhancement New feature or request

Comments

@klb3713
Copy link

klb3713 commented May 15, 2024

例行检查

  • 我已确认目前没有类似 issue
  • 我已确认我已升级到最新版本
  • 我已完整查看过项目 README,已确定现有版本无法满足需求
  • 我理解并愿意跟进此 issue,协助测试和提供反馈
  • 我理解并认可上述内容,并理解项目维护者精力有限,不遵循规则的 issue 可能会被无视或直接关闭

功能描述
申请支持豆包系列大模型API
应用场景

@klb3713 klb3713 added the enhancement New feature or request label May 15, 2024
@lanyuer
Copy link

lanyuer commented May 15, 2024

+1

@RexWzh
Copy link

RexWzh commented May 15, 2024

更新:提醒下刚点进来的朋友:没必要一直发 +1 ,避免给开发者的邮箱增加无意义的邮件。

需要+1的,给仓库点个赞,在 Issue 顶部加个表情就行了

image

如果希望接收邮箱提醒可以点右边订阅

image

功能请求:增加一个允许用户提供完整链接的渠道,版本号用户自定义。

场景:

  1. 智谱,DeepSeek,豆包等渠道的默认代理地址不以 v1 结尾。

  2. OpenAI 的完整 API 地址是 https://api.openai.com/v1 来着,尾巴作为版本号。官方 SDK 也是读取环境变量 OPENAI_API_BESE ,然后拼接 URI 时不需要带 v1

@zsinba
Copy link

zsinba commented May 15, 2024

+1

3 similar comments
@webtechnic
Copy link

+1

@shengjidaguai
Copy link

+1

@TangSY
Copy link

TangSY commented May 16, 2024

+1

@klb3713 klb3713 linked a pull request May 16, 2024 that will close this issue
@fishfree
Copy link

+1

@lifei1102
Copy link

+1,豆包降价后性价比超高,pro-32k 100万token 才8毛钱

@RexWzh
Copy link

RexWzh commented May 18, 2024

话说,有用过这个 API 的可以介绍下吗?

看了文档,创建 API key 的第三步需要企业认证:

  1. API key 有效时长由duration_seconds定义,单位为秒;
  2. AK/SK 可通过API访问密钥 页面获取;
  3. Endpoint ID 可通过火山方舟 - 模型推理获取,格式为ep-xxxxxx;
  4. resource_ids 支持输入多个 Endpoint ID。

只有个人实名访问不了这里:

image

@guobaozu
Copy link

那在代码之前,豆包的这样的API调用如何才能使用?
curl https://ark.cn-beijing.volces.com/api/v3/chat/completions
-H "Content-Type: application/json"
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9"
-d '{
"model": "ep-2024051092-q5c",
"messages": [
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Hello!"
}
],
"stream": true
}'

@RexWzh
Copy link

RexWzh commented May 18, 2024

那在代码之前,豆包的这样的API调用如何才能使用? curl https://ark.cn-beijing.volces.com/api/v3/chat/completions -H "Content-Type: application/json" -H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9" -d '{ "model": "ep-2024051092-q5c", "messages": [ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Hello!" } ], "stream": true }'

这个和智谱类似,需要 API 鉴权。后缀的话可以直接配个 Nginx 转发。

server{
    listen 80;
    server_name xxx;
    location /v1 {
        proxy_pass  https://ark.cn-beijing.volces.com/api/v3;
        proxy_ssl_server_name on;
        proxy_set_header Host ark.cn-beijing.volces.com;
        proxy_set_header Connection '';
        proxy_http_version 1.1;
        chunked_transfer_encoding off;
        proxy_buffering off;
        proxy_cache off;
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

官方文档看着有点头大 🙄 ,又是 AK 又是 SK,身份认证后还要企业认证,有没弄过的可以简单介绍下(

image


翻了下文档,发现这里贴了在代码生产 API key 的方法。

HTTP 获取 API key (不推荐)
如果自己实现代码获取API key,需要用 AK/SK 进行旁路鉴权。代码逻辑可参考火山签名源码示例

Ref: Python 代码

@guobaozu
Copy link

那在代码之前,豆包的这样的API调用如何才能使用? curl https://ark.cn-beijing.volces.com/api/v3/chat/completions -H "Content-Type: application/json" -H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9" -d '{ "model": "ep-2024051092-q5c", "messages": [ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Hello!" } ], "stream": true }'

这个和智谱类似,需要 API 鉴权。后缀的话可以直接配个 Nginx 转发。

server{
    listen 80;
    server_name xxx;
    location /v1 {
        proxy_pass  https://ark.cn-beijing.volces.com/api/v3;
        proxy_ssl_server_name on;
        proxy_set_header Host ark.cn-beijing.volces.com;
        proxy_set_header Connection '';
        proxy_http_version 1.1;
        chunked_transfer_encoding off;
        proxy_buffering off;
        proxy_cache off;
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

官方文档看着有点头大 🙄 ,又是 AK 又是 SK,身份认证后还要企业认证,有没弄过的可以简单介绍下(

image

翻了下文档,发现这里贴了在代码生产 API key 的方法。

HTTP 获取 API key (不推荐)
如果自己实现代码获取API key,需要用 AK/SK 进行旁路鉴权。代码逻辑可参考火山签名源码示例

Ref: Python 代码

感谢,已经在botgem上跑通。但是我在oneapi里自定义渠道,最后渠道测试也没问题,在使用的时候补全就是返回空。。。不知道为什么?您有在正常使用这个豆包的API吗?

@zsinba
Copy link

zsinba commented May 19, 2024

能正常调用 。
需要 生成 一个 key,key 是最多 30 天有效期的。
但是合并 的代码跑第一个调用后,第二个就开始 闪退了。
具体的没有跟。

@dimsky
Copy link

dimsky commented May 20, 2024

+1

@songquanpeng
Copy link
Owner

这个肯定会支持,我尽量近期抽空处理,希望能理解最近我个人时间不多

@Lands-1203
Copy link

+1

1 similar comment
@leavegee
Copy link

+1

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

Successfully merging a pull request may close this issue.