feat: support zhipuai client (#491)

pull/493/head
sigoden 4 weeks ago committed by GitHub
parent 0071d84aa5
commit 956a960390
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -63,6 +63,7 @@ OPENAI_COMPATIBLE_PLATFORMS=( \
octoai,meta-llama-3-8b-instruct,https://text.octoai.run/v1 \ octoai,meta-llama-3-8b-instruct,https://text.octoai.run/v1 \
perplexity,llama-3-8b-instruct,https://api.perplexity.ai \ perplexity,llama-3-8b-instruct,https://api.perplexity.ai \
together,meta-llama/Llama-3-8b-chat-hf,https://api.together.xyz/v1 \ together,meta-llama/Llama-3-8b-chat-hf,https://api.together.xyz/v1 \
zhipuai,glm-4,https://open.bigmodel.cn/api/paas/v4 \
) )
# @cmd Chat with any LLM api # @cmd Chat with any LLM api

@ -115,8 +115,8 @@ clients:
# See https://cloud.google.com/vertex-ai # See https://cloud.google.com/vertex-ai
- type: vertexai - type: vertexai
project_id: xxx # ENV: {client}_PROJECT_ID project_id: xxx # ENV: {client}_PROJECT_ID
location: xxx # ENV: {client}_LOCATION location: xxx # ENV: {client}_LOCATION
# Specifies a application-default-credentials (adc) file, Optional field # Specifies a application-default-credentials (adc) file, Optional field
# Run `gcloud auth application-default login` to init the adc file # Run `gcloud auth application-default login` to init the adc file
# see https://cloud.google.com/docs/authentication/external/set-up-adc # see https://cloud.google.com/docs/authentication/external/set-up-adc
@ -133,8 +133,8 @@ clients:
# See https://cloud.google.com/vertex-ai/generative-ai/docs/partner-models/use-claude # See https://cloud.google.com/vertex-ai/generative-ai/docs/partner-models/use-claude
- type: vertexai-claude - type: vertexai-claude
project_id: xxx # ENV: {client}_PROJECT_ID project_id: xxx # ENV: {client}_PROJECT_ID
location: xxx # ENV: {client}_LOCATION location: xxx # ENV: {client}_LOCATION
# Specifies a application-default-credentials (adc) file, Optional field # Specifies a application-default-credentials (adc) file, Optional field
# Run `gcloud auth application-default login` to init the adc file # Run `gcloud auth application-default login` to init the adc file
# see https://cloud.google.com/docs/authentication/external/set-up-adc # see https://cloud.google.com/docs/authentication/external/set-up-adc
@ -142,9 +142,9 @@ clients:
# See https://docs.aws.amazon.com/bedrock/latest/userguide/ # See https://docs.aws.amazon.com/bedrock/latest/userguide/
- type: bedrock - type: bedrock
access_key_id: xxx # ENV: {client}_ACCESS_KEY_ID access_key_id: xxx # ENV: {client}_ACCESS_KEY_ID
secret_access_key: xxx # ENV: {client}_SECRET_ACCESS_KEY secret_access_key: xxx # ENV: {client}_SECRET_ACCESS_KEY
region: xxx # ENV: {client}_REGION region: xxx # ENV: {client}_REGION
# See https://developers.cloudflare.com/workers-ai/ # See https://developers.cloudflare.com/workers-ai/
- type: cloudflare - type: cloudflare
@ -157,23 +157,28 @@ clients:
# See https://cloud.baidu.com/doc/WENXINWORKSHOP/index.html # See https://cloud.baidu.com/doc/WENXINWORKSHOP/index.html
- type: ernie - type: ernie
api_key: xxx # ENV: {client}_API_KEY api_key: xxx # ENV: {client}_API_KEY
secret_key: xxxx # ENV: {client}_SECRET_KEY secret_key: xxxx # ENV: {client}_SECRET_KEY
# See https://help.aliyun.com/zh/dashscope/ # See https://help.aliyun.com/zh/dashscope/
- type: qianwen - type: qianwen
api_key: sk-xxx # ENV: {client}_API_KEY api_key: sk-xxx # ENV: {client}_API_KEY
# See https://platform.moonshot.cn/docs/intro # See https://platform.moonshot.cn/docs/intro
- type: openai-compatible - type: openai-compatible
name: moonshot name: moonshot
api_base: https://api.moonshot.cn/v1 api_base: https://api.moonshot.cn/v1
api_key: sk-xxx # ENV: {client}_API_KEY api_key: sk-xxx # ENV: {client}_API_KEY
# See https://platform.deepseek.com/api-docs/ # See https://platform.deepseek.com/api-docs/
- type: openai-compatible - type: openai-compatible
name: deepseek name: deepseek
api_key: sk-xxx # ENV: {client}_API_KEY api_key: sk-xxx # ENV: {client}_API_KEY
# See https://open.bigmodel.cn/dev/howuse/introduction
- type: openai-compatible
name: zhipuai
api_key: xxx # ENV: {client}_API_KEY
# See https://docs.endpoints.anyscale.com/ # See https://docs.endpoints.anyscale.com/
- type: openai-compatible - type: openai-compatible

@ -461,9 +461,9 @@
output_price: 8.4 output_price: 8.4
- platform: deepseek - platform: deepseek
docs: # docs:
- https://platform.deepseek.com/api-docs/ # - https://platform.deepseek.com/api-docs/
- https://platform.deepseek.com/api-docs/pricing # - https://platform.deepseek.com/api-docs/pricing
models: models:
- name: deepseek-chat - name: deepseek-chat
max_input_tokens: 32768 max_input_tokens: 32768
@ -474,6 +474,24 @@
input_price: 0.14 input_price: 0.14
output_price: 0.28 output_price: 0.28
- platform: zhipuai
# docs:
# - https://open.bigmodel.cn/dev/howuse/model
# - https://open.bigmodel.cn/pricing
models:
- name: glm-4
max_input_tokens: 128000
input_price: 14
output_price: 14
- name: glm-4v
max_input_tokens: 2048
input_price: 14
output_price: 14
- name: glm-3-turbo
max_input_tokens: 128000
input_price: 0.7
output_price: 0.7
- platform: anyscale - platform: anyscale
# docs: # docs:
# - https://docs.endpoints.anyscale.com/text-generation/query-a-model/#select-a-model # - https://docs.endpoints.anyscale.com/text-generation/query-a-model/#select-a-model

@ -45,7 +45,7 @@ register_client!(
(qianwen, "qianwen", QianwenConfig, QianwenClient), (qianwen, "qianwen", QianwenConfig, QianwenClient),
); );
pub const OPENAI_COMPATIBLE_PLATFORMS: [(&str, &str); 11] = [ pub const OPENAI_COMPATIBLE_PLATFORMS: [(&str, &str); 12] = [
("anyscale", "https://api.endpoints.anyscale.com/v1"), ("anyscale", "https://api.endpoints.anyscale.com/v1"),
("deepinfra", "https://api.deepinfra.com/v1/openai"), ("deepinfra", "https://api.deepinfra.com/v1/openai"),
("deepseek", "https://api.deepseek.com"), ("deepseek", "https://api.deepseek.com"),
@ -57,4 +57,5 @@ pub const OPENAI_COMPATIBLE_PLATFORMS: [(&str, &str); 11] = [
("octoai", "https://text.octoai.run/v1"), ("octoai", "https://text.octoai.run/v1"),
("perplexity", "https://api.perplexity.ai"), ("perplexity", "https://api.perplexity.ai"),
("together", "https://api.together.xyz/v1"), ("together", "https://api.together.xyz/v1"),
("zhipuai", "https://open.bigmodel.cn/api/paas/v4"),
]; ];

Loading…
Cancel
Save