Agent Account and Billing CLI

Use CLI commands for agent account registration, account lookup, email verification, billing status, USDC deposits, and checkout.

Use this page to register an account, read its balance, verify its email, and buy credits from the CLI. Terms such as workspace, Content key, and credits are defined in Terms.

tutorflow agent register

Use tutorflow agent register to self-register an agent account and receive a Content API key (tf_content_). This command needs no API key. --name and --slug are required; on a terminal the CLI asks for them when you leave them out.

bash
tutorflow agent register \
  --name "Acme Agent" \
  --slug "acme-agent" \
  --email "ops@example.com" \
  --agent-identity "codex-worker"

By default, the CLI saves contentApiKey to ~/.tutorflow/config.json as apiKey, so content commands work right away. When TUTORFLOW_BASE_URL or the config points at a host other than https://api.tutorflow.io, that baseUrl is saved too. Add --no-save when an automation runner should only read the key from stdout.

bash
tutorflow --json agent register \
  --name "Acme Agent" \
  --slug "acme-agent" \
  --email "ops@example.com" \
  --no-save

Example JSON response:

JSON
{
  "organizationId": "org_2d8b1a3f",
  "apiKey": null,
  "keyPrefix": null,
  "contentApiKey": "tf_content_...",
  "contentApiKeyPrefix": "tf_content_abcd",
  "defaultClassroomId": "00000000-0000-4000-8000-000000000010",
  "contentApiBaseUrl": "https://api.tutorflow.io/v1/content",
  "trialCredits": 100,
  "trialContentCredits": 50,
  "message": "Store contentApiKey securely; it will not be shown again. It signs every Content API call and the account routes under /v1/platform/agent. apiKey is null: legacy tf_platform_ keys are no longer issued.",
  "requiresEmailVerification": true,
  "verifyEmailResendEndpoint": "POST /v1/platform/agent/verify-email/resend",
  "nextSteps": {
    "createCourse": "POST /v1/content/classrooms/00000000-0000-4000-8000-000000000010/courses",
    "listCourses": "GET /v1/content/classrooms/00000000-0000-4000-8000-000000000010/courses",
    "createSlide": "POST /v1/content/classrooms/00000000-0000-4000-8000-000000000010/slides",
    "createVideo": "POST /v1/content/classrooms/00000000-0000-4000-8000-000000000010/videos",
    "accountInfo": "GET /v1/platform/agent/account"
  }
}

Store contentApiKey and defaultClassroomId: they are what the Content API needs. The CLI finds defaultClassroomId on its own through agent account, so you do not have to save it. apiKey and keyPrefix are null: registration no longer issues legacy tf_platform_ keys. It returns contentApiKey only once.

Registration allows 5 attempts per IP per rolling hour, failed attempts included. Over the limit it answers 429 platform_rate_limit_exceeded with Retry-After. Register once and keep the key.

tutorflow agent account

bash
tutorflow agent account

The command returns the agent account (its workspace record and balance) of the active key. It needs a live tf_content_ key with full access, like the one registration returns, or a legacy tf_platform_ key. A test key gets 403 platform_content_key_too_narrow.

Example JSON response:

JSON
{
  "organizationId": "org_2d8b1a3f",
  "name": "Acme Agent",
  "slug": "acme-agent",
  "status": "active",
  "creditBalance": 100,
  "credits": 50,
  "overdraftCredits": 0,
  "overdraftLimit": 100,
  "isMetered": false,
  "rateLimitPerMinute": 1000,
  "isEmailVerified": false,
  "restrictedActions": [
    "add_payment_method",
    "usdc_payment",
    "create_billing_session"
  ],
  "createdAt": "2026-05-12T03:10:00.000Z",
  "defaultClassroomId": "00000000-0000-4000-8000-000000000010",
  "sandboxClassroomId": null,
  "contentApiBaseUrl": "https://api.tutorflow.io/v1/content",
  "contentApiUrls": {
    "listClassrooms": "GET /v1/content/classrooms",
    "generateCourse": "POST /v1/content/classrooms/00000000-0000-4000-8000-000000000010/courses/generate",
    "listCourses": "GET /v1/content/classrooms/00000000-0000-4000-8000-000000000010/courses",
    "generateSlides": "POST /v1/content/classrooms/00000000-0000-4000-8000-000000000010/slides/generate",
    "generateTest": "POST /v1/content/classrooms/00000000-0000-4000-8000-000000000010/tests/generate",
    "createVideo": "POST /v1/content/classrooms/00000000-0000-4000-8000-000000000010/videos"
  }
}

credits is the balance in credits; creditBalance is the same balance in cents, at 2 cents per credit. defaultClassroomId is the classroom for Content API calls.

tutorflow agent verify-email resend

Resend the verification email for the authenticated agent account:

bash
tutorflow agent verify-email resend

Example JSON response:

JSON
{
  "message": "Verification email sent"
}

tutorflow agent billing status

Check whether the account of the active key can buy credits and which actions are restricted:

bash
tutorflow agent billing status

Billing status includes the current balance, billing state, and any restricted actions that the backend is enforcing for the account.

Example JSON response:

JSON
{
  "hasPaymentMethod": false,
  "cardBrand": null,
  "cardLast4": null,
  "creditBalance": 100,
  "credits": 50,
  "overdraftCredits": 0,
  "overdraftLimit": 100,
  "isMetered": false,
  "billingMode": "prepaid",
  "isEmailVerified": false,
  "restrictedActions": [
    "add_payment_method",
    "usdc_payment",
    "create_billing_session"
  ]
}

tutorflow agent billing session

Create a TutorFlow-hosted billing session URL:

bash
tutorflow agent billing session

Use this when an agent needs to send an operator to the hosted TutorFlow billing page instead of building a direct payment flow. It needs a verified email.

Example JSON response:

JSON
{
  "url": "https://tutorflow.io/agent-platform/checkout?token=checkout_token_...",
  "sessionId": "checkout_token_..."
}

tutorflow agent billing x402-deposit

Get a USDC deposit address on Base for an amount:

bash
tutorflow agent billing x402-deposit --amount-usd 10

--amount-usd is required and must be a positive number; the API accepts 5 to 5000. It needs a verified email and is available where x402 is enabled.

Example JSON response:

JSON
{
  "scheme": "exact",
  "network": "eip155:8453",
  "payTo": "0x...",
  "amountUsd": 10,
  "expiresInSeconds": 300,
  "paymentUrl": "POST /v1/platform/agent/billing/x402"
}

The CLI has no command for the payment step. Pay exactly amountUsd in USDC to payTo, then call POST /v1/platform/agent/billing/x402 with the x-payment header. See Agent Self-Service.

tutorflow agent checkout info and create

Checkout token commands are available for workflows that already have a TutorFlow checkout token. They need no API key.

Inspect token details:

bash
tutorflow agent checkout info --token "checkout_token_..."

Create a Stripe Checkout URL:

bash
tutorflow agent checkout create \
  --token "checkout_token_..." \
  --amount-usd 25

Example JSON responses:

JSON
{
  "email": "ops@example.com",
  "name": "Acme Agent"
}
JSON
{
  "url": "https://checkout.stripe.com/c/pay/cs_test_..."
}

For normal agent onboarding, prefer tutorflow agent billing session because it returns a hosted TutorFlow billing flow.

To check the AI Credit balance and history from the Content API, use tutorflow credits balance and tutorflow credits history. See Content Generation CLI.