How-to

Serve Multiple Client Workloads Under One Fikra API Key

Last updated 2026-11-25. Facts are checked against the live registry.

Overview

One Fikra API key can back multiple client workloads , different features, apps, or internal teams , as long as the key stays on your server and never appears in client-side code. Fikra API exposes an OpenAI-compatible endpoint, so your backend can act as a single gateway that injects the key and forwards requests to https://api.fikraapi.co.ke/v1. Because Fikra API keys are scoped and revocable, you can rotate or revoke one key without redistributing credentials to every consumer.

Prerequisites

  • A Fikra API key.
  • Python 3.9+ with the openai SDK installed (pip install openai).
  • Server-side access to the API base URL https://api.fikraapi.co.ke/v1.

Step-by-step

  1. Create or retrieve your Fikra API key from the dashboard.
  2. Store the key in the environment variable FIKRA_API_KEY on your server. Never embed it in client applications.
  3. On your backend, create an OpenAI client:
import os
from openai import OpenAI

client = OpenAI(
    base_url="https://api.fikraapi.co.ke/v1",
    api_key=os.environ["FIKRA_API_KEY"],
)
  1. Write a wrapper that routes a given workload to a specific model. Use a model name from the Fikra API model list:
def run_workload(system_prompt, user_prompt, model="deepseek-v4-flash-0731"):
    completion = client.chat.completions.create(
        model=model,
        messages=[
            {"role": "system", "content": system_prompt},
            {"role": "user", "content": user_prompt},
        ],
    )
    return completion.choices[0].message.content
  1. Expose that wrapper to your clients through an internal HTTP endpoint or service. Clients send their prompts to your service, and your service calls Fikra API with the shared key.
  2. Assign each workload a model based on its needs. Available models and their prices are listed in the Costs section below.

Verify it works

Run a quick test on one workload:

print(run_workload(
    system_prompt="You are a helpful assistant.",
    user_prompt="Say hello.",
))

If the request succeeds, your one API key is serving that workload. Add other workloads by calling run_workload with different messages and model names.

Costs

Billing is per token and paid through your Fikra token-credit wallet. Prices are in USD per 1M tokens:

Model Input (USD / 1M tokens) Output (USD / 1M tokens)
deepseek-v4-flash-0731 0.09 0.15
deepseek-v4.1-flash 0.25 0.8
deepseek-v4.1-flash-1017 0.3 0.85
deepseek-v4.1-flash-1017 0.4 0.4
deepseek-v4.1-flash-1017 6.0 12.0
deepseek-v4.1-flash-1017 1.0 1.0

Total cost depends on the token volume generated by all workloads sharing your key.

Common errors

  • 401 , Bad or inactive API key. Confirm FIKRA_API_KEY is set correctly and the key is active.
  • 400 , Unsupported model. Use one of the model names listed in the Costs section.
  • 429 , Rate limit exceeded. Unverified keys get 30 requests/min; trusted keys get 100 requests/min.
  • 503 , Upstream service is busy. Retry with exponential backoff.

Live prices -> · Agent account -> · SDKs ->