Demonstrates the 1Claw Python SDK — vault CRUD, secrets, billing, agent workflows.
| Difficulty | Time | What you'll build |
|---|---|---|
| Beginner | 5 min | Python scripts: vault CRUD, secrets, billing, agent auth & audit |
- Python 3.9+
- A 1Claw API key (1claw.xyz/settings/api-keys)
cd examples/python-sdk
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
cp .env.example .env
# Edit .env with your API keypython main.pyThis will:
- Authenticate with your API key
- Create a vault (
python-sdk-demo) - Store and retrieve a secret
- List secrets
- Check billing usage and supported chains
- Clean up (delete vault and secret)
# Set an agent key in .env first:
# ONECLAW_API_KEY=ocv_your_agent_key
python agent_demo.pyThis will:
- Authenticate as an agent (auto-discovers agent ID)
- List accessible vaults
- Read a secret (policy-gated)
- Fetch agent self-info (
/agents/me) - List recent audit events
| Variable | Required | Description |
|---|---|---|
ONECLAW_API_KEY |
Yes | 1ck_ (user) or ocv_ (agent) API key |
ONECLAW_BASE_URL |
No | API URL (default: https://api.1claw.xyz) |
ONECLAW_AGENT_ID |
No | Agent UUID (auto-discovered for ocv_ keys) |
ONECLAW_VAULT_ID |
No | Skip vault creation, use an existing vault |
ONECLAW_SECRET_PATH |
No | Secret path for agent reads (default: demo/api-key) |
from oneclaw import create_client
# User key (auto-exchanges for JWT)
client = create_client(api_key="1ck_...")
# Agent key (auto-exchanges, auto-refreshes)
client = create_client(api_key="ocv_...")
# Context manager for automatic cleanup
with create_client(api_key="ocv_...") as client:
vaults = client.vaults.list()Install from PyPI:
pip install oneclawFull docs: docs.1claw.xyz | SDK source: github.com/1clawAI/1claw-python-sdk