caelum0x 4bb1472e3e feat(vend): white-label "your own OpenRouter" kit
Vend + Relay + Mint white-label kit: self-serve workspace signup
(POST /v1/auth/signup, off by default), per-app model pricing with markup,
end-user wallets and top-ups, tenant earnings, migration 0009_whitelabel,
customer console and operator admin pages for the new flows, and matching
TypeScript/Python SDK and mint-client updates. Covered by
tests/whitelabel_flow.rs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-24 12:41:49 +03:00
..

Vend Python SDK

Synchronous, standard-library-only client for Python 3.11+. Customer sessions control apps and keys; provisioning keys call the metered inference plane.

python -m pip install -e apps/vend/sdks/python
import os
import uuid
from vend import VendClient

vend = VendClient(os.environ["VEND_BASE_URL"])
vend.login(
    os.environ["VEND_TENANT_ID"],
    os.environ["VEND_EMAIL"],
    os.environ["VEND_PASSWORD"],
)
app = vend.list_apps()[0]
checkout = vend.create_funding_checkout(app["id"], "creem", 20_000_000)
print("Fund this app:", checkout["checkout_url"])
issued = vend.issue_key(app["id"], daily_cap_micros=5_000_000, environment="test")
vend.provisioning_key = issued["secret"]

result = vend.chat_completions(
    {
        "model": "tensorzero::model_name::openai::gpt-4o-mini",
        "messages": [{"role": "user", "content": "Hello"}],
    },
    idempotency_key=str(uuid.uuid4()),
)
print(result.body, result.settlement)

with vend.chat_completions_stream(
    {
        "model": "tensorzero::model_name::openai::gpt-4o-mini",
        "messages": [{"role": "user", "content": "Hello"}],
    },
    idempotency_key=str(uuid.uuid4()),
) as stream:
    for event in stream:
        print(event.data)

For browser-based external login, redirect to vend.oauth_start_url("github", tenant_id) or vend.oauth_start_url("google", tenant_id). Vend admits only a verified email that already has an invitation for that tenant; it is not an open signup path.