Skip to content

feat: Add support for GLM #1900

@mylvghb

Description

@mylvghb

Model Provider Integration Request

GLM (Zhipu AI) is a leading large language model provider offering a series of models based on the GLM (General Language Model) architecture. It provides an OpenAI-compatible API format, making integration straightforward. Both domestic (China) and international endpoints are available.

Models

Model Description
glm-4 Flagship model with complex reasoning, multi-turn dialogue, and tool calling
glm-4-air Cost-effective version suitable for most applications
glm-4-flash Ultra-fast response version for simple tasks
glm-4v Multimodal model supporting image understanding
glm-3-turbo Lightweight model for low-latency scenarios

Key Features

  • OpenAI-compatible API: RESTful API with OpenAI-compatible request/response format
  • Tool Calling (Function Calling): Supports structured tool/function invocation
  • Streaming: Supports SSE streaming output
  • Multimodal: GLM-4V supports image inputs alongside text

Resources

Domestic (China)

International (Global)

  • Official Site: https://z.ai
  • API Docs: https://docs.z.ai
  • Base URL: https://api.z.ai/api/paas/v4/
  • Authentication: API Key-based via Authorization: Bearer {api_key} header

Integration Notes

Since Zhipu AI provides an OpenAI-compatible API, the existing OpenAI provider implementation could potentially be reused with the following adjustments:

  1. Allow custom base_url pointing to the domestic (open.bigmodel.cn) or international (api.z.ai) endpoint
  2. Add GLM-specific model name mappings
  3. Handle any minor API differences between domestic and international versions (e.g., specific parameter support, rate limits)

Checklist

  • I have checked that this provider is not already supported
  • I have reviewed the existing provider implementations for reference

Metadata

Metadata

Assignees

No one assigned

    Labels

    featmodelRelevant to new model providers or implementations

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions