Newapi records a log entry for every request processed, capturing the model used, token counts, cost, timestamp, and status. These logs let you monitor spending, audit activity, and debug failed requests.Documentation Index
Fetch the complete documentation index at: https://doc.hitopen.com/llms.txt
Use this file to discover all available pages before exploring further.
What gets logged
Each log entry includes:| Field | Description |
|---|---|
| Timestamp | When the request was received |
| Model | The model name used (e.g., gpt-4o) |
| Prompt tokens | Number of input tokens consumed |
| Completion tokens | Number of output tokens generated |
| Total tokens | Sum of prompt and completion tokens |
| Cost | Credit cost charged against the token’s quota |
| Status | Whether the request succeeded or failed |
| Token | Which API token was used |
| Channel | Which upstream channel handled the request (admin view) |
Viewing logs in the console
- Log in to the Newapi console and click Logs in the sidebar.
- The logs table shows all requests made with your tokens, sorted by most recent first.
- Use the filters at the top to narrow results by date range, model, token name, or status.
- Click any row to expand the full details for that request, including the error message if the request failed.
Administrators can see logs for all users. Standard users see only the logs for their own tokens.
Querying your logs via API
UseGET /api/log/self to retrieve your own logs programmatically. This endpoint requires a valid API token (User permission).
Query parameters
| Parameter | Type | Description |
|---|---|---|
p | integer | Page number (1-indexed). Defaults to 1. |
page_size | integer | Number of results per page. Defaults to 10. |
data array of log objects and a total count you can use for pagination.
Aggregated statistics
For a summary of your usage rather than individual request logs, callGET /api/data/self. This endpoint returns aggregated data — daily totals and model breakdowns — useful for tracking trends and forecasting costs.
Using logs to debug failed requests
When a request fails, the log entry records the HTTP status code and error message returned by the upstream provider. To find failed requests:Filter by status
In the console Logs view, use the Status filter to show only failed requests. Alternatively, query the API and filter for entries where the status field indicates an error.
Check the error message
Click the failed log entry to expand it. The Error field shows the upstream provider’s error message — for example,
rate_limit_exceeded or invalid_api_key.Identify the channel
Administrators can see which channel handled the request. If a specific channel is consistently failing, test it from the Channels page to verify connectivity.
Next steps
- API Tokens — Understand how quotas relate to token spending
- Channels — Learn how to test and troubleshoot upstream connections
- Management API: Logs — Full reference for log endpoints