Skip to content

Add TypeScript clients for GLM4.7 and Qwen3 models#44

Merged
hiyouga merged 7 commits intomainfrom
copilot/add-typescript-client
Jan 22, 2026
Merged

Add TypeScript clients for GLM4.7 and Qwen3 models#44
hiyouga merged 7 commits intomainfrom
copilot/add-typescript-client

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 22, 2026

Ports GLM4.7 and Qwen3 client implementations from Python to TypeScript.

Implementation

  • New clients (src_ts/src/glm4_7/, src_ts/src/qwen3/)

    • Both use OpenAI-compatible API via OpenAI SDK
    • GLM4.7: Supports thinking configuration, tool streaming via extra_body
    • Qwen3: Handles two tool call formats (streamed JSON and delta-based)
  • AutoClient routing (src_ts/src/autoClient.ts)

    • Added client detection for glm-4.7 and qwen3 model identifiers
    • Removed placeholder error messages
  • Test integration (src_ts/tests/client.test.ts)

    • Models auto-included when GLM_API_KEY environment variable is set for direct GLM4.7 testing
    • Added OpenRouter support: z-ai/glm-4.7 and qwen/qwen3-30b-a3b-thinking-2507 when OPENROUTER_API_KEY is set
    • Added SiliconFlow support: Pro/zai-org/GLM-4.7 and Qwen/Qwen3-8B when SILICONFLOW_API_KEY is set
    • Test structure matches Python implementation with automatic API key and base URL selection
    • Separated text-only models from vision models

Example Usage

import { AutoLLMClient } from "agenthub-typescript";

// Direct usage with native API
const glmClient = new AutoLLMClient("glm-4.7");

// OpenRouter usage
const openrouterClient = new AutoLLMClient(
  "z-ai/glm-4.7",
  process.env.OPENROUTER_API_KEY,
  "https://openrouter.ai/api/v1"
);

// SiliconFlow usage
const siliconflowClient = new AutoLLMClient(
  "Qwen/Qwen3-8B",
  process.env.SILICONFLOW_API_KEY,
  "https://api.siliconflow.cn/v1"
);

for await (const event of glmClient.streamingResponse(messages, config)) {
  // Handle streaming events
}

Both implementations match their Python counterparts in src_py/agenthub/glm4_7/ and src_py/agenthub/qwen3/.

Original prompt

基于src_py里面python的glm4.7和Qwen3的实现,在src_ts里面添加typescript版本的client,记得更新ts的test


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits January 22, 2026 07:57
Co-authored-by: hiyouga <16256802+hiyouga@users.noreply.github.com>
… quoting

Co-authored-by: hiyouga <16256802+hiyouga@users.noreply.github.com>
Copilot AI changed the title [WIP] Add TypeScript client based on glm4.7 and Qwen3 Add TypeScript clients for GLM4.7 and Qwen3 models Jan 22, 2026
Copilot AI requested a review from hiyouga January 22, 2026 08:03
…and SiliconFlow support

Co-authored-by: hiyouga <16256802+hiyouga@users.noreply.github.com>
Copilot AI requested a review from hiyouga January 22, 2026 08:12
@hiyouga hiyouga marked this pull request as ready for review January 22, 2026 08:13
@hiyouga hiyouga merged commit 156becd into main Jan 22, 2026
1 check failed
@hiyouga hiyouga deleted the copilot/add-typescript-client branch January 22, 2026 09:07
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.

2 participants