Skip to content

Instantly share code, notes, and snippets.

@olafgeibig
Last active September 5, 2025 16:00
Show Gist options
  • Save olafgeibig/925ed73f10a5b99d891c0185580f4e42 to your computer and use it in GitHub Desktop.
Save olafgeibig/925ed73f10a5b99d891c0185580f4e42 to your computer and use it in GitHub Desktop.
Z.ai subscription with opencode

Z.ai subscription with opencode

I do not guarantee that this is actually billed on your subscription inclusive volume and not as API consumption. Since Z.ai has no near realtime API usage information, I could not check it. Update: after 2 days of using it, no extra money was decucted from my credits. Guess tht means it works.

Create a custom provider

First we need to create a custom provider for the Z.ai anthropic API. Follow the instructions for adding a custom provider to opencode.

  • Name it zai-anthropic
  • Enter your API-key

Configure the custom-provider

Edit opencode.json and add this:

    "provider": {
        "zai-anthropic": {
            "npm": "@ai-sdk/anthropic",
            "options": {
                "baseURL": "https://api.z.ai/api/anthropic/v1"
            },
            "models": {
                "glm-4.5": {
                    "name": "glm-4.5"
                }
            }
        }

Make this model default if you wish:

    "model": "zai-anthropic/glm-4.5",
@konstantinosbotonakis
Copy link

@olafgeibig today I reached the limit of 190 requests and 9000000 tokens. And I have -0.08 cents on my account. So the counting system is a little different than I thought. In three days I have 1333 requests 73 million tokens

are you working on anything and using so many tokens / requests or are you just trying to see the limit of the service?

@iFedyna
Copy link

iFedyna commented Sep 5, 2025

@konstantinosbotonakis creating projects. Calculating just for myself to see which plan suits me best for my tasks. For example, Rovo Dev CLI give 20 million per day without restrictions on requests to choose from two models Sonnet 4 and GPT5. Price 7.53 usd. I also use it to see who can handle which tasks and how.

@nathabonfim59
Copy link

@nathabonfim59 nice, but what is your use case for the air model? Faster sub-agents?

Mostly /compact and I have an agent to fetch parts of the documentation and feed back to the main one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment