Plan and monitor X Credits
Estimate managed-X usage, inspect the live monthly allowance, understand reset and safety caps, and handle hard-limit exhaustion without confusing X Credits with posts/month.
1. Estimate the operation mix
Start from the final X text. A conclusively URL-free X post uses 15 Credits; a post containing a URL or domain-like candidate is conservatively counted at 200 Credits. A complete future Inbox comment interaction combines one received comment and one reply. A complete DM interaction combines one received DM and one sent DM.
| Plan | Included | Normal posts | URL posts | Complete comments | Complete DMs |
|---|---|---|---|---|---|
| Free | 0 | 0 | 0 | Inbox not included | Inbox not included |
| API | 1,500 | 100 | 7 | Inbox not included | Inbox not included |
| Basic | 4,000 | 266 | 20 | 200 | 160 |
| Growth | 12,000 | 800 | 60 | 600 | 480 |
| Team | 30,000 | 2,000 | 150 | 1,500 | 1,200 |
| Enterprise | Custom | Custom | Custom | Custom | Custom |
Each operation column assumes the entire shared allowance is used for that operation. Real workloads mix operations, so calculate against the weighted total rather than adding the columns together.
2. Inspect the live allowance
Call GET /v1/billing/x-credits before large managed-X batches and display monthly_remaining plus billing_period_end in operator-facing UI.
curl "https://api.unipost.dev/v1/billing/x-credits" \
-H "Authorization: Bearer $UNIPOST_API_KEY"3. Validate before publishing
Use POST /v1/posts/validate to catch request and platform validation errors before publishing. Validation does not consume X Credits. For the final publish contract, see POST /v1/posts.
4. Handle exhaustion
- Branch on
x_monthly_usage_limit_exceeded; do not parse the message. - Stop retry loops for the same managed-X operation.
- Show the reset date and the current plan's upgrade or Enterprise contact path.
- Keep BYO X operations separate because they do not consume UniPost X Credits.
Managed-X work stops at the hard limit. The allowance does not override the independent safety cap of 20 X posts per connected account per UTC day, X rate limits, spam controls, or content-policy enforcement.