Skip to content

Add Qwen, Zhipu, Volcengine, Baidu Qianfan, and Tencent Cloud LLM APIs - #77

Open
Wu-kong-123 wants to merge 2 commits into
Optima-CityU:mainfrom
Wu-kong-123:llm_apis
Open

Add Qwen, Zhipu, Volcengine, Baidu Qianfan, and Tencent Cloud LLM APIs#77
Wu-kong-123 wants to merge 2 commits into
Optima-CityU:mainfrom
Wu-kong-123:llm_apis

Conversation

@Wu-kong-123

Copy link
Copy Markdown
Contributor

Summary

This PR adds LLM API adapters for several common Chinese cloud platforms, so LLM4AD can use more providers beyond the original OpenAI-compatible HttpsApi.

Supported platforms added in this PR:

  • Qwen: QwenAPI
  • Zhipu AI: ZhipuAPI
  • Volcengine Ark: VolcengineAPI
  • Baidu Qianfan: BaiduQianfanAPI
  • Tencent Cloud: TencentCloudAPI

Changes

  • Added separate LLM API modules under llm4ad/tools/llm/:
    • llm_api_qwen.py
    • llm_api_zhipu.py
    • llm_api_volcengine.py
    • llm_api_baiduqianfan.py
    • llm_api_tencentcloud.py
  • Kept the external interface consistent with the existing HttpsApi style: host`, `key`, `model`, `path`, `timeout.
  • Each platform module uses its own default host and path, while keeping the request and response handling aligned with the existing OpenAI-compatible HTTPS flow.

Testing

  • Verified syntax with py_compile for the new API modules.
  • Tested selected providers through example/tasks/cvrp_construct/run_eoh.py.

Usage Example

from llm4ad.tools.llm.llm_api_qwen import QwenAPI

llm = QwenAPI(
    key='your-api-key',
    model='qwen3.7-max',
    timeout=120
)

@FeiLiu36

FeiLiu36 commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Thank you for your contribution! Could you please create some example scripts for using different APIs in https://github.com/Optima-CityU/LLM4AD/tree/main/example/llms It will be very helpful.

@FeiLiu36
FeiLiu36 requested review from Acquent0 and FeiLiu36 July 5, 2026 12:54
@Wu-kong-123

Copy link
Copy Markdown
Contributor Author

Thanks for the feedback!
I will add the example scripts for the newly supported APIs and update the PR accordingly.

@Wu-kong-123

Copy link
Copy Markdown
Contributor Author

Added example/llms/test_apis.py to demonstrate how to use the newly added API adapters. I also tested each adapter with a simple draw_sample("hello") call.

Platform API Class Model Used Result Sample Output
Qwen QwenAPI qwen-plus Passed Hello! How can I help you today? 😊
Zhipu AI ZhipuAPI GLM-5.2 Passed Hello! I'm GLM, trained by Z.ai. How can I assist you today?
Volcengine Ark VolcengineAPI doubao-seed-character-260628 Passed Hello! How can I help you today?
Baidu Qianfan BaiduQianfanAPI ernie-5.1 Passed Hello! 👋 How can I help you today?
Tencent Cloud TencentCloudAPI hy3-preview Passed Hello! 😊 How can I help you today?

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

Successfully merging this pull request may close these issues.

3 participants