# API billing, usage, and troubleshooting

Reconcile model, group, units, and cache charges. Diagnose authentication, rate limits, timeouts, and coding-tool configuration.

- Source: https://www.unifyllm.com/docs/billing-troubleshooting/
- Language: en
- Updated: 2026-11-27

## Find the same request first

Open [console usage logs](https://www.unifyllm.top/usage-logs/common) and find the call by time. Keep the model, group, request ID, status, and charge. Remove keys and sensitive content before sharing diagnostics.

- Match the requested model with key access and the model recorded in the log.
- Do not mix groups, context sizes, or the several calls made by one tool task.
- Logs help reconciliation. Contact support with the request ID and time if further investigation is needed.

## Check units before calculating cost

For rates per million tokens, a category’s cost = billable tokens ÷ 1,000,000 × rate. Calculate input, output, and applicable cache categories according to that model’s rules.

For per-request rates, reconcile charged requests and the applicable rules. A request rate is not a rate per million tokens, and one tool task can make multiple requests.

On the [pricing page](https://www.unifyllm.com/pricing/), select the model and your key’s group. Check credits, USD, or CNY, and whether the rate is per token or per request.

> No fixed rates are stored in this guide. Check model pricing and actual usage for long-context, tool, accelerated-mode, or other charges.

## Reconcile cache reads and writes separately

- Do not sum every usage field across vendors; check parent and child categories first.
- History, tool definitions, and tool results add later input. Cache expiration and prefix changes can affect hits.
- Missing usage does not mean zero cost. Keep the raw response and request ID for unexplained records.

| Category | What to check |
| --- | --- |
| Uncached input | Check whether the protocol’s input total already includes cache subcategories. |
| Cache read | Cache hits follow the applicable read rate; they are not necessarily free. |
| Cache write | Separate reporting depends on protocol and model; cache duration can affect rates. |
| Output and reasoning | Do not add reasoning tokens again if they are already included in output. |

## Diagnose by error type

| Symptom | Check first |
| --- | --- |
| 401 | Complete active key and the authentication header required by the endpoint. |
| 403 / model access | Key group, model access, and the response message. A website 403 may instead come from edge protection. |
| 429 | Error details and limit scope. Reduce concurrency and follow Retry-After when present. |
| timeout / 5xx | Whether the request was sent and whether logs contain a result. A timeout does not prove the server failed to complete. |

> For uncertain paid requests, check usage records or asynchronous task status first. Avoid repeated resubmission. If an image or video URL was returned, retry that download first.

## The API works but the coding tool does not

See the [Codex](https://www.unifyllm.com/docs/integrations/codex/) and [Claude Code](https://www.unifyllm.com/docs/integrations/claude-code/) guides. [Contact support](https://www.unifyllm.com/contact/) with redacted diagnostics if needed.

1. **Check activation**: Activate the configuration rather than only saving a draft.
2. **Reopen the tool and session**: Fully quit and reopen. Start a new session when required.
3. **Check overrides**: Inspect project settings, environment variables, and organization policies.
4. **Check the tested scope**: A short reply verifies a basic request. Tool execution, context, and permissions still need a real task check.
