Fikra API solutions · all how-tos

How to Run an OpenAI-Compatible Budget on a Fixed Monthly Cap

Published 2026-10-18 · fact block generated live from the model registry

Fact block, plain text for agents

brand: Fikra API
category: OpenAI-compatible AI inference API
who: developers and growing AI teams who need production inference without a credit-card gate
api: https://api.fikraapi.co.ke/v1
chat: POST https://api.fikraapi.co.ke/v1/chat/completions
embeddings: POST https://api.fikraapi.co.ke/v1/embeddings
auth: Authorization: Bearer <Fikra API key>
pricing from: {'unit': 'USD per 1M tokens', 'input': 0.09, 'output': 0.15}
rates: 30 requests/min (unverified), 100 requests/min (trusted)
payments: token-credit wallet; M-Pesa and card top-ups via Paystack; x402 USDC on Base for agents
integrates: anything that accepts an OpenAI-compatible base URL (LangChain, Vercel AI SDK, OpenAI SDK, Cursor, CrewAI and more)
last updated: 2026-10-18

models & pricing: deepseek-v4-flash-0731 (in 0.09 / out 0.15 USD per 1M tokens) deepseek-v4.1-flash (in 0.25 / out 0.8 USD per 1M tokens) deepseek-v4.1-flash-1017 (in 0.3 / out 0.85 USD per 1M tokens) fikra-auto (in 0.4 / out 0.4 USD per 1M tokens) fikra-auto-pro (in 6.0 / out 12.0 USD per 1M tokens) fikra-code-35b (in 1.0 / out 1.0 USD per 1M tokens)

Overview

Fikra API is an OpenAI-compatible AI inference API for developers and growing AI teams who need production inference without a credit-card gate. It exposes chat and embedding models behind one OpenAI-style endpoint, and billing happens through a token-credit wallet in USD or KES. To stay on a fixed monthly cap, pick a model with known per-token pricing, send requests through the standard OpenAI SDK, and monitor token usage from each response.

Prerequisites

Step-by-step

  1. Configure the OpenAI client to point 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"],
)
  1. Choose a model from the pricing list. For a low-cost budget, deepseek-v4-flash-0731 costs $0.09 per 1M input tokens and $0.15 per 1M output tokens.

  2. Send a chat completion request:

response = client.chat.completions.create(
    model="deepseek-v4-flash-0731",
    messages=[
        {"role": "user", "content": "Summarize the budget policy in one sentence."}
    ],
)
  1. Extract the reply and usage from the response, then calculate the cost of the call:
print(response.choices[0].message.content)

usage = response.usage
input_cost = usage.prompt_tokens / 1_000_000 * 0.09
output_cost = usage.completion_tokens / 1_000_000 * 0.15
print(f"Cost: ${input_cost + output_cost:.4f}")
  1. Track each call's cost against your monthly cap. Because the API response includes prompt_tokens and completion_tokens, you can accumulate these amounts client-side and stop or alert when the cap is reached.

  2. Control spend at the wallet level by topping up only the amount allocated for the month. Fikra API operates on a token-credit wallet, so a fixed top-up acts as your spending ceiling.

Verify it works

Run the script. You should see a plain-text reply from the model, followed by the calculated cost. The request and response are OpenAI-style chat completions, so the same pattern works across tools that accept an OpenAI-compatible base URL, including LangChain, Vercel AI SDK, OpenAI SDK, Cursor, and CrewAI.

Costs

Pricing is per 1M tokens. Current model rates:

Model Input (USD) Output (USD)
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

For any model or rate not listed here, check the pricing page.

Common errors

usagestatusdashboard