← Back to Plugins
Tools

Diem Balance

clawSean By clawSean 👁 35 views ▲ 0 votes

Portable OpenClaw /diem balance plugin

GitHub

README

# ๐Ÿช™ Diem Balance Plugin

> **Zero-token Venice AI balance checks โ€” right from your OpenClaw agent.**

No LLM inference. No token burn. Just a clean `/diem` command that pings the Venice API and reports your remaining Diem balance instantly.

```
/diem
```
```
๐Ÿช™ Venice Diem Balance: `3.5012 Diem`
```

---

## โœจ Features

- โšก **Zero-token** โ€” makes a minimal 1-token inference request just to read balance headers
- ๐Ÿš€ **Startup-registered** โ€” available immediately when OpenClaw boots
- ๐Ÿ“ฆ **Portable** โ€” single folder, no secrets bundled, works on any machine with OpenClaw
- ๐Ÿงช **Tested** โ€” 15 offline baseline tests, no credentials required to run them
- ๐Ÿ”Œ **Drop-in install** โ€” one `bash` command and a gateway restart

---

## ๐Ÿ“ฆ Install

```bash
bash scripts/install.sh
```

Then restart OpenClaw Gateway:

```bash
openclaw gateway restart
```

Run it:

```
/diem
```

> **Default install path:** `~/.openclaw/extensions/diem`
> Override with `OPENCLAW_EXT_DIR=/your/path bash scripts/install.sh`

---

## ๐Ÿ” Auth

No secrets are included in this repo. The plugin reads your Venice AI API key from the OpenClaw auth profile already on your machine:

```
~/.openclaw/agents/*/agent/auth-profiles.json
```

It expects a `venice:default` profile with a `key` field โ€” the same one OpenClaw uses for Venice inference. If you're already running Venice models, this just works.

---

## ๐Ÿ—‚๏ธ Structure

```
diem-balance-plugin/
โ”œโ”€โ”€ extensions/
โ”‚   โ””โ”€โ”€ diem/
โ”‚       โ”œโ”€โ”€ openclaw.plugin.json   # Plugin manifest
โ”‚       โ”œโ”€โ”€ index.ts               # Command registration + output formatting
โ”‚       โ”œโ”€โ”€ diem.py                # Python script โ€” hits Venice API for balance headers
โ”‚       โ””โ”€โ”€ test.mjs               # Offline baseline test suite
โ”œโ”€โ”€ scripts/
โ”‚   โ””โ”€โ”€ install.sh                 # Copies plugin files into OpenClaw extensions dir
โ”œโ”€โ”€ INSTRUCTIONS.md                # Human-readable install guide
โ””โ”€โ”€ package.json                   # npm test entry point
```

---

## ๐Ÿงช Tests

Offline โ€” no Venice credentials needed:

```bash
npm test
```

```
โ–ธ Manifest          PASS ร—4
โ–ธ Entry point       PASS ร—1
โ–ธ Registration      PASS ร—4
โ–ธ formatBalance     PASS ร—5
โ–ธ diem.py syntax    PASS ร—1

โ”โ”โ” 15 passed, 0 failed โ”โ”โ”
```

---

## ๐Ÿ› ๏ธ How It Works

1. `/diem` is registered as a zero-arg OpenClaw command on startup
2. `index.ts` shells out to `diem.py` via `execSync`
3. `diem.py` sends a minimal 1-token request to `https://api.venice.ai` and reads the response headers
4. The `x-venice-balance-diem` header value is parsed and formatted
5. Result is returned to the chat surface

---

## ๐Ÿ”— Links

- [Venice AI](https://venice.ai) โ€” the inference provider
- [OpenClaw](https://openclaw.ai) โ€” the agent platform this plugin targets
- [clawSean on GitHub](https://github.com/clawSean) โ€” org this plugin lives under
tools

Comments

Sign in to leave a comment

Loading comments...