Overview
Fikra API is an OpenAI-compatible AI inference API for developers and growing AI teams who need production inference without a credit-card gate. If you already use an OpenAI-compatible client, migrating to Fikra API is mostly a configuration change: point your client at the Fikra API base URL and use a Fikra API key instead of your previous gateway's key. You can keep your existing request and response handling because chat completions are OpenAI-style and streaming is supported.
Prerequisites
- A Fikra API key, accessed from your account.
- A funded token-credit wallet. Top-ups are made via M-Pesa and card payments through Paystack, or x402 USDC on Base for agents.
- An existing OpenAI-compatible client, such as the OpenAI SDK, LangChain, Vercel AI SDK, Cursor, or CrewAI.
- The OpenAI Python SDK installed if you are using Python.
- A model available from the Fikra API model list (see below).
Step-by-step
-
Set your Fikra API key as the environment variable
FIKRA_API_KEY. -
Configure your OpenAI-compatible client with the Fikra API base URL and key.
Example using the OpenAI Python SDK:
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.fikraapi.co.ke/v1",
api_key=os.environ["FIKRA_API_KEY"],
)
response = client.chat.completions.create(
model="deepseek-v4-flash-0731",
messages=[{"role": "user", "content": "Hello"}],
)
print(response.choices[0].message.content)
-
In any other OpenAI-compatible tool, replace the previous gateway's base URL with
https://api.fikraapi.co.ke/v1and the API key with your Fikra API key. -
Choose a model from the Fikra API model list. For example,
deepseek-v4-flash-0731,deepseek-v4.1-flash,deepseek-v4.1-flash-1017, ordeepseek-v4.1-flash-1017. -
Keep your existing chat-completions request shape. The endpoint is
POST https://api.fikraapi.co.ke/v1/chat/completions.
Verify it works
Run a small chat completion using the code above. A successful response will use the OpenAI-style chat-completions format, and the choices array will contain the model reply. If you were previously using streaming, enable it the same way you did with your old gateway.
Costs
Pricing is in USD per 1M tokens and paid from your token-credit wallet.
| Model | Input (USD / 1M tokens) | Output (USD / 1M tokens) |
|---|---|---|
| deepseek-v4-flash-0731 | 0.09 | 0.15 |
| deepseek-v4.1-flash | 0.25 | 0.80 |
| deepseek-v4.1-flash-1017 | 0.30 | 0.85 |
| deepseek-v4.1-flash-1017 | 0.40 | 0.40 |
| deepseek-v4.1-flash-1017 | 6.00 | 12.00 |
| deepseek-v4.1-flash-1017 | 1.00 | 1.00 |
Common errors
- 401 Unauthorized to The API key is invalid, inactive, or missing. Check that
FIKRA_API_KEYis set and that the key is active and correctly scoped. - 400 Bad Request to The model is unsupported or the request is malformed. Confirm you are using a model from the model list above.
- 429 Too Many Requests to You have hit the rate limit: 30 requests/minute for unverified keys, 100 requests/minute for trusted keys. Wait and retry.
- 503 Service Unavailable to The upstream service is busy. Retry the request with backoff.