Add Qwen, Z.ai, and Claude Code providers with improved validation

Merged
HB
5mo ago
+791-20

Summary

This PR adds three new AI model providers (Qwen, Z.ai, and Claude Code) to the model picker, along with improvements to configuration validation and LM Studio model discovery.

Key Changes

New Providers

  • QwenProvider: Support for Alibaba Cloud's Qwen 3 and other DashScope models (qwen3-max, qwen3-coder-plus, qwen-plus, qwen-turbo)
  • ZaiProvider: Support for Zhipu AI's GLM models (GLM 4.6, 4.5, 4.5 Air) via the Z.ai API
  • ClaudeCodeProvider: Support for Claude models through the Claude Code CLI with subscription-based authentication (no API key required)

Configuration & Validation Improvements

  • Enhanced validateField() method to accept an optional record parameter, allowing field validators to access other form values for context-aware validation
  • Updated API key validation to only warn about key prefix format when using the default base URL (custom endpoints/proxies may use different formats)
  • Modified AddModelForm to pass form values to field validators for cross-field validation support

LM Studio Provider Enhancements

  • Improved model discovery to handle JIT-loaded models (both 'llm' and 'vlm' types)
  • Made model type validation more flexible to support future model types beyond the currently documented set
  • Changed model list parsing to skip malformed entries instead of rejecting the entire list
  • Added proper handling for empty model IDs

Icons

  • Added QwenIcon (geometric pattern)
  • Added ZaiIcon (stylized "Z" design)

Testing

  • Added comprehensive test suites for QwenProvider, ZaiProvider, and ClaudeCodeProvider
  • Added tests for LM Studio model discovery with JIT loading
  • Added validation tests for context-aware field validation with custom base URLs

Documentation & Configuration

  • Updated README to list new providers
  • Updated package.json version to 0.5.0
  • Added ai-sdk-provider-claude-code to Vite's external dependencies (dynamic peer import, never bundled)
  • Exported new providers from main library index

Notable Implementation Details

  • All new providers use dynamic imports for their dependencies to avoid unnecessary bundling
  • QwenProvider and ZaiProvider leverage the OpenAI-compatible SDK with custom base URLs
  • ClaudeCodeProvider handles authentication through the Claude Code CLI rather than API keys
  • Configuration validation now supports cross-field validation by passing the entire form record to validators

https://claude.ai/code/session_01HhfPeyDkq6rxAh87EC11HR