الجواب المباشر

تشرح هذه الصفحة كيف تستخدم الفرق بوابة NextModel المتوافقة مع OpenAI. Query balance and usage over the API, and read the per-request billing headers. وتضيف الخطوات العملية، وملاحظات الإعداد، والأسئلة الشائعة.

Balance and usage over the API

Two authenticated GET endpoints return your account state without opening a dashboard. GET /v1/credits returns the prepaid credit balance. GET /v1/activity returns paginated usage records plus a summary; page with since (ISO timestamp), limit, and offset. Costs are returned in the account's billing currency.

Usage query
curl -s https://api.nextmodel.app/v1/credits -H "Authorization: Bearer $NEXTMODEL_API_KEY"
curl -s "https://api.nextmodel.app/v1/activity?limit=20" -H "Authorization: Bearer $NEXTMODEL_API_KEY"

Cost formula

A request costs input_tokens × input_price_per_1M / 1,000,000 + output_tokens × output_price_per_1M / 1,000,000. Prices per model sit on the pricing page and on each model page. The usage record returned by /v1/activity and the dashboard always shows the tokens and cost actually settled — not an estimate.

Per-request billing status

Every response carries X-NextModel-Billing-Status: settled means delivered and charged at actual tokens, rolled_back means the request failed and nothing was charged, not_charged means it was rejected before any model call. Failures never bill — see the Errors page for the full envelope.