By Fikra DevRel • 4 min read

Local Currency AI Inference API: Fikra Payment & Wallet Guide

Local Currency AI Inference API: Fikra Payment & Wallet Guide

Overview

Fikra API provides access to AI inference models through a token-credit wallet system. The platform integrates with Paystack for billing, and public documentation states that M-Pesa and card payments are accepted.

Note: If you are inquiring about a specific local currency or payment method not explicitly listed as M-Pesa or card, please confirm its availability directly with Fikra before attempting to use it. Fikra does not publish a fixed list of supported currencies beyond these methods.

What is a Token-Credit Wallet?

Fikra uses a prepaid token-credit wallet model. Instead of paying per request in real-time, you top up your account with credits. Each API call consumes tokens based on the model used and the length of the input/output. Your balance is deducted accordingly. This model allows for predictable cost management and immediate access to inference services once funds are available.

Account and Top-Up Flow

  1. Create an Account: Sign up for a Fikra account via the dashboard at https://fikraapi.co.ke.
  2. Generate API Key: Navigate to the API keys section in the dashboard to generate a live key (format: fk_live_...).
  3. Top Up Wallet: Use the billing section in the dashboard to add credits. Select your payment method (M-Pesa or Card) through the integrated Paystack checkout.
  4. Verify Balance: Ensure your token balance is sufficient before making API calls.

Monitoring Balance and Handling HTTP 402

Developers should implement logic to handle insufficient funds gracefully. When your token balance is depleted, the Fikra API will return an HTTP 402 Payment Required status code.

Best Practices:

  • Pre-Check: Query your account balance via the dashboard or available account endpoints before initiating high-volume batches.
  • Error Handling: Catch 402 responses in your application. Do not retry immediately; instead, alert the user or system administrator that a top-up is required.
  • Logging: Log the 402 event to track when credits run out, helping you plan future top-ups.

Example: Handling 402 in Python

import os
import requests

FIKRA_API_KEY = os.getenv("FIKRA_API_KEY")
BASE_URL = "https://api.fikraapi.co.ke/v1"

def make_request():
    headers = {
        "Authorization": f"Bearer {FIKRA_API_KEY}",
        "Content-Type": "application/json"
    }
    payload = {
        "model": "fikra-flash",
        "messages": [{"role": "user", "content": "Hello"}]
    }

    try:
        response = requests.post(f"{BASE_URL}/chat/completions", headers=headers, json=payload)
        if response.status_code == 402:
            print("Error: Insufficient token balance. Please top up your wallet.")
            return None
        response.raise_for_status()
        return response.json()
    except requests.exceptions.RequestException as e:
        print(f"Request failed: {e}")
        return None

result = make_request()

Security Advice

  • Never expose API keys in client-side code: Do not include your FIKRA_API_KEY in JavaScript, HTML, or any code that runs in the user's browser. This allows anyone to steal your key and drain your wallet.
  • Use Server-Side Proxies: Route all API calls from your backend server. Your server holds the API key and communicates with Fikra, then returns the result to the client.
  • Environment Variables: Store your API key in environment variables (e.g., FIKRA_API_KEY) on your server, not in source code.
  • Key Rotation: If you suspect a key has been compromised, revoke it in the Fikra dashboard and generate a new one immediately.

Important Notes

  • No Direct Payment APIs: Fikra does not offer a public API for processing payments. All top-ups must be done through the dashboard.
  • Currency Support: While M-Pesa and cards are supported, specific local currency support depends on Paystack's regional availability. Confirm with Fikra if you require support for a currency not covered by these methods.
  • No Refund Guarantees: Check Fikra's terms of service for details on refunds, as they are not guaranteed by default.

For the most up-to-date information on payment methods and wallet limits, refer to the Fikra dashboard or contact Fikra support directly.


JM
// The Founder

James Miano

CTO & ML Engineer at Lacesse Ventures. James specializes in low-overhead LLM quantization processes, custom ternary weights architectures, and localized server optimization.

Stop paying for overpriced round-trip latency

Why route queries over Western servers when you can use low-overhead hardware located in Nairobi? Save 87% on your monthly inference spend. No minimum credit limits. M-Pesa ready.

usagestatusdashboard