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
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
| Method | Usage |
|---|---|
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/password | client.auth.login(email, password) |
| Existing JWT | create_client(token="eyJ...") |
The client does not read credentials from environment variables; pass them to create_client (for example create_client(api_key=os.environ["ONECLAW_API_KEY"])).
Resource modules
| Module | Methods |
|---|---|
client.auth | login, signup, agent_token, forgot_password, reset_password |
client.vaults | create, list, get, delete |
client.secrets | set, get, list, delete, rotate_generate, list_versions |
client.agents | create, list, get, update, delete, enroll, submit_transaction, sign_intent |
client.policies | create, list, delete |
client.signing_keys | create, list, rotate, deactivate, balance |
client.sharing | create, list_outbound, list_inbound, get, accept, decline, delete, access |
client.audit | list, verify |
client.billing | subscription, subscribe, portal, credit_balance, credit_transactions, credit_topup |
client.bindings | create, list, execute, test (Execution Intents) |
client.cards | order, list, get, reveal (Payment Card Vault) |
Response envelope
All methods return a OneclawResponse object with data, error, and meta:
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"],
)
Raw HTTP
For endpoints not yet wrapped, call the REST API directly with httpx or requests; see curl examples.