Get Started with Token Factory and OpenClaw - Rafay Product Documentation

OpenClaw

In this guide you will use an inference endpoint from Rafay's Token Factory as a custom model provider within a self hosted OpenClaw instance.

Assumptions

This exercise assumes the following requirements are already in place.

1. Retrieve Model API Details

In this section, you will retrieve the Token Factory Model API details. These details will be used to configure an OpenClaw custom model provider in a later step.

2. Configure OpenClaw

In this section, you will configure a "custom model provider" from the OpenClaw Control UI. This will allow the OpenClaw instance to use the models in the Rafay Token Factory.

You can configure/verify your custom model within the openclaw.json configuration file.

The following content should be added to the file. Be sure to use your environment specific values.

  "models": {
    "providers": {
      "ACME": {
        "baseUrl": "https://openclaw.paas.demo.gorafay.net/v1",
        "apiKey": "<YOUR_API_KEY>",
        "auth": "token",
        "api": "openai-completions",
        "injectNumCtxForOpenAICompat": true,
        "models": [\
          {\
            "id": "openclaw",\
            "name": "openclaw",\
            "api": "openai-completions",\
            "reasoning": false,\
            "input": [\
              "text"\
            ],\
            "cost": {\
              "input": 0,\
              "output": 0,\
              "cacheRead": 0,\
              "cacheWrite": 0\
            },\
            "contextWindow": 200000,\
            "maxTokens": 256\
          }\
        ]
      }
    }
  }

3. Use OpenClaw with Token Factory

In this section, you will initiate a chat session from the OpenClaw Control UI.

You will receive a response from the Token Factory inference endpoint.

4. Verify Token Usage

In this section, you will verify token usage from OpenClaw within Token Factory.

You will see the token usage from the previously sent chat message.