By Fikra Support • 3 min read

Troubleshooting SLA Guarantees and API Errors

Troubleshooting SLA Guarantees and API Errors

Understanding SLA Guarantees

Fikra API does not currently publish uptime SLAs, dedicated capacity guarantees, or automatic failover mechanisms. Availability depends on the underlying infrastructure and upstream providers. For production workloads, implement client-side resilience patterns such as retries with exponential backoff.

Common HTTP Error Codes

Code Meaning Action
400 Malformed request or unsupported model alias Validate request body structure and confirm the model alias is listed in the Fikra model registry.
401 Missing, invalid, or inactive API key Verify the Authorization: Bearer fk_live_... header and ensure the key is active in the Fikra dashboard.
402 Insufficient wallet balance Top up your token-credit wallet via the Fikra dashboard using Paystack (M-Pesa or cards).
429 Rate limit exceeded Unverified accounts are limited to 30 RPM; trusted accounts to 100 RPM. Implement backoff and retry logic.
503 Upstream/provider temporarily unavailable Retry with exponential backoff. This indicates a transient issue on the provider side.

Exponential Backoff Example (429 and 503)

Use the following Python example to handle rate limits and transient upstream errors:

import time
import random
import requests

FIKRA_API_KEY = "your_api_key_here"  # Load from environment variable in production
BASE_URL = "https://api.fikraapi.co.ke/v1"

def call_fikra_api(payload, max_retries=5):
    url = f"{BASE_URL}/chat/completions"
    headers = {
        "Authorization": f"Bearer {FIKRA_API_KEY}",
        "Content-Type": "application/json"
    }

    for attempt in range(max_retries):
        response = requests.post(url, headers=headers, json=payload)

        if response.status_code in (429, 503):
            # Exponential backoff with jitter
            wait_time = (2 ** attempt) + random.uniform(0, 1)
            print(f"Received {response.status_code}. Retrying in {wait_time:.2f}s...")
            time.sleep(wait_time)
            continue

        if response.status_code == 402:
            raise Exception("Insufficient wallet balance. Please top up in the Fikra dashboard.")

        if response.status_code == 401:
            raise Exception("Invalid or inactive API key. Check your credentials.")

        if response.status_code == 400:
            raise Exception(f"Bad request: {response.text}")

        return response.json()

    raise Exception("Max retries exceeded for 429/503 errors.")

# Example usage
payload = {
    "model": "fikra-flash",
    "messages": [{"role": "user", "content": "Hello"}]
}

try:
    result = call_fikra_api(payload)
    print(result)
except Exception as e:
    print(f"Error: {e}")

Notes

  • Rate limits are enforced per account: 30 RPM for unverified accounts and 100 RPM for trusted accounts.
  • Do not assume automatic failover or dedicated capacity. Design your application to handle transient failures gracefully.
  • For model availability, always check the Fikra model registry in the dashboard.

JM
// The Founder

James Miano

CTO & ML Engineer at Lacesse Ventures. James specializes in low-overhead LLM quantization processes, custom ternary weights architectures, and localized server optimization.

Stop paying for overpriced round-trip latency

Why route queries over Western servers when you can use low-overhead hardware located in Nairobi? Save 87% on your monthly inference spend. No minimum credit limits. M-Pesa ready.

usagestatusdashboard