Overview
Fikra API exposes OpenAI-style chat completions at POST https://api.fikraapi.co.ke/v1/chat/completions. Because every model takes the same request shape, you can send one identical prompt to two different models and compare the outputs directly , just change the model field between calls.
Fikra API's published model list includes deepseek-v4-flash-0731 and other DeepSeek variants. It does not list a GLM 5.3 model ID, so check the pricing page for the exact model name and availability before running the GLM side of the comparison. If no GLM ID is listed, the second run will fail with a 400 (see Common errors).
Prerequisites
- A Fikra API key, stored as the environment variable
FIKRA_API_KEYand kept server-side. Keys are scoped and revocable and are never shared between users. - Python with the
openaiSDK installed. - The exact model IDs you want to compare. Use
deepseek-v4-flash-0731for the DeepSeek side; check the pricing page for the GLM 5.3 ID.
Step-by-step
1. Point the OpenAI SDK at Fikra API.
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.fikraapi.co.ke/v1",
api_key=os.environ["FIKRA_API_KEY"],
)
Authentication is sent as Authorization: Bearer <Fikra API key>; the SDK adds this for you from the environment variable.
2. Write one function that takes a model name and a prompt. Keeping the prompt in a single constant is what makes the comparison fair , both runs send byte-identical input.
PROMPT = "Explain what an idempotency key is, in two sentences."
def run(model: str) -> str:
response = client.chat.completions.create(
model=model,
messages=[{"role": "user", "content": PROMPT}],
)
return response.choices[0].message.content
3. Run the same prompt against both models. Replace the GLM placeholder with the model ID from the pricing page.
models = [
"deepseek-v4-flash-0731",
"glm-5.3", # replace with the exact ID from the pricing page
]
for model in models:
print(f"=== {model} ===")
print(run(model))
print()
4. Read the two outputs side by side. Same prompt, same endpoint, same request schema , only the model value differs. Note that each call is billed separately.
5. If you want to compare token cost, print the usage block. Chat-completion responses include token counts, so you can see how long each answer was before applying the per-1M-token rates.
response = client.chat.completions.create(
model="deepseek-v4-flash-0731",
messages=[{"role": "user", "content": PROMPT}],
)
print(response.usage)
Verify it works
- Each run prints a non-empty string under its own
=== model ===header. - Swapping the model value changes the output while the prompt stays the same.
response.usagereturns prompt and completion token counts for each call.- Streaming works the same way (set
stream=Trueon the chat-completions call) if you'd rather watch tokens arrive than wait for the full answer.
Costs
Billed per 1M tokens, in USD, separately for 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 |
Prices are USD per 1M tokens. A comparison run costs the sum of both calls, so pairing a cheap model against an expensive one widens the gap quickly on long prompts. Check the pricing page for the rate of any model not in this table, including GLM 5.3.
Payment runs through a token-credit wallet; top-ups are by M-Pesa or card via Paystack, and x402 USDC on Base is available for agents.
Common errors
- 401 Unauthorized , the key is wrong or inactive. Confirm
FIKRA_API_KEYholds a current key; keys are scoped and revocable, so a rotated key must be replaced in your environment. - 400 Bad Request , the model ID isn't supported. This is the likely result if the GLM 5.3 ID is mistyped or not offered; check the pricing page for the exact string.
- 429 Too Many Requests , you've hit the rate limit: 30 requests/min on unverified accounts, 100 requests/min on trusted accounts. Slow the loop down or add spacing between the two calls.
- 503 Service Unavailable , the upstream model is busy. Retry with exponential backoff rather than resending immediately.
Last updated: 2026-10-18