Overview
Fikra API is an OpenAI-compatible inference API that lets you send chat-completion requests to run models behind a single https://api.fikraapi.co.ke/v1 endpoint. Because requests and responses follow the OpenAI chat-completions format, you can use standard OpenAI SDK tooling to process earnings-call transcripts and return a summary. This page shows how to build a morning script that reads a transcript, asks a model to summarize it, and prints the result.
Prerequisites
- A Fikra API key. Set it as an environment variable named
FIKRA_API_KEY. - Python with the
openaiSDK installed. - A transcript file you want to summarize (for example,
transcript.txt). - The API base URL:
https://api.fikraapi.co.ke/v1. - A model from your Fikra API account. The example below uses
deepseek-v4-flash-0731.
Step-by-step
- Configure the OpenAI client to point at Fikra API and read your key from the environment.
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.fikraapi.co.ke/v1",
api_key=os.environ["FIKRA_API_KEY"],
)
- Load the transcript and send it to the chat completions endpoint with a summarization instruction.
transcript = open("transcript.txt").read()
response = client.chat.completions.create(
model="deepseek-v4-flash-0731",
messages=[
{"role": "system", "content": "You summarize earnings calls."},
{"role": "user", "content": f"Summarize this earnings call:\n\n{transcript}"},
],
)
print(response.choices[0].message.content)
- Run the script each morning using a scheduler such as cron. The script reads the latest transcript, calls
POST https://api.fikraapi.co.ke/v1/chat/completions, and outputs the summary.
Verify it works
Run the script with a sample transcript. If the API key is valid and the model name is correct, you should see a plain-text summary printed to the console. The response is an OpenAI-style chat-completion object, so you can inspect response.choices[0].message.content for the summary text.
Costs
Pricing is per model. The example model deepseek-v4-flash-0731 costs USD 0.09 per 1M input tokens and USD 0.15 per 1M output tokens. Other models on the platform have different prices; check the pricing page before picking a model. Payments are handled through a token-credit wallet with M-Pesa and card top-ups via Paystack, and x402 USDC on Base for agent use.
Common errors
- 401 to The API key is missing, invalid, or inactive. Check that
FIKRA_API_KEYis set and the key is still valid. - 400 to The requested model is not supported. Verify the model name against the models available on your account.
- 429 to You hit the rate limit: 30 requests/min for unverified keys, 100 requests/min for trusted keys. Slow down or wait.
- 503 to The upstream service is busy. Retry the request with exponential backoff.