How does billing and token tracking work?

Fikra API replaces complex subscriptions with a highly predictable, unified pay-as-you-go model. By decoupling billing mechanics from fluctuating multi-model compute costs, your global developer account maintains a single credit ledger denominated in US Dollars ($), fundable instantly through Safaricom M-Pesa.


Unified Token Economics

We believe infrastructure planning should be frictionless. Unlike alternative platforms that implement tiered micro-pricing grids based on distinct parameters, Fikra API enforces an absolute flat-rate matrix across every model in our repository.

Model Allocation Profile Inference Base Unit Pricing Shilling Equivalence (Approx.)
fikra-fast-8b 2,000,000 tokens / $1.00 USD ~ KES 130 per 2M tokens
fikra-pro-20b 2,000,000 tokens / $1.00 USD ~ KES 130 per 2M tokens
fikra-pro-120b 2,000,000 tokens / $1.00 USD ~ KES 130 per 2M tokens

Real-time Deduction: Token usage balances count input and output allocations cumulatively per API transaction. Deductions hit your global ledger instantly at completion. If a running transaction pushes your balance to 0, the session terminates cleanly and successive connection steps emit a 402 Payment Required error payload.

Automated Top-Ups via Safaricom M-Pesa

To maximize accessibility for developers across East Africa, our platform integrates directly into Safaricom’s Daraja API network layer. This bypasses the need for traditional credit cards, allowing instant infrastructure provisioning directly from your mobile device.

The STK Push Top-Up Flow

  1. Navigate to the billing portal within your Developer Dashboard.
  2. Input your target funding amount in Kenya Shillings (KES) alongside your active Safaricom mobile phone number (formatted as 2547XXXXXXXX). Payments are handled based on your country and locally supported payment method.
  3. The system computes the active mid-market foreign exchange conversion rate to display your prospective USD credit enhancement.
  4. Clicking "Initiate Top-Up" fires an instantaneous secure command package down to your device, presenting an overlay requesting your M-Pesa PIN.

Synchronous Balance Synchronization

When you key in your security PIN on your phone handset, Safaricom finishes processing the transaction loop internally and triggers our downstream transaction listeners via an Instant Payment Notification (IPN) web hook.

Transaction Step Duration Gateway Lifecycle Stage Infrastructure Performance Metrics
Step 1 (< 800ms) PIN Input Handshake Safaricom validates funds availability and locks the ledger assets securely.
Step 2 (< 1000ms) Webhook Dissemination Secure cryptographic callbacks register onto the Fikra billing cluster.
Step 3 (< 400ms) Ledger Calibration The user's database entry shifts upward, resetting 429 filters and unlocking the Trusted tier.

The full turnaround latency completes within approximately 2.2 seconds but may last up to 5 seconds. There is no requirement to manually cycle API keys or execute container refreshes; existing connection pools immediately acquire the updated resource boundaries.

Manual Paybill Fallback Path

We do not yet have a fall back, but we say that we will be adding it soon


← Previous Topic

Error Codes & Responses

Deconstruct server validations and identify client runtime exception classes.

Next Topic →

Dashboard Overview

Visualize resource expenditure charts, cycle active API tokens, and access live logs.