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. Merge the provider configuration

    Add this provider under models.providers in openclaw.json. Preserve every existing provider and agent setting.

    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: 262144,
                maxTokens: 128000,
              },
            ],
          },
        },
      },
    }

    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

  • Use api: "openai-completions" for Fast Inference chat completions.
  • Keep mode: "merge" unless you intend to replace the full provider catalog.
  • Run openclaw models status in the same environment as the gateway process.
  • Inspect agent-level models.json if it overrides the configured base URL.