Skip to content

[ Patch}: Add Z.ai provider with GLM-4.7 and GLM-4.5-Air models #43

@liveisgood

Description

@liveisgood

Summary
Add Z.ai as a new provider with Anthropic-compatible GLM models (GLM-4.7 and GLM-4.5-Air).
What This Does

  • Adds "zai" as a new ProviderId in type definitions
  • Adds ZAI_API_KEY environment variable mapping
  • Adds Z.ai provider to the model configuration
  • Adds two GLM models to AVAILABLE_MODELS:
    • GLM-4.7 (Sonnet equivalent) - Flagship model
    • GLM-4.5-Air (Haiku equivalent) - Fast, cost-effective
  • Updates runtime to handle Z.ai models with custom API endpoint
  • Adds Z.ai icon and fallback provider to UI

How to Test

  1. Add Z.ai API key in Settings
  2. Select GLM-4.7 or GLM-4.5-Air model
  3. Test with a simple prompt
    Technical Details
  • Uses @langchain/anthropic ChatAnthropic with custom anthropicApiUrl
  • Endpoint: https://api.z.ai/api/anthropic
  • Follows existing provider/model patterns in the codebase
  • No breaking changes to existing functionality
    **

zai-integration.patch

**

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions