API Documentation & Developer Quickstart
All AI South Africa is a 100% OpenAI-compatible reverse proxy with local prepaid Rand billing.
Base URL & Authentication
Replace the standard OpenAI API base URL with our gateway and authenticate with your secret API key:
Base URL: https://aiproxy.farmazone.co.za/v1
Header requirement:
Authorization: Bearer sk-live-your_api_key_here
cURL Example
curl https://aiproxy.farmazone.co.za/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-live-your_api_key_here" \
-d '{
"model": "meta-llama/llama-3.3-70b-instruct",
"messages": [
{"role": "user", "content": "Hello from South Africa!"}
]
}'
Python (Official openai Library)
import os
from openai import OpenAI
client = OpenAI(
base_url="https://aiproxy.farmazone.co.za/v1",
api_key=os.environ.get("ALLAI_API_KEY", "sk-live-..."),
)
completion = client.chat.completions.create(
model="meta-llama/llama-3.3-70b-instruct",
messages=[
{"role": "system", "content": "You are a professional assistant."},
{"role": "user", "content": "Summarize POPIA in three bullets."},
],
temperature=0.7,
)
print(completion.choices[0].message.content)
Supported Gateway Endpoints
| Method | Path | Description |
|---|---|---|
| POST | /v1/chat/completions |
Generate chat completions with streaming (SSE) or buffered responses. |
| GET | /v1/models |
List all currently active and operational LLM models in OpenAI format. |
Error Handling & HTTP Status Codes
| Status | Code | Meaning |
|---|---|---|
| 401 Unauthorized | invalid_api_key |
Missing or revoked API key. |
| 402 Payment Required | insufficient_funds |
Prepaid wallet balance is insufficient to reserve in-flight token budget. |
| 429 Too Many Requests | rate_limit_exceeded |
Per-minute request limit or spend cap reached. |
| 502 Bad Gateway | upstream_error |
Upstream LLM provider returned a temporary error or timeout. |