OpenClaw

What is OpenClaw?

OpenClaw is an AI agent platform for conversational and coding workflows. When OpenClaw supports a generic OpenAI-compatible provider, you can point that provider at JoyToken and route model calls through JoyToken’s API key, policy, wallet, and model routing layer.

OpenClaw configuration keys can differ by version. Use the exact field names from your OpenClaw version; this page describes the provider contract JoyToken expects.

Setup

Step 1: Create a JoyToken API key

Create a dedicated key such as dev-openclaw.

SettingRecommendation
ModelStart with auto
BudgetDaily development cap
TierDevelopment or standard
LogsKeep enabled

Step 2: Set environment variables

~/.zshrc
$export JOY_TOKEN_API_KEY="jt_xxx"
$export JOY_TOKEN_OPENAI_BASE_URL="https://api-dev.joytokens.ai/openai/v1"

Step 3: Add a JoyToken provider

If OpenClaw exposes a generic OpenAI-compatible provider, use this shape:

openclaw.config.json
1{
2 "providers": {
3 "joytoken": {
4 "type": "openai-compatible",
5 "baseURL": "https://api-dev.joytokens.ai/openai/v1",
6 "apiKeyEnv": "JOY_TOKEN_API_KEY"
7 }
8 },
9 "models": {
10 "joytoken-auto": {
11 "provider": "joytoken",
12 "model": "auto"
13 }
14 },
15 "defaultModel": "joytoken-auto"
16}

Step 4: Start OpenClaw

Restart OpenClaw after changing the provider config. New model calls should route through JoyToken.

Manual Configuration

If your OpenClaw configuration is agent-scoped, put the same provider contract inside the agent model config:

agent-config.json
1{
2 "agent": {
3 "model": {
4 "provider": "openai-compatible",
5 "baseURL": "https://api-dev.joytokens.ai/openai/v1",
6 "apiKeyEnv": "JOY_TOKEN_API_KEY",
7 "model": "auto"
8 }
9 }
10}

If OpenClaw supports request headers, add a request ID:

provider-headers.json
1{
2 "headers": {
3 "X-Request-ID": "openclaw-local-dev"
4 }
5}

Model Format

ValueBehavior
autoJoyToken router selects the model
Concrete model keyPins the request to a JoyToken model while still passing policy and wallet checks
API key fixed modelKey policy restricts or overrides requested models

Use auto during early evaluation. Pin models after quality and cost are stable for repeatable coding-agent workflows.

Monitoring Usage

PlaceExpected result
OpenClaw logsProvider is joytoken or openai-compatible
JoyToken LogsRequests appear under the OpenClaw API key
JoyToken UsageTokens and Credits are attributed to dev-openclaw
Response headersSuccessful calls include selected model and provider headers

Why use JoyToken with OpenClaw?

Multi-agent cost control

Use separate JoyToken keys for local testing, shared team agents, and unattended workflows.

Policy enforcement

Block disallowed models, tiers, IPs, or spend before an OpenClaw agent reaches an upstream provider.

Model routing

Keep OpenClaw configured with auto while JoyToken chooses the model inside policy.

Troubleshooting

SymptomCheck
Provider not recognizedUse OpenClaw’s generic OpenAI-compatible provider and set the JoyToken base URL explicitly
401 UnauthorizedJOY_TOKEN_API_KEY is passed to the provider
403 ForbiddenKey policy allows the requested model, tier, and IP
Tool calls failOpenClaw sends OpenAI-compatible tools and handles returned tool_calls
Usage missingOpenClaw did not fall back to another provider

Resources