Tenzro Labs
Tutorial 06 · Platform API · MCP server

Manage the Platform programmatically

Everything on the Platform is available over HTTPS with JSON, and as MCP tools. Script your catalogue checks, keys and balance.
Step 01

Know the Platform API

Base URL
https://platform.tenzro.xyz/api
Auth
Authorization: Bearer tzl_...
Format
JSON bodies. Lists come back as { "data": [...] }.
OpenAPI
https://platform.tenzro.xyz/api/openapi.json

Catalogue endpoints need no key. Account endpoints need a key with read; changes need manage. Every endpoint below has an MCP tool with the same result, on the server at https://platform.tenzro.xyz/api/mcp.

shell
export TENZRO_API_KEY="tzl_..."   # read, plus manage for step 04
export TENZRO_API="https://platform.tenzro.xyz/api"

Errors share one shape: { "error": { "code", "message" } }, with 401 invalid_key for a bad key and 403 forbidden when the key lacks the permission.

Step 02

List models and machines

Models, with pricing and machines
GET /models
list_models
One model and its route order
GET /models/{id}
get_model(model_id)
Machines, with hardware and health
GET /machines
list_machines
One machine
GET /machines/{id}
get_machine(machine_id)
Operators and their machines
GET /operators
list_operators
Where a request would go now
GET /route?model=
route_model(model_id, region?)
shell
curl -s $TENZRO_API/models | jq -r '.data[] | "\(.id)  \(.modality)  available=\(.available)"'

# GPU machines serving a model, in one region
curl -s "$TENZRO_API/machines?gpu=true&model=qwen3.5-4b&region=Europe" | jq '.data[] | {id, health}'

curl -s "$TENZRO_API/route?model=qwen3.5-4b"

/machines filters: service (serverless, rent or subscribe), region, gpu, operator and model. list_machines takes the same filters as arguments.

response · GET /route
{ "model": "qwen3.5-4b", "routes": [{ "machine_id": "tenzro-partner-cluster", "health": "online", "region": "Europe", "score": 120 }] }
Step 03

Read the balance and activity

The account and this key
GET /me
get_account
Credit balance
GET /credits
get_balance
Credit activity, newest first
GET /credits/activity?limit=
list_activity(limit?)
shell
curl -s $TENZRO_API/credits -H "Authorization: Bearer $TENZRO_API_KEY"

curl -s "$TENZRO_API/credits/activity?limit=20" -H "Authorization: Bearer $TENZRO_API_KEY"
response · GET /credits
{ "total_credits": 25000, "by_scope": [{ "machine_id": null, "credits": 25000 }] }

Credit with machine_id null is usable anywhere; the rest is pinned to a machine. Balances are in Tenzro Labs credits: 1 credit is 0.001 TNZO. Activity lists credit added, plan credit granted and usage charged; limit is 1 to 500, default 50.

Step 04

Create, list and revoke keys

List keys
GET /keys
list_api_keys
Create a key
POST /keys
create_api_key
Revoke a key
DELETE /keys/{id}
revoke_api_key(key_id)

Create

shell
curl $TENZRO_API/keys \
  -H "Authorization: Bearer $TENZRO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "ci", "permissions": ["inference", "read"], "machine_id": "tenzro-partner-cluster"}'
name
string
A label for the key.
permissions
inference | read | manage []
Default ["inference"]. A key can only grant permissions it holds.
machine_id
string
Optional. Restrict the key to one machine; otherwise it reaches every machine.
subscription_id, rental_id
string
Optional. Tie the key to a plan or a rental.

The response includes secret, returned once. Lists never include secrets; last_used_at shows which keys are still in use.

List and revoke

shell
curl -s $TENZRO_API/keys -H "Authorization: Bearer $TENZRO_API_KEY" \
  | jq -r '.data[] | "\(.id)  \(.name)  \(.permissions | join(","))  last_used=\(.last_used_at)"'

curl -X DELETE $TENZRO_API/keys/key_Zb81Qm0sP4aT -H "Authorization: Bearer $TENZRO_API_KEY"
A manage key cannot move money: paying an order returns a Stripe Checkout link or a stablecoin deposit address that a person completes. It can still spend existing credit by minting inference keys, so store it like a password.
Step 05

Do the same from an assistant

With the MCP server connected (tutorial 03) on a key with read, an assistant answers account questions with these tools; with manage it can also create and revoke keys. Clients ask before running a tool that changes something.

tool call · list_machines
{ "service": "serverless", "gpu": true, "model": "qwen3.5-4b" }
tool call · list_activity
{ "limit": 20 }
tool call · create_api_key
{ "name": "ci", "permissions": ["inference"], "machine_id": "tenzro-partner-cluster" }