How-to

Build a customer support bot using Fikra API credit

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

Overview

Fikra API is an OpenAI-compatible AI inference API designed for developers and growing AI teams who need production inference without a credit-card gate. You can build a customer support bot by sending chat messages to a single OpenAI-style endpoint. The endpoint is https://api.fikraapi.co.ke/v1/chat/completions, and each request is billed to your token-credit wallet. Credits are purchased with M-Pesa or card top-ups via Paystack, or with x402 USDC on Base for agent-based workflows.

Prerequisites

  • A Fikra API key, stored in an environment variable named FIKRA_API_KEY.
  • A Python environment with the OpenAI SDK installed.
  • Credit in your token wallet.
  • A supported model from the Fikra API model list, for example deepseek-v4-flash-0731.

Step-by-step

  1. Create a client pointing to the Fikra API base URL and your API key.

  2. Prepare a messages list that includes a system prompt defining your support bot’s behavior and a user message with the customer’s question.

  3. Send the messages to the chat completions endpoint using one of the available models.

  4. Read the assistant reply from response.choices[0].message.content and route it back to the customer through your frontend channel.

Example code:

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": "system",
            "content": "You are a concise customer support assistant.",
        },
        {
            "role": "user",
            "content": "How do I track my order?",
        },
    ],
)

print(response.choices[0].message.content)

The same base_url and model name can be used from any tool that accepts an OpenAI-compatible base URL, such as LangChain, Vercel AI SDK, Cursor, and CrewAI.

Verify it works

Run the script above and confirm that a printed response is generated. The request should complete without error, and the output should be a plain-text assistant message. Note that streaming is supported, so you can also enable stream=True to deliver tokens incrementally.

Costs

Fikra API bills per 1 million tokens. The cost depends on the model you select:

Model Input price (USD / 1M tokens) Output price (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

These charges are deducted from your token-credit wallet, which you top up before use.

Common errors

  • 401 Unauthorized to your API key is missing, invalid, or inactive. Check that FIKRA_API_KEY is set correctly.
  • 400 Bad Request to the requested model is not supported. Use a model from the list above or check the current model catalog.
  • 429 Too Many Requests to you have hit a rate limit. Limits are 30 requests per minute for unverified accounts and 100 requests per minute for trusted accounts. Reduce request frequency or request a trusted account.
  • 503 Service Unavailable to the upstream service is busy. Retry the request with exponential backoff.

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