Usage Monitoring Tools
Read your usage, spend, and balance — via Yunxin's native analytics endpoints or drop-in shells for popular monitoring dashboards.
Yunxin records every request — tokens, cost, latency, time-to-first-token, routing, and any fallback — in your usage history. You can read that data two ways: through Yunxin's native analytics endpoints, or through a set of monitoring-tool-compatible shells that mimic other providers' usage APIs so existing dashboards and CLIs work against Yunxin unmodified.
All endpoints below return your own data and require your API key (the same sk- key you use for
inference), unless noted as public. Send it as Authorization: Bearer $YUNXIN_API_KEY.
Native analytics
Use these when you're building your own dashboards or scripts against Yunxin directly.
| Endpoint | Returns |
|---|---|
GET /v1/analytics/usage/summary | Aggregate usage and cost over a period. |
GET /v1/analytics/usage/by-model | Usage and cost broken down per model. |
GET /v1/analytics/usage/timeseries | Usage over time, bucketed for charts. |
GET /v1/billing/usage | Billing-oriented usage and current balance. |
curl https://api.yuhuanstudio.com/v1/analytics/usage/summary \
-H "Authorization: Bearer $YUNXIN_API_KEY"Costs are reported in credits, where 1 credit = $0.001 USD. See Pricing & Billing for how per-request cost is computed.
Public stats
GET /v1/stats/public needs no authentication and returns platform-level facts (model and provider
counts, uptime) — handy for status pages.
curl https://api.yuhuanstudio.com/v1/stats/publicMonitoring-tool-compatible shells
Popular "API usage" dashboards and CLIs (for example openusage and cc-switch) only know how to
read a handful of providers' usage APIs. Rather than ask you to modify those tools, Yunxin exposes the
same response shapes those tools expect. Point the tool at Yunxin as if it were that provider, give it
your sk- key, and your real Yunxin balance and usage show up — no tool changes required.
| Shape | Endpoint(s) | Returns |
|---|---|---|
| OpenRouter | GET /v1/credits, GET /v1/key, GET /v1/activity?days= | Credits/usage, key metadata, per-day per-model activity. |
| SiliconFlow | GET /v1/user/info | { "data": { "balance", "totalBalance", "chargeBalance", ... } }. |
| DeepSeek | GET /user/balance | { "is_available", "balance_infos": [ ... ] }. |
| Novita | GET /openapi/v1/billing/balance/detail | { "availableBalance", ... } (balance unit is 1/10000 USD). |
| z.ai | GET /api/monitor/usage/quota/limit | Monthly token quota as a percentage bucket. |
The DeepSeek, Novita, and z.ai shapes live at the root of the domain (not under /v1), matching
those providers' real paths. The OpenRouter /credits, /key, and /activity routes are reachable
under both /v1/... and /api/v1/....
OpenRouter shape
The OpenRouter credits endpoint reports lifetime spend and your balance, so any tool that computes
total_credits − total_usage shows your real remaining balance:
curl https://api.yuhuanstudio.com/v1/credits \
-H "Authorization: Bearer $YUNXIN_API_KEY"{ "data": { "total_credits": 5000, "total_usage": 1234 } }GET /v1/key returns the calling key's label, usage, tier, and rate limit. GET /v1/activity?days=30
returns per-day, per-model usage for charts.
Connecting common tools
openusage / cc-switch as an OpenRouter account
Add an OpenRouter-type account, set its base URL to https://api.yuhuanstudio.com/v1 (or
https://api.yuhuanstudio.com/api/v1), and use your sk- key. The tool reads /credits, /key, and
/activity.
cc-switch as DeepSeek / SiliconFlow / Novita / z.ai
Add a provider of that type, point its base URL at https://api.yuhuanstudio.com, and use your sk-
key. The tool reads that provider's balance endpoint and displays your Yunxin balance inline.
These shells are compatibility surfaces, not full reimplementations of each provider's API — they cover the balance/usage fields monitoring tools read. For complete, stable data, prefer the native analytics endpoints above.
What gets recorded
Every request is logged with its token counts, computed cost, latency and time-to-first-token, the resolved routing decision, and whether a fallback was used. This is the data the endpoints above surface, and the same data backing the Dashboard's analytics views. See Fallback & Routing for the routing and fallback headers attached to each response.
How is this guide?