#Z.ai coding endpoint

1 messages ยท Page 1 of 1 (latest)

night veldt
#

Problem Summary:

Issue: GLM-4.7 model not working in Clawdbot with GLM Coding Plan API key, but works in Cursor.

Root Cause:

  • User has a GLM Coding Plan subscription from Z.AI
  • GLM Coding Plan requires the coding endpoint: https://api.z.ai/api/coding/paas/v4
  • Clawdbot uses the standard endpoint: https://api.z.ai/api/paas/v4
  • When calling the standard endpoint, it returns: {"error":{"code":"1113","message":"Insufficient balance or no resource package. Please recharge."}}
  • The API key is valid โ€” direct curl test to the coding endpoint succeeds

Verification:

Required Solution:
Configure Clawdbot to use the coding endpoint (/api/coding/paas/v4) instead of the standard endpoint (/api/paas/v4) for the zai provider.

Question:
How to configure a custom base URL for the zai provider in Clawdbot?

#

@jaunty hinge

jaunty hingeBOT
#

Hey nvim.! ๐Ÿ‘‹

You can configure a custom base URL for the zai provider using the models.providers config section. Here's how:

In your Clawdbot config (YAML):

models:
  providers:
    zai:
      baseUrl: "https://api.z.ai/api/coding/paas/v4"
      api: openai-completions
      models:
        - id: glm-4.7
          name: GLM 4.7
          reasoning: false
#
          input: ["text", "image"]
          contextWindow: 128000
          maxTokens: 8192
          cost:
            input: 0.0
            output: 0.0
            cacheRead: 0.0
            cacheWrite: 0.0

Or if you want to keep using the existing zai provider for other models and add a separate "zai-coding" provider:

models:
  providers:
#
    zai-coding:
      baseUrl: "https://api.z.ai/api/coding/paas/v4"
      api: openai-completions
      apiKey: ${ZAI_API_KEY}  # or set ZAI_CODING_API_KEY in env
      models:
        - id: glm-4.7
          name: GLM 4.7 Coding
          reasoning: false
          input: ["text"]
          contextWindow: 128000
          maxTokens: 8192
          cost:
            input: 0.0
            output: 0.0
            cacheRead: 0.0
#
            cacheWrite: 0.0

Then you'd reference it as zai-coding/glm-4.7 in your model config.

Key points:

  • baseUrl is required for each provider entry
  • api: openai-completions since Z.AI uses OpenAI-compatible API
  • You'll need to specify the models array with cost/context info
  • The API key can be set via env var or directly in config