AI Gateway API Reference OpenAPI 3.1v1.0.0 Live
Production endpoint specification, payload schemas, live active provider telemetry, error handling, and Swift iOS integration snippets.
POST /api/v1/ai/complete
Unified gateway endpoint for cloud AI workflows. Dispatches to active providers with automatic transparent failover, server-side JWT authentication, paid subscription gatekeeping, and zero-prompt cost telemetry.
Authorization:
Bearer <supabase_jwt> Paid Tier Gated
OCR Receipt & Invoice ScanningtaskType: "ocr"
Single-pass extraction of merchant, grand total, currency, ISO transaction date, itemized rows, and expense category from receipt images or photos.
Recommended: DeepSeek Chat (V3) / OpenAI GPT-4o-mini
Request Schema & Field Specification
| Field | Type | Required | Description |
|---|---|---|---|
| taskType | string | REQUIRED | Must be "ocr" |
| payload.image_base64 | string | REQUIRED | Base64 image data URL or raw string |
| payload.mime_type | string | OPTIONAL | MIME type: image/jpeg, image/png, image/heic |
| payload.country_hint | string | OPTIONAL | ISO 3166-1 alpha-2 hint (e.g. US, IN, GB) |
| options.temperature | number | OPTIONAL | Sampling temp (default: 0.1 for high precision) |
Sample Request Body (JSON)
application/json
request_ocr.json
{
"taskType": "ocr",
"payload": {
"image_base64": "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDA...",
"mime_type": "image/jpeg",
"country_hint": "US"
},
"options": {
"temperature": 0.1,
"maxTokens": 1000
}
}Normalized 200 OK Response Contract
HTTP 200
response_ocr.json
{
"success": true,
"task_type": "ocr",
"request_id": "req_9f8e7d6c5b4a3",
"data": {
"merchant": "Whole Foods Market",
"amount": 42.85,
"currency": "USD",
"date": "2026-09-13",
"category_suggestion": "Food & Dining",
"confidence": 0.98,
"items": [
{
"description": "Organic Honeycrisp Apples",
"price": 6.99,
"quantity": 1
},
{
"description": "Almond Milk Unsweetened",
"price": 3.99,
"quantity": 1
},
{
"description": "Wild Alaskan Salmon",
"price": 31.87,
"quantity": 1
}
]
},
"usage": {
"prompt_tokens": 380,
"completion_tokens": 110,
"total_tokens": 490
}
}