// API Reference v1.0
What is the Fikra API and how do I get started?
Fikra API exists to provide high-performance, OpenAI-compatible AI inference for developers in Africa. By serving as a unified proxy engine, we abstract the complexity of localized NPU infrastructure, allowing you to integrate world-class language models using familiar SDKs, powered entirely by transparent M-Pesa billing.
How does Fikra API infrastructure perform?
Our infrastructure acts as a secure cryptographic gateway to enterprise inference hardware. To ensure seamless migration, the Fikra API was engineered to strictly adhere to the OpenAI v1 REST specification. You only need to update your base URL and authenticate with your Fikra API Key.
| Specification Parameter | Production Value | Implementation Detail |
|---|---|---|
| Base URL | https://api.fikraapi.co.ke/v1 | The global endpoint for all inference routing. |
| Authentication Scheme | Authorization: Bearer | Requires active `fk_live_...` key generation. |
| Streaming Protocol | Server-Sent Events (SSE) | Supported via `stream: true` payload boolean. |
| SDK Compatibility | OpenAI SDK v1.0+ | Native support for Python, Node.js, Go, and Rust. |
What are the Fikra API production rate limits?
To guarantee high availability and protect our inference nodes from abusive scripts, Fikra API employs a Redis-backed Token Bucket algorithm. Your throughput capacity (RPM) is determined dynamically based on the verification status of your account ledger.
| Account Tier | Requirement | Request Limit (RPM) | Token Behavior |
|---|---|---|---|
| Unverified | Default state upon sign-up | 30 RPM | Uses initial free token allocation. |
| Trusted | First successful Paystack top-up | 100 RPM | Permanently unlocked for production scale. |
Note: Exceeding these limits will result in a standard `429 Too Many Requests` HTTP response.
Which Fikra API model should I choose?
Fikra API routes traffic to a curated selection of highly optimized open-weights models. Ensure you pass the exact model string in your JSON payload to avoid `400 Bad Request` routing errors.
| Model String ID | Context Window | Primary Use Case | Reasoning Depth |
|---|---|---|---|
| fikra-fast-8b | 8,192 tokens | Real-time chat, basic routing, summarization. | Low / Moderate |
| fikra-pro-20b | 32,768 tokens | Production workflows, agentic tasks, RAG. | High |
| fikra-pro-120b | 128,000 tokens | Complex coding, deep analysis, logical deduction. | Maximum |
How do I send my first inference request?
Because we map exactly to the OpenAI spec, you do not need to learn a new library. Below are examples of how to instantiate the client and request a chat completion in popular languages.
What does a successful API response look like?
When a request completes successfully, the Fikra API returns a standard `200 OK` JSON object. This object contains the generated text, a unique ID, and the exact token usage that was deducted from your global ledger.
What do Fikra API error codes mean?
Our gateway provides explicit error messaging to accelerate debugging. Below is the reference table for HTTP status codes returned by the `/v1` endpoint.
| Status Code | Error Definition | Resolution Path |
|---|---|---|
| 400 Bad Request | Unsupported Model / Invalid JSON | Verify your payload uses a valid Fikra model string. |
| 401 Unauthorized | Invalid API Key | Ensure your Bearer token matches your dashboard key exactly. |
| 402 Payment Required | Insufficient Balance | Your global token wallet is empty. Top up via M-Pesa. |
| 429 Too Many Requests | Rate Limit Exceeded | Implement exponential backoff or upgrade to Trusted Tier. |
| 500 Internal Error | Proxy Connection Failure | Check the Fikra API status page or contact developer support. |