OpenClaw
Add GreenTokens as a custom model provider in OpenClaw.
Quick setup
Run the setup script in a terminal and choose OpenClaw from its list. It finds OpenClaw's settings, checks your API key, and makes the changes described below for you, backing up each file first. It can set up your other agents in the same run.
curl -fsSL https://www.greentokens.io/setup.sh | bashThe script saves your key as the GREENTOKENS_API_KEY environment variable, which OpenClaw reads. Open a new terminal window afterwards so it picks it up.
To undo, run the same command again and choose Remove.
Add GreenTokens as a provider
OpenClaw connects to any OpenAI-compatible API as a custom provider. Add GreenTokens to the models section of your OpenClaw config and make one of its models the default:
OpenClaw config
{
models: {
providers: {
greentokens: {
baseUrl: "https://api.greentokens.io/v1",
apiKey: "${GREENTOKENS_API_KEY}",
api: "openai-completions",
models: [
{ id: "claude-sonnet-5", name: "Claude Sonnet 5" },
{ id: "claude-opus-5-5", name: "Claude Opus 5.5" },
{ id: "gpt-6-sol", name: "GPT-6 Sol" },
{ id: "glm-5.3", name: "GLM-5.3" }
]
}
}
},
agents: {
defaults: {
model: { primary: "greentokens/claude-sonnet-5" }
}
}
}baseUrlincludes/v1, andapi: "openai-completions"uses the Chat Completions API.${GREENTOKENS_API_KEY}reads your key from the environment, so it never sits in the file.- Each
idis a GreenTokens model ID from the models page. Reference them asgreentokens/model-id.
Or add it from the command line
To merge the provider into your existing config without editing the file by hand:
Shell
openclaw config set models.providers.greentokens '{
"baseUrl": "https://api.greentokens.io/v1",
"apiKey": "${GREENTOKENS_API_KEY}",
"api": "openai-completions",
"models": [{ "id": "claude-sonnet-5", "name": "Claude Sonnet 5" }]
}' --strict-json --mergeSet your key
export GREENTOKENS_API_KEY="sk-gt-…"Agents can run for a long time unattended. Give OpenClaw its own API key with a daily spend limit on the API Keys page.