How-to

Batch 1,000 Chat Completions Without Hitting Rate Limits

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

Overview

Fikra API is an OpenAI-compatible inference API. You can send chat completion requests to https://api.fikraapi.co.ke/v1/chat/completions using the OpenAI SDK. Rate limits are 30 requests/min for unverified accounts and 3,000 requests/min for trusted accounts. To batch 1,000 requests, throttle your client to stay under your current limit.

Prerequisites

  • A Fikra API account with token credits.
  • An API key set as the FIKRA_API_KEY environment variable.
  • Python with the OpenAI SDK installed.

Step-by-step

  1. Set your API key:

bash export FIKRA_API_KEY=your_api_key_here

  1. Create a client with the Fikra API base URL:

```python from openai import OpenAI import os import time

client = OpenAI( base_url="https://api.fikraapi.co.ke/v1", api_key=os.environ["FIKRA_API_KEY"], ) ```

  1. Choose a model. For example:

python MODEL = "deepseek-v4-flash-0731"

  1. Loop over your 1,000 payloads and send one request at a time. Sleep between requests to stay within the rate limit:

```python messages_list = [...] # your 1,000 chat message lists

responses = [] for messages in messages_list: response = client.chat.completions.create( model=MODEL, messages=messages, ) responses.append(response.choices[0].message.content) time.sleep(2) # for 30 req/min; use 0.6 if your account is trusted ```

Use time.sleep(2) to stay under 30 requests/min, or time.sleep(0.6) if your account is trusted and you can use 100 requests/min.

  1. Handle each response as needed. The response format is OpenAI-style.

Verify it works

  • Confirm each request returns a chat completion with a choices field.
  • Count the successful responses in responses.
  • Check that your request rate never exceeds the limit for your account level.

Costs

Pricing is 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.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

Common errors

  • 401 to Bad or inactive API key. Confirm FIKRA_API_KEY is set and the key is active.
  • 400 to Unsupported model. Use a model listed above.
  • 429 to Rate limit exceeded. Stay within 30 requests/minute (unverified) or 3,000 requests/minute (trusted).
  • 503 to Upstream busy. Retry with backoff.

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