GreenPT Docs
GreenPT Code

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

1. Sign in to GreenPT

opencode auth login

Choose 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 model

Every GreenPT model appears under the GreenPT provider, referenced as greenpt/<model-id>. To see the list without starting a session:

opencode models greenpt
glm-5.3z.aiFlagship

The newest z.ai flagship reasoning model, successor to glm-5.2, with agentic tool-use at the same price.

Input€1.10
Cached input€0.275
Output€4.40
Context1M
ReleasedAug 2026
ChatReasoningTool useAgentic coding

Use it for: The default: agentic, multi-file work across a large codebase.

deepseek-v4.1-flashDeepSeek

DeepSeek V4.1 Flash, a multimodal reasoning model with a 1M-token context window for chat and agentic coding.

Input€0.22
Cached input€0.011
Output€1.10
Context1M
ReleasedSep 2026
ChatReasoningVisionLong context

Use it for: Routine edits, quick questions 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.3"
}

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.3. If this fails, fix the API key before troubleshooting inside OpenCode.

Troubleshooting

SymptomFix
GreenPT is missing from opencode auth loginUpdate OpenCode. The provider list comes from models.dev, which older builds cache
No GreenPT models under /modelsYou are signed out. Run opencode auth login, or set GREENPT_API_KEY in the shell OpenCode launches from
Authentication failedThe key is wrong or belongs to another environment. Test it with the curl command above
A stale model is offeredYour build's model list is behind ours. opencode models greenpt shows what OpenCode knows; /v1/models is the live truth
Config changes not applyingA project opencode.json overrides the global one. Check for a competing file in the repo root

On this page