# Apify Credits Monitoring (`alkausari_mujahid/apify-credits-monitoring`) Actor

Track credit balances and spending across your own or client Apify accounts. See remaining credit, days until reset, spending trends, and top cost drivers — catch overages early and stop letting prepaid credits expire unused. Read-only; tokens are encrypted and never appear in output.

- **URL**: https://apify.com/alkausari\_mujahid/apify-credits-monitoring.md
- **Developed by:** [Alkausari M](https://apify.com/alkausari_mujahid) (community)
- **Categories:** Automation, Developer tools, Integrations
- **Stats:** 1 total users, 1 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $5.00 / 1,000 results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js/docs.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python/docs.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

**Apify Credits Monitoring** is a **read-only** Actor that tracks [Apify](https://apify.com) usage credits across one or more accounts — your own, or client organizations that have explicitly shared their API token with you. For each account it reports the **current billing cycle** (included vs. used credits, remaining balance, days until reset) and walks back through past billing cycles to build a **usage history** with averages, trends, and top cost drivers.

Because it runs on the Apify platform, you get API access to the results, scheduling (e.g., a weekly credit check), integrations, and monitoring out of the box.

### Why use Apify Credits Monitoring?

- **Never lose prepaid credit** — see which accounts have unused credit about to reset.
- **Spot overages early** — accounts that exceeded their included allowance are flagged.
- **Understand spend** — per-service cost breakdown shows what actually drives usage (compute, proxy, storage…).
- **Agency-friendly** — monitor many client accounts in one run, one dataset row per client.
- **Safe by design** — it only sends read `GET` requests. It never starts runs, changes settings, or writes to any monitored account.

### How to use Apify Credits Monitoring

1. Open the Actor and go to the **Input** tab.
2. Add the API tokens of the accounts to monitor as a JSON array, e.g. `["apify_api_…"]` — to monitor your own account, paste a token from Apify Console (**Settings → API & Integrations**). Account names are looked up automatically.
3. Optionally set how many past billing cycles to analyze (default 6).
4. Click **Start** and open the **Output** tab, or **Schedule** the Actor for a recurring credit check.

### Input

| Field | Type | Description |
| --- | --- | --- |
| `tokens` | array | **Required.** API tokens of the accounts to monitor: `["apify_api_…", "apify_api_…"]`. **Secret input** — encrypted before storage, decrypted only inside the run. Account name and username are fetched from the API. |
| `months` | integer | Past billing cycles to pull per account (default 6, max 24). |

Tokens are used only for authentication of read requests and are **never written to the output**.

### Output

One dataset row per monitored account. In Apify Console, the **Output** tab renders the results as a sortable table — the **Credit snapshot** view shows every account's current cycle at a glance, and the **History stats** view summarizes spending across past cycles. Example of the Credit snapshot view:

| # | Client | Plan | Included $ | Used $ | Left $ | % Used | Days left | Trend | Usage (old→new) | Top cost driver |
|---|--------|------|-----------:|-------:|-------:|-------:|----------:|-------|-----------------|-----------------|
| 1 | Acme Care Group | STARTER | 29 | 3.87 | 25.13 | 13.3 | 16 | n/a | ▁ | PAID_ACTORS_PER_EVENT |
| 2 | Northwind Automations | FREE | 5 | 0.74 | 4.26 | 14.8 | 14 | n/a | ▁ | PAID_ACTORS_PER_EVENT |
| 3 | DACH Leads GmbH | STARTER | 29 | 1.08 | 27.92 | 3.7 | 9 | n/a | ▁ | PROXY_RESIDENTIAL_TRANSFER_GBYTES |
| 4 | Harvest Farm Co | STARTER | 29 | 0 | 29 | 0 | 26 | n/a | ▁ | PAID_ACTORS_PER_EVENT |
| 5 | Beacon Reviews | STARTER | 39 | 0.05 | 38.95 | 0.1 | 25 | n/a | ▁ | PAID_ACTORS_PER_EVENT |
| 6 | Windward Org | STARTER | 29 | 0 | 29 | 0 | 14 | n/a | ▁ | DATASET_TIMED_STORAGE_GBYTE_HOURS |
| 7 | Optiva Labs | STARTER | 29 | 5.37 | 23.63 | 18.5 | 2 | n/a | ▁ | PAID_ACTORS_PER_EVENT |

Simplified JSON example of one row:

```json
{
    "name": "Acme Ltd",
    "username": "acme",
    "plan": "STARTER",
    "included_credits_usd": 49,
    "used_usd": 31.2,
    "remaining_usd": 17.8,
    "pct_used": 63.7,
    "cycle_end": "2026-07-19T00:00:00.000Z",
    "days_left": 12,
    "overage": false,
    "hist_avg_usd": 28.4,
    "trend": "rising",
    "spark": "▁▃▄▅▆█",
    "top_service": "DATA_TRANSFER_EXTERNAL_GBYTES",
    "history": [{ "start": "…", "end": "…", "total_usd": 24.1, "services": { "…": 12.3 } }]
}
````

You can download the dataset in various formats such as JSON, HTML, CSV, or Excel.

### Data fields

| Field | Meaning |
| --- | --- |
| `included_credits_usd` / `used_usd` / `remaining_usd` | Current-cycle allowance, spend, and what's left |
| `pct_used`, `days_left`, `overage` | How far into the allowance and the cycle the account is |
| `hist_avg_usd`, `hist_min_usd`, `hist_max_usd`, `hist_cycles` | Stats across **completed** billing cycles (the in-progress cycle is excluded so it doesn't skew averages and trends; it appears in `history` flagged `"partial": true`) |
| `trend`, `trend_pct`, `spark` | Rising / steady / falling spend, with a text sparkline |
| `avg_unused_usd` | Typical unused credit per cycle (assumes the current plan applied historically) |
| `top_services`, `history` | Per-service cost drivers and the full per-cycle detail |

### How much does it cost to monitor Apify credits?

Very little — the Actor only makes a handful of lightweight API requests per account (roughly `2 + months` requests each), so runs finish in seconds and consume minimal compute. Monitoring the accounts costs orders of magnitude less than the credits it helps you keep track of.

### Tips

- **Schedule it** weekly or a few days before your billing cycle resets to catch idle credit in time.
- History depth is limited by Apify's data retention; cycles older than retention are skipped automatically.
- Billing cycles are anchored to each account's signup day, not calendar months — the Actor handles this by walking cycles back one by one.

### FAQ, disclaimers, and support

**Is it safe to give this Actor a client's token?** The Actor sends only read `GET` requests to Apify's official API (`/users/me`, `/users/me/limits`, `/users/me/usage/monthly`). The `tokens` input is a [secret input field](https://docs.apify.com/platform/actors/development/actor-definition/input-schema/secret-input): tokens are encrypted (AES-256-GCM + RSA) before being saved, appear only as `ENCRYPTED_VALUE:…` in the run detail, Console, and API, and are decrypted only inside the Actor run itself. They are never written to the dataset or logs (logs show at most the last 4 characters). Only share tokens with the explicit consent of their owner, and prefer scoped/limited-permission tokens where possible.

**Why is history shorter than requested?** Older cycles fall outside Apify's data retention and are skipped.

Found a bug or need an extra metric? Please open an issue in the **Issues** tab.

# Actor input Schema

## `tokens` (type: `array`):

Apify API tokens of the accounts to monitor, as a JSON array of strings, e.g. \["apify\_api\_..."]. Find or create a token in Apify Console under Settings > API & Integrations. Stored encrypted (secret input) and decrypted only inside the Actor run. The account name and username are fetched automatically from the API; tokens are used for read-only GET requests only and are never written to the dataset.

## `months` (type: `integer`):

How many past billing cycles to pull per account. Older cycles may fall outside Apify's data retention and are skipped automatically.

## Actor input object example

```json
{
  "months": 6
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {};

// Run the Actor and wait for it to finish
const run = await client.actor("alkausari_mujahid/apify-credits-monitoring").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {}

# Run the Actor and wait for it to finish
run = client.actor("alkausari_mujahid/apify-credits-monitoring").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{}' |
apify call alkausari_mujahid/apify-credits-monitoring --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=alkausari_mujahid/apify-credits-monitoring",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Apify Credits Monitoring",
        "description": "Track credit balances and spending across your own or client Apify accounts. See remaining credit, days until reset, spending trends, and top cost drivers — catch overages early and stop letting prepaid credits expire unused. Read-only; tokens are encrypted and never appear in output.",
        "version": "1.0",
        "x-build-id": "WS4U4vsaZmLOoFo6h"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/alkausari_mujahid~apify-credits-monitoring/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-alkausari_mujahid-apify-credits-monitoring",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/alkausari_mujahid~apify-credits-monitoring/runs": {
            "post": {
                "operationId": "runs-sync-alkausari_mujahid-apify-credits-monitoring",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/alkausari_mujahid~apify-credits-monitoring/run-sync": {
            "post": {
                "operationId": "run-sync-alkausari_mujahid-apify-credits-monitoring",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "tokens"
                ],
                "properties": {
                    "tokens": {
                        "title": "API tokens (encrypted)",
                        "minItems": 1,
                        "type": "array",
                        "description": "Apify API tokens of the accounts to monitor, as a JSON array of strings, e.g. [\"apify_api_...\"]. Find or create a token in Apify Console under Settings > API & Integrations. Stored encrypted (secret input) and decrypted only inside the Actor run. The account name and username are fetched automatically from the API; tokens are used for read-only GET requests only and are never written to the dataset."
                    },
                    "months": {
                        "title": "Billing cycles of history",
                        "minimum": 1,
                        "maximum": 24,
                        "type": "integer",
                        "description": "How many past billing cycles to pull per account. Older cycles may fall outside Apify's data retention and are skipped automatically.",
                        "default": 6
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
