Operations
Errors
The API uses standard HTTP status codes. A 2xx status means success. Errors return a JSON body with an error field.
Status codes
| Status | Meaning | What to do |
|---|---|---|
400 | The request body is not valid JSON, or the model ID is unknown. | Fix the request. Check model IDs with GET /models. |
401 | The API key is missing or invalid. | Send a valid key in the Authorization header. |
429 | More than one request in two seconds with the same key. | Wait for Retry-After seconds, then retry. |
Error bodies
Errors come in two shapes. Authentication errors use the OpenAI error object. Other errors return error as a string, sometimes with a type. Handle both by checking the HTTP status first.
401 Invalid API key
{
"error": {
"message": "Invalid API key",
"type": "invalid_request_error",
"code": "invalid_api_key"
}
}400 Invalid request body
Returned when the body cannot be parsed as JSON.
{"error":"Invalid request body","type":"invalid_request_error"}400 Unknown model
{"error":"Unknown model 'no-such-model'. See GET /api/v1/models."}429 Rate limit exceeded
{"error":"Rate limit exceeded: one request every two seconds per API key. Retry in 2s.","type":"rate_limit_error"}Comes with a Retry-After header. See Rate limits.
Handling errors with the SDKs
The OpenAI SDKs raise typed errors based on the status code: AuthenticationError for 401, BadRequestError for 400 and RateLimitError for 429. Each exposes the HTTP status and the response body.
import openai
try:
response = client.chat.completions.create(
model="ganymede-1.1",
messages=[{"role": "user", "content": "Hello"}],
)
except openai.AuthenticationError:
print("Check MERKIUM_API_KEY")
except openai.RateLimitError:
print("Slow down: one request every two seconds per key")
except openai.APIStatusError as error:
print(error.status_code, error.response.text)Questions or problems with the API: mail@merkium.nl. Last verified against the live API on October 20, 2026.