OpenCode
GreenPT is a built-in OpenCode provider. Sign in with opencode auth login and pick a model, no provider block required.
OpenCode is an open-source, terminal-native coding agent. GreenPT is one of its built-in providers, so the base URL, the adapter and the model list all ship with OpenCode. You sign in once and pick a model.
No config file needed
Earlier versions of this guide had you write a provider block into
opencode.json. That is no longer necessary, and a hand-written block will
shadow the built-in one. Delete any provider.greenpt entry you added
previously.
Prerequisites
- OpenCode installed (opencode.ai/docs)
- A GreenPT API key: manage API keys
1. Sign in to GreenPT
opencode auth loginChoose GreenPT from the provider list, then paste your key. OpenCode writes
it to ~/.local/share/opencode/auth.json. Inside a running session the same
flow is the /connect command.
Prefer not to store the key on disk? Export it instead and skip this step:
export GREENPT_API_KEY="your-greenpt-key"2. Pick a model
opencode # then run /models and choose a GreenPT modelEvery GreenPT model appears under the GreenPT provider, referenced as
greenpt/<model-id>. To see the list without starting a session:
opencode models greenptRecommended models
glm-5.2z.aiFlagshipNewGreenPT Code flagship coding model with strong reasoning, agentic tool-use, and multi-file software engineering performance. See the GreenPT Code guide for IDE setup. Also available as output-compression variants (glm-5.2-caveman, -honey, -ponytail) at the same price.
Use it for: The default. Agentic, multi-file work across a large codebase.
kimi-k3Moonshot AINewMoonshot Kimi K3, an open-weight 2.8T-parameter native multimodal agentic model with hybrid reasoning for long-horizon coding, knowledge work, and reasoning.
Use it for: The hardest refactors and long-horizon agent runs.
deepseek-v4-flash-0731DeepSeekNewDeepSeek V4 Flash, 2026-07-31 snapshot. A fast, low-cost reasoning model with a 1M-token context window and tool use. Reasoning is always on, so allow enough output budget for it.
Use it for: Routine edits and test runs, at a fraction of the cost.
The picker holds the rest of the catalogue too. See Model Cards for every model and its price.
3. Pin a default (optional)
To fix one model for a repository, add an opencode.json in its root. This is
the only config GreenPT needs, and it is entirely optional:
{
"$schema": "https://opencode.ai/config.json",
"model": "greenpt/glm-5.2"
}The same key works in the global config at
~/.config/opencode/opencode.json; a project file overrides it.
Verify the connection
A quick sanity check outside of OpenCode:
curl https://api.greenpt.ai/v1/models \
-H "Authorization: Bearer $GREENPT_API_KEY"You should get back a list including glm-5.2. If this fails, fix the API key
before troubleshooting inside OpenCode.
Troubleshooting
| Symptom | Fix |
|---|---|
GreenPT is missing from opencode auth login | Update OpenCode. The provider list comes from models.dev, which older builds cache |
No GreenPT models under /models | You are signed out. Run opencode auth login, or set GREENPT_API_KEY in the shell OpenCode launches from |
| Authentication failed | The key is wrong or belongs to another environment. Test it with the curl command above |
| A stale model is offered | Your build's model list is behind ours. opencode models greenpt shows what OpenCode knows; /v1/models is the live truth |
| Config changes not applying | A project opencode.json overrides the global one. Check for a competing file in the repo root |