Skip to main content

Python SDK

The official Python client (oneclaw on PyPI) mirrors the 1Claw REST API. Use it for Python backends, cron jobs, data pipelines, and custom agents that call 1Claw over HTTP.

Agent keys (ocv_) and user keys (1ck_) both auto-exchange for JWTs and refresh before expiry. Resource modules cover vaults, secrets, agents, policies, Intents API signing, execution bindings, billing, and the rest of the surface documented in the OpenAPI spec.

Building with LangChain or CrewAI? Install langchain-1claw or 1claw-crewai-tools for ready-made tools. This package is the underlying client.

Repository: github.com/1clawAI/1claw-python-sdk

Try it out

Run the Python SDK example in the examples repo (pip install oneclaw, set ONECLAW_API_KEY, then python main.py).

Install​

pip install oneclaw

Requires Python 3.10+.

Quick start​

Human (API key or email/password)​

from oneclaw import create_client

# User API key (1ck_) — auto-exchanges for JWT
client = create_client(api_key="1ck_your_user_key")

# Or login with email/password
client = create_client(base_url="https://api.1claw.co")
client.auth.login("you@example.com", "your-password")

# Create a vault and store a secret
resp = client.vaults.create("My Vault", description="Secrets for my app")
vault_id = resp.data["id"]

client.secrets.set(
vault_id,
"api-keys/openai",
"sk-proj-...",
type="api_key",
metadata={"tags": ["openai", "production"]},
)

secret = client.secrets.get(vault_id, "api-keys/openai")
print(secret.data["value"]) # use securely; don't log in production

Agent (API key)​

from oneclaw import create_client

# Agent keys (ocv_) auto-exchange for JWTs and refresh before expiry
client = create_client(api_key="ocv_your_agent_key")

# Agent ID is auto-discovered from the token exchange
print(client.resolved_agent_id)

vault_id = "your-vault-id"
data = client.secrets.list(vault_id)
for s in data.data["secrets"]:
print(f"{s['path']} ({s['type']}, v{s['version']})")

Pre-authenticated JWT​

client = create_client(token="eyJ...")

Authentication​

MethodUsage
User API key (1ck_)create_client(api_key="1ck_...")
Agent API key (ocv_)create_client(api_key="ocv_...") — agent_id optional (resolved via prefix)
Email/passwordclient.auth.login(email, password)
Existing JWTcreate_client(token="eyJ...")

Environment variables (optional): ONECLAW_API_KEY, ONECLAW_BASE_URL, ONECLAW_AGENT_ID.

Resource modules​

ModuleMethods
client.authlogin, signup, agent_token, forgot_password, reset_password
client.vaultscreate, list, get, delete
client.secretsset, get, list, delete, rotate_generate, list_versions
client.agentscreate, list, get, update, delete, enroll, submit_transaction, sign_intent
client.policiescreate, list, delete
client.signing_keyscreate, list, rotate, deactivate, balance
client.sharingcreate, list, accept, decline
client.auditlist_events
client.billingsubscription, credits_balance
client.bindingscreate, list, execute, test (Execution Intents)
client.cardsorder, list, get, reveal (Payment Card Vault)

Response envelope​

All methods return a Response object:

resp = client.vaults.create("my-vault")
if resp.error:
print(resp.error)
else:
print(resp.data["id"])

Intents API example​

from oneclaw import create_client

client = create_client(api_key="ocv_...")
agent_id = client.resolved_agent_id

resp = client.agents.submit_transaction(
agent_id,
chain="ethereum",
to="0x000000000000000000000000000000000000dEaD",
value="0",
)
print(resp.data.get("tx_hash"), resp.data.get("status"))

Policies example​

client.policies.create(
vault_id,
principal_type="agent",
principal_id=agent_id,
secret_path_pattern="production/*",
permissions=["read"],
)

Async support​

from oneclaw import create_async_client

async def main():
client = create_async_client(api_key="1ck_...")
resp = await client.vaults.list()
print(resp.data)

# asyncio.run(main())

Raw HTTP​

For endpoints not yet wrapped, use client.request() or fall back to curl examples with httpx/requests.