Skip to content

Commit

Permalink
feat: add hunyuan client (#980)
Browse files Browse the repository at this point in the history
  • Loading branch information
sigoden authored Nov 7, 2024
1 parent 45249e4 commit 58dde85
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 3 deletions.
1 change: 1 addition & 0 deletions Argcfile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ OPENAI_COMPATIBLE_PLATFORMS=( \
github,gpt-4o-mini,https://models.inference.ai.azure.com \
groq,llama3-8b-8192,https://api.groq.com/openai/v1 \
huggingface,meta-llama/Meta-Llama-3-8B-Instruct,https://api-inference.huggingface.co/v1 \
hunyuan,hunyuan-large,https://api.hunyuan.cloud.tencent.com/v1 \
lingyiwanwu,yi-large,https://api.lingyiwanwu.com/v1 \
mistral,open-mistral-nemo,https://api.mistral.ai/v1 \
moonshot,moonshot-v1-8k,https://api.moonshot.cn/v1 \
Expand Down
8 changes: 7 additions & 1 deletion config.example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -255,12 +255,18 @@ clients:
api_key: xxx
secret_key: xxx

# See https://help.aliyun.com/zh/dashscope/
# See https://dashscope.aliyun.com/
- type: openai-compatible
name: qianwen
api_base: https://dashscope.aliyuncs.com/compatible-mode/v1
api_key: xxx

# See https://cloud.tencent.com/product/hunyuan
- type: openai-compatible
name: hunyuan
api_base: https://api.hunyuan.cloud.tencent.com/v1
api_key: xxx

# See https://platform.moonshot.cn/docs/intro
- type: openai-compatible
name: moonshot
Expand Down
61 changes: 60 additions & 1 deletion models.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@
- name: text-embedding-004
type: embedding
input_price: 0
output_price: 0
max_tokens_per_chunk: 2048
default_chunk_size: 1500
max_batch_size: 100
Expand Down Expand Up @@ -811,6 +810,66 @@
default_chunk_size: 2000
max_batch_size: 25

# links:
# - https://cloud.tencent.com/document/product/1729/104753
# - https://cloud.tencent.com/document/product/1729/97731
# - https://cloud.tencent.com/document/product/1729/111007
- platform: hunyuan
models:
- name: hunyuan-turbo-latest
max_input_tokens: 28000
max_output_tokens: 4096
input_price: 2.1
output_price: 7.0
supports_function_calling: true
- name: hunyuan-pro
max_input_tokens: 28000
max_output_tokens: 4096
input_price: 4.2
output_price: 14.0
supports_function_calling: true
- name: hunyuan-large
max_input_tokens: 28000
max_output_tokens: 4096
supports_function_calling: true
- name: hunyuan-standard
max_input_tokens: 30000
max_output_tokens: 2048
input_price: 0.112
output_price: 0.28
supports_function_calling: true
- name: hunyuan-standard-256K
max_input_tokens: 250000
max_output_tokens: 6144
input_price: 0.07
output_price: 0.28
supports_function_calling: true
- name: hunyuan-lite
max_input_tokens: 250000
max_output_tokens: 6144
input_price: 0
output_price: 0
supports_function_calling: true
- name: hunyuan-functioncall
max_input_tokens: 28000
max_output_tokens: 4096
input_price: 0.56
output_price: 1.12
supports_function_calling: true
- name: hunyuan-vision
max_input_tokens: 6144
max_output_tokens: 2048
input_price: 2.52
output_price: 2.52
supports_function_calling: true
supports_vision: true
- name: hunyuan-embedding
type: embedding
input_price: 0.01
max_tokens_per_chunk: 1024
default_chunk_size: 1000
max_batch_size: 100

# Links:
# - https://platform.moonshot.cn/docs/intro
# - https://platform.moonshot.cn/docs/pricing/chat
Expand Down
3 changes: 2 additions & 1 deletion src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ register_client!(
(ernie, "ernie", ErnieConfig, ErnieClient),
);

pub const OPENAI_COMPATIBLE_PLATFORMS: [(&str, &str); 21] = [
pub const OPENAI_COMPATIBLE_PLATFORMS: [(&str, &str); 22] = [
("ai21", "https://api.ai21.com/studio/v1"),
("cloudflare", ""),
("deepinfra", "https://api.deepinfra.com/v1/openai"),
Expand All @@ -44,6 +44,7 @@ pub const OPENAI_COMPATIBLE_PLATFORMS: [(&str, &str); 21] = [
("github", "https://models.inference.ai.azure.com"),
("groq", "https://api.groq.com/openai/v1"),
("huggingface", "https://api-inference.huggingface.co/v1"),
("hunyuan", "https://api.hunyuan.cloud.tencent.com/v1"),
("lingyiwanwu", "https://api.lingyiwanwu.com/v1"),
("mistral", "https://api.mistral.ai/v1"),
("moonshot", "https://api.moonshot.cn/v1"),
Expand Down

0 comments on commit 58dde85

Please sign in to comment.