Now Z.ai has an official solution to use the package. See below.
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: