API Documentation

Quick integration guide and complete API reference

Tooling

WEI HUB exposes an OpenAI-compatible API, so most tools that support an OpenAI base URL and API key can connect directly. This page currently includes a full OpenClaw integration guide.

Generic integration pattern

For clients and developer tools that support the OpenAI protocol, you usually only need to replace the base URL with this platform's /v1 endpoint and use an API key from the console.

Base URL

bash
https://api.weiapi.ai/v1

Not sure which tool section to read?

  • OpenCode: best for developer tools that support a custom provider or OpenAI-compatible provider type.
  • Trae: best for UI-based custom model setup where you fill in a full request URL.
  • Hermes: best for local config through ~/.hermes/config.yaml and ~/.hermes/.env.
  • Cherry Studio: best for desktop users who add a custom provider with API key, API address, and model ID.
  • Continue: best for VS Code / JetBrains users connecting through the OpenAI provider and apiBase.
  • Open WebUI: best for self-hosted web chat setups that add an OpenAI-compatible service in connection settings.
  • OpenClaw: best for script-based setup, local onboarding, or manual config file edits.

Base URL vs full request URL

  • Most SDKs and tools ask for the Base URL, such as https://api.wei.run/v1.
  • Some tools ask for the full endpoint. For example, Trae's custom request URL should include /v1/chat/completions.

Use the provided setup script, local onboarding flow, or manual config file edits to connect OpenClaw to WEI HUB. Click the card to jump to the full setup section below.

OpenCode

If your current OpenCode build supports a custom OpenAI-compatible provider, you can connect WEI HUB as an external model service.

Best for

Developers using OpenCode when the tool supports custom OpenAI providers.

Fields

Base URL, API key, and model ID.

First test

Save the config and send one minimal chat message.

Before you start

  • Make sure your current OpenCode version supports custom providers or an OpenAI-compatible provider type.
  • Create a usable API key in the WEI HUB console first (it should start with sk-).
  • Know which model ID you want to use, or be ready to test with a real callable model from the platform.
  1. Open the Provider / Model configuration page in OpenCode.
  2. Choose a custom provider, or select an OpenAI Compatible provider type.
  3. Set the base URL to the WEI HUB /v1 endpoint and paste an API key from the console.
  4. Pick a model ID that is actually available in WEI HUB as the default model.

Minimum fields you need

If OpenCode supports OpenAI-compatible integration, you usually only need Base URL, API Key, and Model to complete the first connection test.

ConfigRecommended value
Base URLhttps://api.weiapi.ai/v1
API Keysk-your-api-key
ModelYOUR_MODEL_ID

How to confirm the setup worked

  1. Save the configuration, then send one minimal test message inside OpenCode.
  2. If the model returns content successfully, OpenCode is already connected to WEI HUB.
  3. If it fails, check the Base URL, API Key, and Model ID first.

Common issues

What if I cannot find a custom provider entry in OpenCode?

First confirm whether your current OpenCode version supports custom providers or an OpenAI-compatible provider type. If the UI does not expose that entry, this integration path will not work yet.

What if I filled everything in but requests still fail?

Check whether the Base URL includes /v1, whether the API key is valid, and whether the model ID is actually callable on the platform.

What if I do not know what to put in Model?

Go back to the WEI HUB model list or console, confirm one real callable model ID, and use that value in OpenCode.

Trae

If Trae supports adding a custom model through the OpenAI path, you can connect WEI HUB as an external model service directly. The main requirement is to fill in the model ID, API key, and request URL correctly.

Best for

Users who want to add and use a custom model directly inside the Trae UI.

Fields

OpenAI provider, custom model, model ID, API key, and full request URL.

First test

Select the model you just added and send a short test message.

Before you start

  • Make sure your current Trae version supports adding a custom model.
  • Create a usable API key in the WEI HUB console first (it should start with sk-).
  • Confirm one real callable model ID from WEI HUB first.
  • Be ready to connect through the OpenAI-compatible path.
  1. Open Trae and enter the model management or model configuration page.
  2. Click Add Model.
  3. Choose OpenAI as the provider.
  4. Choose Custom Model in the model type or model selection step.
  5. Fill the model ID field with a real callable model ID from WEI HUB.
  6. Paste the API key created in the WEI HUB console into the API key field.
  7. Fill the custom request URL with https://api.wei.run/v1/chat/completions.
  8. Save the configuration.
  9. Go back to Trae and test the model you just added.
ConfigRecommended value
ProviderOpenAI
Model typeCustom Model
Model IDYOUR_MODEL_ID
API Keysk-your-api-key
Custom request URLhttps://api.wei.run/v1/chat/completions

Recommended request URL

text
https://api.wei.run/v1/chat/completions

How to confirm the setup worked

  1. After saving the config, switch to the model you just added inside Trae.
  2. Send one minimal test message, for example: Reply with: connection ok.
  3. If the model returns content successfully, Trae is already connected to WEI HUB.

Common issues

What should I put in Model ID?

Use a real callable model name from WEI HUB. Do not fill in only a vendor name or a broad capability label. If you are not sure, go back to the WEI HUB model list or console and confirm the exact value first.

What should I put in API Key?

Use the API key created in the WEI HUB console. It usually starts with sk-.

Which request URL should I use?

For this integration path, use https://api.wei.run/v1/chat/completions as the custom request URL.

Why do requests still fail after I save everything?

Check whether the model ID is actually callable, whether the API key is valid, and whether the custom request URL is filled in completely and correctly.

Hermes

If your current Hermes version supports a custom OpenAI-compatible endpoint, you can connect WEI HUB as an external model service. For a first setup, you usually only need a Base URL, API key, and one real callable model ID.

Best for

Users who want Hermes local agent / CLI workflows to call WEI HUB models.

Fields

API key in ~/.hermes/.env, plus Base URL and default model in config.yaml.

First test

Reload Hermes and send: Reply with: connection ok.

What Hermes is

Hermes is an AI agent / CLI tool that can connect to different model services. It supports built-in providers as well as any OpenAI-compatible endpoint. If you want Hermes to call models from WEI HUB, you need to configure the endpoint, API key, and model ID inside Hermes.

What you need before starting

  • Hermes is already installed and its commands run normally.
  • You know the Hermes config directory is usually located at ~/.hermes/.
  • You have already created a usable API key in the WEI HUB console (it should start with sk-).
  • You have confirmed one real callable model ID from the platform.
  • You have an environment where you can edit config files, or you know how to open ~/.hermes/config.yaml.

Common Hermes config files

Main config file: ~/.hermes/config.yaml

Environment file: ~/.hermes/.env

Minimum fields you need

For a first integration, only focus on Base URL, API key, and Model ID. Get the minimal path working before moving on to multiple models or advanced features.

ConfigRecommended value
Base URLhttps://api.weiapi.ai/v1
API Keysk-your-api-key
ModelYOUR_MODEL_ID

1. Recommended: start with the minimal setup

If you have never configured Hermes before, start with the minimal path first. Make Hermes call WEI HUB successfully once, then continue with more advanced configuration later.

Prepare the API key in ~/.hermes/.env first

bash
# ~/.hermes/.env
OPENAI_API_KEY=sk-your-api-key

Then add the minimal config in ~/.hermes/config.yaml

yaml
# ~/.hermes/config.yaml
model:
  provider: custom
  base_url: https://api.weiapi.ai/v1
  api_key: ${OPENAI_API_KEY}
  default: YOUR_MODEL_ID

Things to keep in mind for this example

  • Different Hermes versions may use slightly different field names. If your current version already has an existing config structure, keep that structure and only replace provider, base_url, api_key, and the default model.
  • For security, it is better to keep the API key in ~/.hermes/.env and reference it from config.yaml, instead of storing the raw key directly in the config file long term.
  • If the model list does not appear automatically, do not get blocked on auto-discovery first. The safer path is to enter one real callable model ID manually and verify the minimal request.

2. Advanced: extend the config structure used by your current version

If you already understand the Hermes config structure, you can extend it further with multiple providers, multiple models, or other advanced capabilities. But for the first setup, it is better to get the minimal path working first.

How to confirm the setup worked

  1. Save ~/.hermes/.env and ~/.hermes/config.yaml.
  2. Reopen Hermes, or re-enter the current session / model selection flow so the new config can take effect.
  3. Send one minimal test message, for example: Reply with: connection ok.
  4. If the model returns content successfully, Hermes is already connected to WEI HUB.

Common issues

I have never used Hermes before. Where should I start?

First confirm that Hermes is installed correctly and that you know the config directory is under ~/.hermes/. If you have not finished the basic installation yet, complete the official Hermes setup first, then come back to connect WEI HUB.

Where are the Hermes config files?

The main config is usually ~/.hermes/config.yaml, and sensitive values such as API keys are better stored in ~/.hermes/.env.

Why am I still getting authentication errors after filling in the API key?

Check whether the API key is valid, whether the Base URL includes the full /v1 path, and whether your current config is actually passing that API key to the WEI HUB custom endpoint.

What if the model list does not appear automatically?

Do not depend on automatic model discovery for the first test. A safer path is to enter one real callable model ID directly and verify that the minimal request succeeds.

Can Windows users configure this directly?

According to the Hermes official FAQ, Windows native is not the main supported runtime. It is safer to run Hermes inside WSL2 and complete the integration there.

Cherry Studio

Cherry Studio supports custom providers. You can connect WEI HUB through the OpenAI-compatible path by filling in the API key, API address, and model ID.

Best for

Desktop chat users who prefer connecting models through a custom provider.

Fields

Provider name, OpenAI type, API key, API address, and model ID.

First test

Return to chat, select the model, and send a minimal test message.

Before you start

  • Cherry Studio is installed and you can open the provider settings page.
  • You have already created a usable API key in the WEI HUB console.
  • You have confirmed one real callable model ID from the platform.
  1. Open Cherry Studio settings and go to provider or model service configuration.
  2. Add a custom provider and name it WEI HUB.
  3. Choose OpenAI or an OpenAI-compatible provider type.
  4. Fill in the API key and API address.
  5. Add or enter the model ID you want to use.
  6. Save the provider, then select the model in chat and send a test message.
ConfigRecommended value
Provider nameWEI HUB
Provider typeOpenAI
API Keysk-your-api-key
API Addresshttps://api.weiapi.ai/v1
ModelYOUR_MODEL_ID

How to confirm the setup worked

  1. After saving the provider, return to chat and select the model you added.
  2. Send one minimal test message, for example: Reply with: connection ok.
  3. If the model returns content successfully, Cherry Studio is connected to WEI HUB.

Continue

Continue is commonly used in VS Code or JetBrains. Use the OpenAI provider and point apiBase to the WEI HUB /v1 endpoint to connect platform models.

Best for

VS Code or JetBrains users who use AI coding assistance inside the editor.

Fields

provider, model, apiBase, apiKey, and roles.

First test

Enable chat or edit first, then confirm one conversation works.

Before you start

  • Continue is installed and you can open its config file.
  • You have already created a usable API key in the WEI HUB console.
  • You have confirmed one real callable model ID from the platform.

Continue config example

yaml
name: WEI HUB
version: 0.0.1
schema: v1

models:
  - name: WEI HUB Chat
    provider: openai
    model: YOUR_MODEL_ID
    apiBase: https://api.weiapi.ai/v1
    apiKey: sk-your-api-key
    roles:
      - chat
      - edit
      - apply

Things to keep in mind

  • Use openai as the provider and set apiBase to the WEI HUB /v1 root.
  • Replace model with a real callable model ID from the platform.
  • Start with chat or edit roles first, then expand to more Continue capabilities after the connection works.

Open WebUI

Open WebUI can connect to OpenAI-compatible services. Add the WEI HUB /v1 URL and API key in the admin connection settings, then choose a model for testing.

Best for

Teams or individuals running a self-hosted web chat entrypoint.

Fields

OpenAI-compatible URL, API key, and model ID.

First test

Save the connection, select the model in chat, and send a minimal message.

  1. Open the Open WebUI admin panel.
  2. Go to Settings / Admin Settings and find Connections or OpenAI connection settings.
  3. Add a new OpenAI-compatible connection.
  4. Fill in the URL, API key, and model ID.
  5. Save the connection, then return to chat and send a test message with the model.
ConfigRecommended value
URLhttps://api.weiapi.ai/v1
API Keysk-your-api-key
Model IDsYOUR_MODEL_ID

Things to keep in mind

  • The URL usually uses the WEI HUB /v1 root and does not need the full chat/completions path.
  • If models do not appear automatically, enter one real callable model ID manually first.
  • If you get a 401 or 404, check the API key and model ID first.

OpenClaw Setup

Use the platform-provided setup script or OpenClaw onboarding to connect OpenClaw to this platform's OpenAI-compatible API.

Best for

OpenClaw users who want script-based or config-file integration with WEI HUB.

Fields

Provider name, Base URL, API key, model ID, and default model route.

First test

Restart the gateway after configuration, then run one minimal model call.

Before you start

  • Make sure OpenClaw is already installed locally and its commands run normally.
  • Create a usable API key in the WEI HUB console first (it should start with sk-).
  • Know which model ID you want to use, or be ready to test with the default example model first.
  • If you are using the macOS / Linux script flow, confirm that jq is installed on your machine.

1. Auto configure with setup script

This is the fastest path. The script backs up your current config and writes the base URL, API key, default model, provider name, and model alias. If no API key is provided up front, it will prompt for one in the terminal.

Script URLs

text
https://weiapi.ai/setup-openclaw-provider.sh
https://weiapi.ai/setup-openclaw-provider.ps1

Setup script command

bash
curl -fsSL https://weiapi.ai/setup-openclaw-provider.sh | bash

# Optional: provide key non-interactively
curl -fsSL https://weiapi.ai/setup-openclaw-provider.sh | WEIAPI_API_KEY=sk-your-api-key bash

Custom parameter example

bash
# Optional: override base URL, model, alias, and provider name
curl -fsSL https://weiapi.ai/setup-openclaw-provider.sh | \
  WEIAPI_API_KEY=sk-your-api-key \
  WEIAPI_BASE_URL=https://api.weiapi.ai/v1 \
  WEIAPI_MODEL_ID=qwen3.5-plus \
  WEIAPI_MODEL_ALIAS=qwen3.5-plus \
  WEIAPI_PROVIDER_NAME=custom-api-wei-run \
  bash

Windows run example

powershell
iwr https://weiapi.ai/setup-openclaw-provider.ps1 -OutFile .\setup-openclaw-provider.ps1
powershell -ExecutionPolicy Bypass -File .\setup-openclaw-provider.ps1

# Optional: provide key non-interactively
powershell -ExecutionPolicy Bypass -File .\setup-openclaw-provider.ps1 -ApiKey "sk-your-api-key"

What the script changes automatically

  • Backs up your current openclaw.json so you can roll back if needed.
  • Writes the base URL, API key, provider config, and model definition.
  • Sets models.mode to merge and adds the provider model into models.providers.
  • Points the default primary model to custom-api-wei-run/qwen3.5-plus unless you override those values with custom parameters.

2. Use local onboarding wizard

If you prefer an interactive flow, run OpenClaw onboarding: Yes -> QuickStart -> Custom Provider, then fill in the fields using the recommended values below.

OpenClaw onboarding command

bash
openclaw onboard

Recommended onboarding values

  1. Base URL: https://api.weiapi.ai/v1
  2. Paste an API key created from the console.
  3. Choose Custom Provider / OpenAI-compatible as the provider type.
  4. Use a model ID that is actually available in WEI HUB, such as qwen3.5-plus.
  5. Save the provider and set it as the primary default model if needed.

3. Edit config manually

If you already understand the OpenClaw config structure, or want exact control over provider name, default model, and field values, edit openclaw.json directly.

Recommended config snippet

json
{
  "agents": {
    "defaults": {
      "model": {
        "primary": "custom-api-wei-run/qwen3.5-plus"
      },
      "models": {
        "custom-api-wei-run/qwen3.5-plus": {
          "alias": "qwen3.5-plus"
        }
      }
    }
  },
  "models": {
    "mode": "merge",
    "providers": {
      "custom-api-wei-run": {
        "baseUrl": "https://api.weiapi.ai/v1",
        "api": "openai-completions",
        "apiKey": "sk-your-api-key",
        "models": [
          {
            "id": "qwen3.5-plus",
            "name": "qwen3.5-plus (Custom Provider)",
            "contextWindow": 1000000,
            "maxTokens": 32768,
            "input": ["text", "image"],
            "reasoning": false,
            "cost": {
              "input": 0,
              "output": 0,
              "cacheRead": 0,
              "cacheWrite": 0
            }
          }
        ]
      }
    }
  }
}

Default config paths

macOS / Linux: ~/.openclaw/openclaw.json

Windows: $HOME\\.openclaw\\openclaw.json

Config keyDescription
models.providers.*.baseUrlUpstream API base URL. Use this platform's /v1 root.
models.providers.*.apiProtocol type. Use openai-completions for most models.
models.providers.*.apiKeyAPI key created from the console (starts with sk-).
models.providers.*.models[].idUse a model ID that is actually available in WEI HUB, such as qwen3.5-plus.
models.providers.*.models[].inputModel input type array. Include image when image input is required.
agents.defaults.model.primaryDefault primary route used as your main model entry.

How to verify the setup worked

  1. Run openclaw gateway restart so OpenClaw reloads the latest config.
  2. Open the OpenClaw provider / model configuration view and confirm that custom-api-wei-run (or your custom provider name) appears.
  3. Confirm the default primary model now points to the expected provider/model pair, such as custom-api-wei-run/qwen3.5-plus.
  4. Send one minimal test request. If the model returns successfully, the integration is working.

Optional restart after config updates

bash
openclaw gateway restart

Common issues

What if the script says jq: command not found?

The Bash script uses jq to modify JSON. Install jq first, or switch to the Windows PowerShell script or manual config flow.

What if I already entered the API key but it still does not work?

Check whether the API key is valid, the base URL is correct, and OpenClaw has reloaded the updated config.

Why can I not see the provider or model inside OpenClaw?

This usually means the config was not written successfully, the gateway was not restarted, or the model ID is not actually callable on the platform.