API Docs
Nija exposes an OpenAI-compatible API. Point any OpenAI SDK at https://nija.africa/v1 with your Nija key. The Chat Completions API is the surface that ports: a call your code already makes to chat.completions.create runs on Nija with the base URL and the key changed and nothing else.
Chat completions
curl https://nija.africa/v1/chat/completions \
-H "Authorization: Bearer $NIJA_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"openai/gpt-4o-mini","messages":[{"role":"user","content":"Habari"}]}'Streaming, tool calls, and routing
These are ordinary request fields on the endpoint above, forwarded to the model as sent, so an existing OpenAI SDK reaches all three without a line of Nija-specific code. Send "stream": true to receive the reply as server-sent events, closed by the standard [DONE] sentinel. Send tools (or the older functions) to let a model call your own functions; the schemas you send count as input tokens and are priced like the rest of the prompt. Send models as a list of slugs to fall back through them in order, and provider to express a preference for who serves the request. Appending :nitro to a model slug asks for the highest-throughput provider and :floor for the cheapest.
Your account's sovereignty settings merge into every request and can only make it stricter, never looser: a per-request preference can narrow what a saved default allows, and cannot widen it.
Models
GET /v1/models lists every model with Nija pricing facets and African-language tags. Create keys under Keys; top up under Credits; control data residency under Data Sovereignty.
Presets
Save a model, a system prompt (the standing instruction the model follows on every call) and generation parameters once as a preset, then reference it by slug instead of inlining the whole config. The Presets page sets the model, the system prompt and the temperature, top_p and max_tokens parameters; set any other parameter through the API below. To use a preset, add "preset": "<slug>" to your /v1/chat/completions request body alongside your messages. Any field you also send on that request overrides the matching preset field, and a system message of your own takes the place of the preset's system prompt. The response's nija object echoes preset_applied with the slug and version that actually ran. An unknown or deleted slug returns a 400.
You can also manage presets programmatically over the same api-key or session auth, so the whole lifecycle runs from CI or a deploy script. POST /v1/presets creates one from a JSON body with name and slug (both required) and optional model (a model id from GET /v1/models; when the preset has none, your completion request must name one or it returns a 400), system_prompt (the instruction, as a string) and parameters (an object of generation settings such as temperature or max_tokens). Field names must match exactly: an unrecognised field is ignored without an error, and so is anything in parameters that is not a generation setting. Re-saving a slug with POST adds a new version holding only what that body sends. GET /v1/presets lists your presets (latest version per slug, each with its id). PUT /v1/presets/<id> updates one and keeps every field you leave out, so sending only system_prompt changes the instruction and leaves the model and settings as they were. DELETE /v1/presets/<id> removes the preset and every version of it. Every call is scoped to the presets you own.
# Create a preset
curl https://nija.africa/v1/presets \
-H "Authorization: Bearer $NIJA_KEY" \
-H "Content-Type: application/json" \
-d '{"name":"Swahili helper","slug":"swahili-helper","model":"openai/gpt-4o-mini","system_prompt":"Always reply in Swahili, in one short sentence.","parameters":{"temperature":0.2}}'
# List your presets, each with its id
curl https://nija.africa/v1/presets \
-H "Authorization: Bearer $NIJA_KEY"
# Add an instruction to an existing preset ($PRESET_ID is its id from the list)
curl -X PUT https://nija.africa/v1/presets/$PRESET_ID \
-H "Authorization: Bearer $NIJA_KEY" \
-H "Content-Type: application/json" \
-d '{"system_prompt":"Always reply in Swahili, in one short sentence."}'
# Use the preset on a completion
curl https://nija.africa/v1/chat/completions \
-H "Authorization: Bearer $NIJA_KEY" \
-H "Content-Type: application/json" \
-d '{"preset":"swahili-helper","messages":[{"role":"user","content":"Habari"}]}'Agents (MCP)
Nija also speaks the Model Context Protocol, so an agent host can call Nija models as tools using the same key and the same billed path. See the MCP quickstart for the endpoint, a copy-paste client configuration, a worked example per tool, and the refusal codes to branch on.
Partners
Partners: ask us for API access at hello@nija.africa.
Usage and credits
What a call cost comes back with the call. Every chat completion response carries a nija object holding price_local, what that call cost, and currency, the account currency it is charged in, alongside the request_id and the model that actually served it. With stream: true the same object arrives as the last server-sent event before the [DONE] sentinel, so neither form needs a second request to price a call.
Nija also reports usage and cost through the API. GET /v1/credits returns account balance and total usage; GET /v1/generation?id= returns the model, tokens, and cost of a single completion; GET /v1/key returns the limit, usage, and reset window for a key, with its name and id: the name you gave it and the key ID shown under that name on Keys.
Questions about topping up, prices or privacy rather than code? The help articles answer them in plain words.
Changes and status
What changed in the API, the models and the prices is recorded in the changelog, newest first. Whether the platform is working right now, and the incidents it has had, is on platform status.
Found a security flaw in Nija? Reporting a security flaw says what is in scope and how to look using only your own account and your own data.