# CGRateS

Real-time charging and rating engine for telecom and ISPs, driven entirely by JSON-RPC APIs.

CGRateS rates sessions and events in real time, keeps account balances and bundles, logs CDRs, and runs routing, thresholds and stats as micro-services. Everything is configured in cgrates.json and tariff-plan CSVs and driven through its RPC APIs, which is why the API is the product. Telecom-specific, long-lived, AGPL.

- Capabilities: adaptable, operable
- Vertical: invoicing-finance
- Shape: business-app
- Form factor: api
- Execution model: deterministic
- Provenance: human-written (recorded, never ranked)
- Repo: https://github.com/cgrates/cgrates (AGPL-3.0), 512 stars, last commit 2026-08-28
- Last activity: 2026-08-28
- Page: apps/cgrates--cgrates.html
- JSON: apps/cgrates--cgrates.json

## Use it when

- I run a VoIP or ISP service and need prepaid balances and per-second rating that my softswitch can call
- I want an agent to set up rates, load tariff plans and query CDRs without a dashboard

## Gotchas

- Telecom-specific vocabulary (CDRs, tariff plans, LCR); not a general invoicing tool
- AGPL-3.0
- Sits next to a softswitch; not useful on its own

## Editions

- Free: Free, open source
  - source: https://github.com/cgrates/cgrates
  - installable: apt-get install cgrates

## Adaptable: make it yours

Effort: config-only (2 things to edit)

Everything is a JSON config: enable subsystems, storage backends and switch agents in /etc/cgrates/cgrates.json, then load tariff plans (rates, destinations, accounts) from CSVs with cgr-loader. No code edits for a working deployment; expect to learn telecom charging concepts.

- Env vars: none
- Config files: /etc/cgrates/cgrates.json, data/tariffplans/*.csv
- Prompt files: none
- Accounts you'll need: none

## Operable: what an agent can drive

Operability: official. Interface: api at https://cgrates.readthedocs.io/en/latest/ (published by the builder, local).

### Reach (complete coverage)

- Rate calls and events (RALs): reachable. APIerS exposes rating profiles and rates; docs 'Rating engine'
- Real-time session charging with reservation: reachable. SessionS service over JSON-RPC (docs subsystems list)
- Account balances and bundles: reachable. APIerS account and balance calls; README 'Account Balances Management with bundle support'
- CDR logging and export: reachable. CDRs service; README 'CDR logging with support for Interim Records'
- Least-cost routing: reachable. RouteS service; README 'QoS LCR and LCR over Bundles'
- Fraud thresholds and automatic mitigation: reachable. ThresholdS service; README 'Fraud detection with automatic mitigation'
- Statistics and pattern monitoring: reachable. StatS, TrendS, RankingS services
- Load tariff plans: reachable. cgr-loader CLI and APIerS load calls documented in tutorials
- Switch integration (FreeSWITCH, Kamailio, Asterisk): reachable. agents in docs tutorial; configured in cgrates.json

## Code stack

- Languages: Go
- Frameworks: none
- Package manager: go modules
- Database: Redis, MongoDB, MySQL, PostgreSQL
- Hosting target: Debian packages, Docker, bare metal

## Evidence and confidence

- formFactor: micro-services with 'rich set of RPC APIs' (README) (confidence 0.9)
- executionModel: rating engine, no model at runtime (confidence 0.95)
- operability: JSON-RPC APIs documented at cgrates.readthedocs.io by the Builder; apier package on pkg.go.dev (confidence 0.9)
- effort: cgrates.json config and tariff-plan CSVs per docs tutorials (confidence 0.75)
- editions: README: open source, commercial support available; no paid edition seen (confidence 0.9)
- active: GitHub pushedAt 2026-08-28
- reach:  (confidence 0.7)

## Open questions

- Confirm the exact default config path and whether Docker images are official
- Whether there is a Redis-only minimal deployment for small operators

## Sources

- https://github.com/cgrates/cgrates (sourcing:invoicing-finance:curated)
- https://cgrates.readthedocs.io/en/latest/ (sourcing:invoicing-finance:curated)
