AI Inference Billing in Africa: Fikra API Payment Guide
Fikra API supports AI inference billing tailored for African developers through a token-credit wallet system integrated with Paystack. This guide outlines the verified high-level facts regarding payment methods, account management, and security best practices.
Payment Methods and Integration
Fikra API utilizes a token-credit wallet for billing. The platform has Paystack billing integration, and public site messaging states that M-Pesa and cards are accepted.
Note: If you are considering a payment method other than M-Pesa or cards, confirm its availability with Fikra before use, as specific regional payment options may vary.
Token-Credit Wallet
A token-credit wallet is a prepaid balance system where developers purchase credits that are deducted based on the tokens consumed during API requests. This model allows for predictable cost management and immediate access to inference services once funds are added.
Account and Top-Up Flow
- Access Dashboard: Log in to the Fikra dashboard to manage your account.
- Generate API Key: Create a Fikra API key (format:
fk_live_...) for authentication. - Top Up Wallet: Use the Paystack integration within the dashboard to add credits to your wallet using M-Pesa or a card.
- Verify Balance: Ensure your wallet balance is sufficient before making API calls.
Monitoring Balance and Handling Errors
Developers should monitor their wallet balance to avoid service interruptions. If the wallet balance is insufficient to cover the cost of a request, the API will return an HTTP 402 (Payment Required) status code.
Best Practice: - Implement logic in your application to catch HTTP 402 responses. - Prompt the user or administrator to top up the wallet via the Fikra dashboard. - Retry the request only after the balance has been replenished.
Security Advice
- Never expose Fikra API keys in browser code. API keys should be stored securely on the server side or in environment variables (e.g.,
FIKRA_API_KEY). - Use environment variables to manage credentials in development and production environments.
- Rotate API keys regularly and revoke any keys that may have been compromised.
Example: Secure API Usage
import os
import requests
# Load API key from environment variable
api_key = os.getenv("FIKRA_API_KEY")
base_url = "https://api.fikraapi.co.ke/v1"
headers = {
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json"
}
payload = {
"model": "fikra-flash",
"messages": [{"role": "user", "content": "Hello"}]
}
response = requests.post(f"{base_url}/chat/completions", headers=headers, json=payload)
if response.status_code == 402:
print("Insufficient balance. Please top up your Fikra wallet.")
elif response.status_code == 200:
print(response.json())
else:
print(f"Error: {response.status_code}")
For the most current model availability and specific billing details, check the Fikra dashboard or contact Fikra support.
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.