# Openclaw Plugins

Paso4 maintains OpenClaw plugins that are published on
[ClawHub](https://clawhub.ai/) and consumed by FourIA tenants. Their source
lives in a dedicated public repository:

> **https://github.com/Paso4/openclaw-plugins**

## Migration (monorepo → `Paso4/openclaw-plugins`)

The plugin source used to live in this monorepo under
`packages/plugins/`. It has been **removed from this repository** and migrated to
[`Paso4/openclaw-plugins`](https://github.com/Paso4/openclaw-plugins), which now
owns the plugin's build, unit and live-integration tests, versioning, and ClawHub
publication.

| Moved out of this repo                                                     | Now lives at                                                                                                                                                                    |
| -------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `packages/plugins/cloudflare-unified-billing/` (source)                    | [`Paso4/openclaw-plugins` → `plugins/provider/cloudflare-unified-billing/`](https://github.com/Paso4/openclaw-plugins/tree/develop/plugins/provider/cloudflare-unified-billing) |
| Plugin unit + integration tests (`src/**/*.test.ts`, `tests/integration/`) | The new repository (`bun run test`, `bun run test:integration`)                                                                                                                 |
| Plugin release/versioning (`scripts/release.mjs` component)                | The new repository's changesets + `scripts/sync-versions.mjs` release train                                                                                                     |
| Plugin CI (`plugin-integration.yml`)                                       | The new repository's `test.yml` / `release.yml` / `publish.yml` workflows                                                                                                       |
| `@moltlazy/cloudflare-unified-billing` npm workspace                       | Removed; the published artifact is the ClawHub package `@paso4/cloudflare-unified-billing`                                                                                      |

### What did **not** move

The plugin's **runtime identity** is unchanged, so tenant workers keep working
without any config change:

- **ClawHub package:** `clawhub:@paso4/cloudflare-unified-billing` — pre-installed
  into the container image at build time (`apps/fouria/Dockerfile`) and
  reinstalled as a fallback in `apps/fouria/start-openclaw.sh`. Both install
  paths are **best-effort**: a ClawHub outage or a plugin-API/runtime version
  mismatch logs a warning and continues, so the image still builds and the boot
  proceeds; the enablement patch only enables a plugin whose extension directory
  is present.
- **Provider id:** `cloudflare-unified-billing` (model refs, auth aliases, and
  `providerAuthAliases` to `cloudflare-ai-gateway`).
- **Feature flag:** `unifiedBilling` (`MOLTLAZY_FEATURE_FLAGS`), consumed by
  moltlazy's `config/plugins` module.
- **Credentials:** the AI Gateway variables (`CLOUDFLARE_AI_GATEWAY_API_KEY`,
  `CLOUDFLARE_API_TOKEN`, `CF_AI_GATEWAY_ACCOUNT_ID`,
  `CF_AI_GATEWAY_GATEWAY_ID`, `CF_AI_GATEWAY_CUSTOM_DOMAIN`), documented in
  [ENV-VARIABLES.md](/staging/llms/platform/reference/env-variables/index.md) and
  `docs/schemas/secrets-manifest.schema.json`.
- **Routing (opt-in):** with `AI_GATEWAY_PROXY=true` the Worker sets
  `CF_AI_GATEWAY_CUSTOM_DOMAIN=ai.internal`, so the plugin calls the sandbox →
  Worker proxy instead of Cloudflare directly. The proxy
  (`apps/fouria/src/sandbox-ai-bridge.ts`) authenticates the sandbox with a
  per-instance derived token, derives the tenant from the Worker env, attaches
  `cf-aig-metadata` (`tenant_id`/`environment`/`platform`) plus the plugin's
  `openclaw_run_id`, and forwards with the real platform credential. This keeps
  per-client spend attributable on a shared gateway pool and keeps the
  account-scoped credential out of the container. It is opt-in because it only
  applies when the active model ref uses this provider
  (`cloudflare-unified-billing/*`); the official `cloudflare-ai-gateway`
  provider ignores the custom domain and would reject the derived token. The
  `CF_ACCESS_*` credential pair was removed: an Access-protected custom domain
  needs a per-tenant service token and still cannot produce `cf.user_id`.

> The plugin's own local `.dev.vars` is **no longer generated by this repo's
> `secrets:generate`** (the path no longer exists). Set up credentials in a
> checkout of the new repository via its `.dev.vars.example`.

## Published plugins

| Plugin                                                                                                                           | Shape    | ClawHub package                     |
| -------------------------------------------------------------------------------------------------------------------------------- | -------- | ----------------------------------- |
| [cloudflare-unified-billing](https://github.com/Paso4/openclaw-plugins/tree/develop/plugins/provider/cloudflare-unified-billing) | Provider | `@paso4/cloudflare-unified-billing` |

## Developing a plugin

Clone [`Paso4/openclaw-plugins`](https://github.com/Paso4/openclaw-plugins) and
follow its `README.md` / `AGENTS.md`. In short:

```bash
git clone https://github.com/Paso4/openclaw-plugins
cd openclaw-plugins
bun install
bun run --cwd plugins/provider/cloudflare-unified-billing test
bun run verify            # format + lint + version policy + typecheck + tests
```

Install into an OpenClaw gateway straight from ClawHub:

```bash
openclaw plugins install clawhub:@paso4/cloudflare-unified-billing
openclaw plugins inspect cloudflare-unified-billing --runtime --json
```

## Versioning

The plugin repository ships **one global version** whose base matches the
OpenClaw release it targets (`catalog.openclaw` in _that_ repository's root
`package.json`). Bumping OpenClaw therefore means:

1. Bump `catalog.openclaw` in this monorepo (see [VERSIONING.md](/staging/llms/platform/reference/versioning/index.md)
   and the [`openclaw-migration`](https://github.com/0xCAB0/fouria/blob/develop/skills/openclaw-migration/SKILL.md) skill).
2. Separately bump `catalog.openclaw` in `Paso4/openclaw-plugins` so the plugin
   tracks the same release.

The plugin is **not** part of this monorepo's release train anymore, so it no
longer appears in `scripts/release.mjs`, git tags, or release notes here.

## CI

The monorepo no longer builds or tests the plugin: `bun run build:plugin` and
`.github/workflows/plugin-integration.yml` were removed. The new repository runs
plugin unit tests on every PR and live AI Gateway integration tests on `develop`,
and publishes to ClawHub on release.

## Model catalog maintenance

The model catalog (`src/models.ts`) moved with the plugin. The
[`model-catalog-research`](https://github.com/0xCAB0/fouria/blob/develop/.agents/skills/model-catalog-research/SKILL.md)
skill documents how to research and reconcile it — run it against a checkout of
`Paso4/openclaw-plugins`, not this repo.
