Inference

Connect OpenClaw to Nebius Token Factory

Configure Nebius Token Factory as a custom OpenClaw model provider and use Kimi K2.6 from the dashboard or terminal interface.

Build it with an agent

Paste into Claude Code, Cursor, or any coding agent — it builds the recipe for you.

Create a small, reviewable OpenClaw integration project based on the existing Nebius Token Factory tutorial.

Produce a concise `README.md` that preserves the interactive `openclaw configure --section model` flow. Include the optional macOS Homebrew installation, Token Factory base URL `https://api.tokenfactory.nebius.com/v1`, model ID `moonshotai/Kimi-K2.6`, provider ID `nebius-token-factory`, and the verified local Gateway setup: generate `OPENCLAW_GATEWAY_TOKEN` with `openssl rand -hex 32`, set `gateway.mode` to `local`, set `gateway.auth.mode` to `token`, and save the token with `gateway.auth.token`. Include Gateway restart or foreground-run commands, dashboard and terminal UI commands, and brief troubleshooting. Explain that the Gateway token must remain private. Link alternative models to the live Token Factory catalog. Include only a short optional explanation of why API-key secret management matters and link to `https://docs.openclaw.ai/gateway/secrets`; do not reproduce the secrets migration procedure.

For isolated evaluation only, also create `Dockerfile` and `run.sh`. Pin OpenClaw `2026.7.1` in the image and run as a non-root user. `run.sh` must read `NEBIUS_API_KEY`, `NEBIUS_BASE_URL`, and `NEBIUS_MODEL` from the environment, create and clean up an isolated OpenClaw state directory, configure Token Factory as the `nebius-token-factory` OpenAI-compatible provider, and run one non-delivering local agent turn with an explicit session ID. Print the returned model text and print `NEBIUS_OPENCLAW_OK` only after a successful response.

Do not add a configuration patch file, application package, package dependencies, or testing framework. Never include a real credential or modify a user's existing OpenClaw configuration.

Recipe

OpenClaw is a self-hosted AI assistant that connects chat apps (WhatsApp, Telegram, Discord, and more) to LLM providers. Because Nebius Token Factory serves open models through an OpenAI-compatible API, you can point OpenClaw at Token Factory and run your agents on models like Qwen3, Llama, and DeepSeek.

Why Token Factory?

  • OpenAI-compatible: no special SDK; OpenClaw’s built-in OpenAI provider works as-is.
  • Open models: Qwen3, Kimi, DeepSeek, GLM and more, all behind one API key.
  • Cost control: usage-based pricing with no infrastructure to manage.

Prerequisites

  • A running OpenClaw instance, or a Mac with Homebrew for the optional installation step below.
  • A Nebius Token Factory API key. See Getting Started for how to create one.

Optional: Install OpenClaw on macOS

Skip this section if openclaw --version already works.

brew install -y openclaw-cli
openclaw --version

1. Get your API key

Grab a key from tokenfactory.nebius.com.

2. Add Token Factory as a provider

openclaw configure --section model
  • Choose Custom provider.
  • Base URL = https://api.tokenfactory.nebius.com/v1
  • API key = paste your Nebius API key when prompted
  • Select OpenAI-compatible.
  • Model ID = moonshotai/Kimi-K2.6
  • Provider ID = nebius-token-factory
  • Model alias = leave blank

Model Selection

Model IDs use the case-sensitive org/model form. This tutorial uses:

Model ID
Kimi-K2.6 moonshotai/Kimi-K2.6

Copy other current model IDs from the Token Factory catalog.

That’s it!

Optional: Protect your API key with OpenClaw Secrets

API keys grant access to your account, so avoid leaving them as plaintext in shared configuration files. OpenClaw supports SecretRefs that resolve credentials from environment, file, command, and secret-store providers. See OpenClaw Secrets Management for setup and migration instructions.

3. Restart OpenClaw

For a fresh CLI installation, generate a local Gateway token and save the local authentication settings once:

export OPENCLAW_GATEWAY_TOKEN="$(openssl rand -hex 32)"
openclaw config set gateway.mode local
openclaw config set gateway.auth.mode token
openclaw config set gateway.auth.token "$OPENCLAW_GATEWAY_TOKEN"

The token authenticates local clients such as the dashboard and TUI. Keep it private.

Be sure to restart the OpenClaw Gateway for changes to take effect:

openclaw gateway restart

If the Gateway service is not installed, run it in the foreground instead:

openclaw gateway run

Then launch the web-based UI:

openclaw dashboard

Or launch the terminal-based UI:

openclaw tui

Troubleshooting

  • 401 or 403: check that the saved Nebius API key is correct and can access the model.
  • 404 / model not found: verify the model ID (org/model, case-sensitive) against the live catalog.
  • Wrong endpoint: the base URL must end in /v1; do not append /chat/completions yourself.
  • openclaw: command not found after installation: open a new terminal window and run openclaw --version again.

Resources