Baltor Get started

Endpoints

Z.AI

A hosted service with its own key and prices. This page lists the addresses it answers, the facts its documentation states, and the setup of each harness.

Addresses and facts

  • OpenAI Chat Completions: https://api.z.ai/api/paas/v4 models.dev, read
Authentication
Authorization: Bearer, with the key in ZHIPU_API_KEY models.dev, read
Structured output
Unknown
Tool calling
18 of 18 listed models The share of this provider's models that models.dev records with tool calling. models.dev, read
Rate limits
Unknown
Prices
Unknown
Data retention
Unknown
Documentation
Read the page models.dev, read
Output limits Baltor recorded
Unknown

Harness setup

Replace glm-4.5 with the model you want.

OpenCode

Put this in opencode.json in your project folder:

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "zai": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Z.AI",
      "options": {
        "baseURL": "https://api.z.ai/api/paas/v4",
        "apiKey": "{env:ZHIPU_API_KEY}"
      },
      "models": {
        "glm-4.5": {
          "name": "glm-4.5"
        }
      }
    }
  }
}
  • OpenCode reads any OpenAI-compatible address through the @ai-sdk/openai-compatible package, and an address that speaks the Responses API through @ai-sdk/openai.

From OpenCode documentation, read .

Pi

Put this in ~/.pi/agent/models.json:

{
  "providers": {
    "zai": {
      "baseUrl": "https://api.z.ai/api/paas/v4",
      "api": "openai-completions",
      "apiKey": "$ZHIPU_API_KEY",
      "models": [
        {
          "id": "glm-4.5"
        }
      ]
    }
  }
}
  • The apiKey field can name an environment variable as $NAME.

From Pi documentation, read .

Codex

Codex speaks only the Responses API, and Z.AI documents no Responses address. A gateway that offers one can sit in between.

  • Codex speaks the Responses API only: responses is the one supported wire API of a custom provider. Ollama and LM Studio are built in and start with --oss.

From Codex documentation, read .

Claude Code

Claude Code sends Anthropic Messages requests, and Z.AI documents no such address. A gateway that translates to that API can sit in between.

  • Claude Code sends Anthropic Messages requests to ANTHROPIC_BASE_URL. Anthropic says it does not support routing Claude Code to models other than Claude through any gateway, so some features may not work with another model.

From Claude Code documentation, read .

Models it lists

Prices in US dollars per million tokens, input and output, as models.dev, read records them.

ModelInputOutputContextAs of
GLM-4.5 glm-4.50.600 USD2.20 USD131,072 older than 30 days
GLM-4.5-Air glm-4.5-air0.200 USD1.10 USD131,072 older than 30 days
GLM-4.5-Flash glm-4.5-flash0 USD0 USD131,072 older than 30 days
GLM-4.5V glm-4.5v0.600 USD1.80 USD64,000 older than 30 days
GLM-4.6 glm-4.60.600 USD2.20 USD204,800 older than 30 days
GLM-4.6V glm-4.6v0.300 USD0.900 USD128,000 older than 30 days
GLM-4.6V-Flash glm-4.6v-flash0 USD0 USD128,000 older than 30 days
GLM-4.7 glm-4.70.600 USD2.20 USD204,800 older than 30 days
GLM-4.7-Flash glm-4.7-flash0 USD0 USD200,000 older than 30 days
GLM-4.7-FlashX glm-4.7-flashx0.070 USD0.400 USD200,000 older than 30 days
GLM-5 glm-51.00 USD3.20 USD204,800 older than 30 days
GLM-5-Turbo glm-5-turbo1.20 USD4.00 USD200,000 older than 30 days
GLM-5.1 glm-5.11.40 USD4.40 USD200,000 older than 30 days
GLM-5.2 glm-5.21.40 USD4.40 USD1,000,000 older than 30 days
GLM-5.3 glm-5.31.40 USD4.40 USD1,000,000 older than 30 days
GLM-5.3-Flash glm-5.3-flash0.150 USD0.500 USD1,000,000
GLM-5.3-FlashX glm-5.3-flashx0.370 USD1.25 USD1,000,000
GLM-5V-Turbo glm-5v-turbo1.20 USD4.00 USD200,000 older than 30 days

Sources of this page