How-to

Schedule Daily LLM Jobs with Cron and a Credit Balance

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

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 lets you run chat and embedding models behind one OpenAI-style endpoint and pay in USD or KES. This page shows how to schedule a daily LLM job using cron and a token-credit wallet balance.

Prerequisites

  • A Fikra API key. Keep it secret and set it as the FIKRA_API_KEY environment variable.
  • A token-credit wallet with a sufficient balance. Top up via M-Pesa or card through Paystack, or use x402 USDC on Base for agent workloads.
  • The openai Python SDK installed (pip install openai).
  • A cron daemon available on your system.

Step-by-step

  1. Create a Python script that calls the chat completions endpoint. The API base URL is https://api.fikraapi.co.ke/v1.
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 produce a concise daily summary."},
        {"role": "user", "content": "Summarize today's operational report."},
    ],
)

print(response.choices[0].message.content)
  1. Test the script manually with FIKRA_API_KEY exported and a funded wallet. The request and response formats are OpenAI-style chat completions, so the SDK works as-is.

  2. Add a cron entry to run the script at your chosen time. For example, run it daily at 09:00:

0 9 * * * cd /path/to/project && python daily_job.py
  1. Make sure your wallet balance stays topped up. Each scheduled run consumes credits from your token-credit wallet according to the model's pricing.

Verify it works

Run the script once manually and confirm it prints a completion from the model. Then add the cron entry and check the job output after the first scheduled run. If you want a different model, swap model in the request to any model listed below.

Costs

Pricing is in USD per 1M tokens. Input and output are billed separately. Available models:

Model Input (USD/1M) Output (USD/1M)
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 Unauthorized to the API key is invalid, inactive, or missing. Check the key and the FIKRA_API_KEY environment variable.
  • 400 Bad Request to the requested model is not supported. Use a model from the list above.
  • 429 Too Many Requests to rate limit exceeded. Unverified keys get 30 requests/min; trusted keys get 100 requests/min. Space out your scheduled calls or request trusted status.
  • 503 Service Unavailable to the upstream service is busy. Retry the request with exponential backoff.

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