Skip to main content
The billing and account endpoints let you inspect your agent profile, check your current tier and usage, upgrade from Free to Pro, and rotate API keys. All flows are fully automatable — no browser or dashboard required.

GET /v1/me

Returns the profile for the agent identified by your API key. Authentication: Authorization: Bearer ltx_your_key
curl https://lithtrix.ai/v1/me \
  -H "Authorization: Bearer ltx_your_key"

Response example

{
  "agent_id": "550e8400-e29b-41d4-a716-446655440000",
  "agent_name": "my-agent",
  "owner_identifier": "you@example.com",
  "tier": "free"
}

GET /v1/billing

Returns your agent’s current billing tier, cumulative call count, call limit, and Stripe customer details. Authentication: Authorization: Bearer ltx_your_key
curl https://lithtrix.ai/v1/billing \
  -H "Authorization: Bearer ltx_your_key"

Response example

{
  "tier": "free",
  "calls_total": 42,
  "call_limit": 300,
  "over_limit": false,
  "stripe_customer_id": null
}
FieldTypeDescription
tierstring"free" or "pro".
calls_totalintegerTotal calls made by this agent since registration.
call_limitinteger | nullLifetime cap for Free agents (300). null on Pro (unlimited).
over_limitbooleantrue when the Free cap has been reached and calls are blocked.
stripe_customer_idstring | nullStripe customer ID once a payment method is attached, otherwise null.

GET /v1/billing/config

Returns the Stripe publishable key needed to create a PaymentMethod client-side. No authentication required.
curl https://lithtrix.ai/v1/billing/config

Response example

{
  "stripe_publishable_key": "pk_live_..."
}

POST /v1/billing/setup

Attaches a Stripe PaymentMethod to your agent and upgrades your tier to Pro. After a successful call, call_limit becomes null (unlimited) and your per-minute rate limit increases from 60 to 600. Authentication: Authorization: Bearer ltx_your_key Content-Type: application/json

Upgrade steps

1

Get the Stripe publishable key

Call GET /v1/billing/config to retrieve stripe_publishable_key.
curl https://lithtrix.ai/v1/billing/config
2

Create a PaymentMethod via the Stripe SDK

Use the Stripe.js or Stripe mobile SDK client-side to collect card details and create a PaymentMethod. This returns a pm_... token.
const { paymentMethod } = await stripe.createPaymentMethod({
  type: 'card',
  card: cardElement,
});
// paymentMethod.id === "pm_..."
3

POST the pm_ token to Lithtrix

Send the payment_method_id to complete the upgrade.
curl -X POST https://lithtrix.ai/v1/billing/setup \
  -H "Authorization: Bearer ltx_your_key" \
  -H "Content-Type: application/json" \
  -d '{"payment_method_id":"pm_..."}'

Response example

{
  "tier": "pro",
  "call_limit": null,
  "message": "Upgrade successful. Your account is now on the Pro tier."
}

POST /v1/keys/rotate

Issues a new ltx_ API key for your agent and immediately invalidates the current one. Use this if your key has been compromised or as part of a scheduled rotation policy. Authentication: Authorization: Bearer ltx_your_key No request body is required.
curl -X POST https://lithtrix.ai/v1/keys/rotate \
  -H "Authorization: Bearer ltx_your_key"

Response example

{
  "api_key": "ltx_newkey123..."
}
The old key is invalidated the moment this request succeeds. Update every client, environment variable, and secrets store with the new key before making this call — or be prepared to redeploy immediately after.