Developer API
Reliability, errors, and rate limits
Build retry-safe requests with idempotency, stable error codes, response headers, and cost safeguards.
Updated 30 Sept 2026
Make every POST idempotent
Send an Idempotency-Key containing 8 to 255 letters, numbers, underscores, or hyphens. The key is scoped per API key and retained for 24 hours; retry the same logical operation with the same value.
# identical resend after a network timeout
curl https://oppermind.com/api/v1/images \
-H "Authorization: Bearer $OPPERMIND_API_KEY" \
-H "Idempotency-Key: order-58213-hero-image" \
-H "Content-Type: application/json" \
-d '{"prompt":"product photo of a walnut desk lamp on white","n":1}'{
"model": "oppermind-lato-1-vision",
"data": [
{
"url": "/api/v1/images/proxy?token=…"
}
],
"usage": {
"images_generated": 1
}
}Handle errors by meaning
400 means the request is invalid or asks for something the current model version cannot do (OPMD_CAPABILITY_001), 401 the key is missing or invalid, 402 credits are insufficient, 403 permission, IP or usage policy blocked the call, 404 the file or endpoint does not exist, 409 the same idempotent operation is still running, 413 the body is over 31 MB, 422 a document could not be read, and 429 the rate limit was exceeded. A 502 with OPMD_EMPTY_001 means the model returned no answer, for example it ran out of output tokens, and nothing was charged. Other 5xx responses indicate a gateway or server problem.
curl https://oppermind.com/api/v1/messages \
-H "Authorization: Bearer $OPPERMIND_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"oppermind-lato-1","max_tokens":400,"messages":[{"role":"user","content":"Draft a welcome email for new members."}]}'{
"error": {
"type": "billing_error",
"code": "OPMD_BILLING_001",
"message": "Insufficient credits. Add credits at oppermind.com/developers"
}
}Use stable machine codes
Branch on error.code rather than parsing prose. Safe messages can be surfaced to users, and X-Request-ID belongs in logs and support reports. When the model rejects a request, for example an unreadable image, the code is OPMD_UPSTREAM_400, error.message gives the reason and nothing is charged. /chat/completions, /responses and /files errors also carry param, the field that caused the error.
curl https://oppermind.com/api/v1/messages \
-H "Authorization: Bearer $OPPERMIND_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"oppermind-lato-1","prompt":"Draft a welcome email for new members."}'{
"error": {
"type": "invalid_request",
"code": "OPMD_MODEL_001",
"message": "messages must be a non-empty array."
}
}Respect RateLimit headers
Every response carries RateLimit information. Slow down before exhausting the budget, add jitter to retryable backoff, and do not retry validation, authentication, permission, or billing failures unchanged.
curl https://oppermind.com/api/v1/messages \
-H "Authorization: Bearer $OPPERMIND_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"oppermind-lato-1","max_tokens":60,"messages":[{"role":"user","content":"Tag this ticket: refund request."}]}'{
"error": {
"type": "rate_limit_error",
"code": "OPMD_RATE_001",
"message": "Too many requests for this API key. Slow down."
}
}Protect spend
Bound max_tokens (default 16384, up to 128000, with reasoning tokens counted as output), image count, duration, and concurrency in your own application. Read the current AUD rates from GET /api/v1/pricing, log billing.charged_aud from every text response, monitor usage and credits, set billing alerts, and place expensive generation behind user authorization.
# max_tokens bounded by your own cap of 1500
curl https://oppermind.com/api/v1/messages \
-H "Authorization: Bearer $OPPERMIND_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"oppermind-lato-1","max_tokens":1500,"messages":[{"role":"user","content":"Write the product page copy for the walnut desk lamp."}]}'{
"id": "req_6c1f9b3e7a5d2c8f4b0e6a1d",
"model": "oppermind-lato-1",
"type": "message",
"content": [
{
"type": "text",
"text": "Warm walnut, clean lines. The lamp gives a soft pool of light for reading and dims to a night glow with one touch."
}
],
"usage": {
"input_tokens": 24,
"output_tokens": 212,
"cache_read_input_tokens": 0,
"cache_creation_input_tokens": 0,
"reasoning_tokens": 0
},
"stop_reason": "end_turn",
"tool_usage": {},
"billing": {
"charged_aud": "0.000870"
}
}Practise this in Oppermind Academy
Follow the related tutorial or course and apply the concept to a real task.
