Overview
Fikra API is an OpenAI-compatible inference API. You send chat-completions requests to one base URL and choose a model per request, so you can compare candidate models on your own prompts before committing a workload to one of them. This page shows how to run that comparison with the OpenAI Python SDK and how to read the cost differences between the models listed here.
This page covers only the models and prices published in the Fikra API fact block. For any model name you have seen elsewhere , including long-context or reasoning-labelled variants , check the pricing page for current availability, context limits, and pricing before you build around it.
Prerequisites
- A Fikra API key. Keys are scoped and revocable, and are never shared between users.
- Python with the OpenAI SDK installed (
pip install openai). - Your key exported as an environment variable,
FIKRA_API_KEY. Keep secrets server-side in your own code, as in the examples below.
Step-by-step
- Set the base URL and key. Every request uses
https://api.fikraapi.co.ke/v1and the headerAuthorization: Bearer <Fikra API key>. The SDK reads both from the client object:
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.fikraapi.co.ke/v1",
api_key=os.environ["FIKRA_API_KEY"],
)
-
Pick your candidate models. The chat endpoint is
POST https://api.fikraapi.co.ke/v1/chat/completions. The models published with pricing are: -
deepseek-v4-flash-0731 deepseek-v4.1-flashdeepseek-v4.1-flash-1017fikra-autofikra-auto-profikra-code-35b
If your workload depends on a specific context window or on a reasoning mode, check the pricing page to confirm which of these supports it. Do not assume it from the model name.
- Run the same prompt through each candidate. Keep the prompt, system message, and parameters identical so the only variable is the model:
candidates = [
"deepseek-v4-flash-0731",
"deepseek-v4.1-flash",
"deepseek-v4.1-flash-1017",
]
prompt = "Your representative task goes here."
for model in candidates:
response = client.chat.completions.create(
model=model,
messages=[{"role": "user", "content": prompt}],
)
print(model)
print(response.choices[0].message.content)
print("-" * 40)
-
Score the outputs yourself. Compare the responses against your own acceptance criteria for the job , for example, how much of a long input the answer actually uses, or how well the answer holds up on multi-step problems. Fikra API does not publish benchmark results, so the decision has to come from your own evaluation data.
-
Switch to streaming if you need incremental output. Streaming is supported on the OpenAI-style chat-completions response. Add
stream=Trueto the same call and iterate over chunks. -
Fix the model in your application config. Once you have a winner, set it as a single configuration value rather than editing call sites, so you can move a workload to a different model later without a code change.
Verify it works
Send one request with the model you selected and confirm you get a normal chat-completions response object back:
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.1-flash",
messages=[{"role": "user", "content": "Reply with the single word: ready"}],
)
print(response.choices[0].message.content)
A returned message means your base URL, key, and model name are all accepted. Anything else , see below.
Costs
Pricing is quoted in USD per 1M tokens, split between input and output.
| Model | Input | Output |
|---|---|---|
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 |
fikra-auto |
0.40 | 0.40 |
fikra-auto-pro |
6.00 | 12.00 |
fikra-code-35b |
1.00 | 1.00 |
Pricing starts at 0.09 USD per 1M input tokens and 0.15 USD per 1M output tokens.
Billing runs through a token-credit wallet. You top up by M-Pesa or card via Paystack, in USD or KES, and agents can pay with x402 USDC on Base. Because input and output are priced separately, a model that is cheaper per input token is not automatically cheaper for output-heavy work , check the pricing page before you commit to a high-volume workload.
Common errors
- 401 Unauthorized , the key is wrong, malformed, or inactive. Confirm
FIKRA_API_KEYholds a current key and that the header isAuthorization: Bearer <key>. - 400 Bad Request , usually an unsupported model name. Check the model string against the list above, and check the pricing page for models not listed here.
- 429 Too Many Requests , you have hit the rate limit: 30 requests/min for unverified accounts, 100 requests/min for trusted accounts. Back off and retry.
- 503 Service Unavailable , the upstream model is busy. Retry with exponential backoff; do not treat it as a permanent failure.
Last updated: 2026-10-18