OpenClaw supports custom OpenAI-compatible providers under models.providers.
The released fast CLI does not yet include an OpenClaw adapter, but OpenClaw's
native provider and SecretRef contracts provide a verified manual setup.
Add the provider
Export the project key
export INFERENCE_API_KEY="inf_sk_..."The OpenClaw gateway process must receive this environment variable whenever it starts.
Add model provider
Add
inference-nettomodels.providersin~/.openclaw/openclaw.json(runopenclaw config fileto print the active path on your machine). It should look something like this:{ models: { mode: "merge", providers: { "inference-net": { baseUrl: "https://api.inference.net/v1", api: "openai-completions", apiKey: { source: "env", provider: "default", id: "INFERENCE_API_KEY", }, models: [ { id: "glm-5.2", name: "GLM 5.2", input: ["text"], contextWindow: 1048576, maxTokens: 943718, }, ], }, }, }, }Merge this into your existing configuration — preserve every existing provider and agent setting. The structured
apiKeyvalue is an OpenClaw environment SecretRef, so the raw key is resolved at runtime rather than stored in the configuration.Verify the provider
openclaw models list --provider inference-net openclaw models statusSelect
inference-net/glm-5.2, send a prompt, and check Usage.
Add more models
Every custom model must be registered in the provider's models array. Copy
the ID and capability information from the model catalog. Mark image
input only for a model that actually supports it.
OpenClaw merges custom providers by default. An agent-specific models.json
can override non-empty provider values, so inspect that file if a different
base URL remains active.
Revert the manual setup
Remove only models.providers.inference-net and any agent default that references
inference-net/*. Keep the environment key if another tool still uses it;
otherwise remove it from the service environment. Restart the OpenClaw gateway.
Troubleshooting
- Chat completions fail against Fast Inference — use
api: "openai-completions". - Other providers disappeared from the catalog —
mode: "replace"replaces the full provider catalog; keepmode: "merge"unless you intend that. openclaw models statusdisagrees with the running gateway — run it in the same environment as the gateway process.- An agent ignores the configured base URL — inspect agent-level
models.json, which can override it.