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.
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
Edit opencode.json and add this: