Skip to content
DOCS / OpenClaw

OpenClaw

Add Fast Inference as an OpenClaw custom provider using an environment-backed SecretRef.

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

  1. Export the project key

    bash
    export INFERENCE_API_KEY="inf_sk_..."

    The OpenClaw gateway process must receive this environment variable whenever it starts.

  2. Add model provider

    Add inference-net to models.providers in ~/.openclaw/openclaw.json (run openclaw config file to print the active path on your machine). It should look something like this:

    json5
    {
      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 apiKey value is an OpenClaw environment SecretRef, so the raw key is resolved at runtime rather than stored in the configuration.

  3. Verify the provider

    bash
    openclaw models list --provider inference-net
    openclaw models status

    Select 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; keep mode: "merge" unless you intend that.
  • openclaw models status disagrees 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.