API Overview & Architecture
The Fikra API is a standard RESTful interface designed to be an immediate drop-in replacement for OpenAI or Anthropic APIs. If you know how to build with global AI APIs, you already know how to build with Lacesse.
- Authentication: Secure your requests using standard Bearer Token authentication. Generate your unique API keys instantly in the Lacesse Developer Dashboard.
- Disruptive Pricing: Built for African scale. At just $0.002 per 1K inference tokens, Fikra provides enterprise-grade reasoning at a fraction of global market costs.
- Rate Limits & Scaling: Free tier users enjoy up to 60 Requests Per Minute (RPM). Paid tiers autoscale dynamically to support thousands of concurrent connections with 99.99% uptime.
- Zero Data Retention: By default, data passed through the API is not stored or used to train future Lacesse models, ensuring strict compliance with local data privacy laws.
Core Endpoints & Code Examples
Interact with the /v1/chat/completions endpoint to generate text, parse data, or simulate conversational memory. The API accepts standard JSON payloads.
cURL Example
curl -X POST "https://api.lacesse.co.ke/v1/chat/completions" \
-H "Authorization: Bearer YOUR_LACESSE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "fikra-7b-instruct",
"messages": [
{"role": "system", "content": "You are a helpful business assistant."},
{"role": "user", "content": "How do I optimize my M-Pesa till flow?"}
],
"temperature": 0.5,
"max_tokens": 512
}'
Python SDK Example
import os
from lacesse import FikraClient
client = FikraClient(api_key=os.environ.get("LACESSE_API_KEY"))
response = client.chat.completions.create(
model="fikra-ternary-v1",
messages=[{"role": "user", "content": "Jambo, how can I automate my inventory?"}]
)
print(response.choices[0].message.content)
Developer Integration Tutorials
Move from sandbox to production quickly with our official guides and open-source boilerplates.
- Integrating with React & Node.js: Learn how to set up Server-Sent Events (SSE) for streaming text responses directly to a web frontend.
- WhatsApp Business Chatbot Integration: A complete guide to connecting the Fikra API to Meta's WhatsApp API using webhooks to handle customer inquiries 24/7.
- Python SDK & LangChain Guide: How to use Fikra as your core LLM in LangChain for Retrieval-Augmented Generation (RAG) over PDF documents.
- JavaScript / TypeScript SDK Docs: Full type definitions and examples for Edge functions (Vercel/Cloudflare).
Developer FAQ & Troubleshooting
Common questions regarding API keys, limits, and integration workflows.
How do I get a Fikra API key?
Simply sign up at the Lacesse Developer Portal. Once your email is verified, you can generate your API key instantly. The first $5 in API credits are free for sandbox testing.
Is the Fikra API compatible with OpenAI's format?
Yes. The Fikra API routes, payload structures, and JSON responses are designed to be a 1:1 drop-in replacement for the OpenAI API. You can switch to Fikra simply by changing the base URL and API key in your existing codebase.
Do you have SDKs for Python and JavaScript?
Yes. We maintain official, open-source SDKs for both Python (available via pip) and JavaScript/TypeScript (available via npm). Documentation for both can be found in our GitHub repositories.
What are the rate limits on the API?
Free tier (sandbox) keys are limited to 60 Requests Per Minute (RPM) and 10,000 Tokens Per Minute (TPM). Production tier accounts automatically scale to handle enterprise traffic, with custom limits available upon request.
Can I use the API to build WhatsApp bots?
Absolutely. Fikra's low latency and native Swahili NLP make it the perfect backend engine for WhatsApp Business bots. We provide webhook boilerplates to get your WhatsApp integration running in under an hour.
Is my API data stored or used for training?
No. Lacesse enforces a strict zero-data-retention policy for API payloads. Your prompts and completions are never logged, stored, or utilized to train future AI models, ensuring complete enterprise security.
What is the maximum context window supported?
The standard Fikra-7B-Instruct model supports a context window of 32,000 tokens, allowing you to pass extensive conversation histories, codebases, or multiple documents in a single API call.
How does Fikra API pricing compare to global alternatives?
Fikra is engineered for African market economics. At roughly $0.002 per 1,000 tokens, it is significantly cheaper than global competitors, while offering superior localization and offline edge options.