Merkium

Search Merkium

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

StatusMeaningWhat to do
400The request body is not valid JSON, or the model ID is unknown.Fix the request. Check model IDs with GET /models.
401The API key is missing or invalid.Send a valid key in the Authorization header.
429More 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

401 Unauthorized
{
  "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.

400 Bad Request
{"error":"Invalid request body","type":"invalid_request_error"}

400 Unknown model

400 Bad Request
{"error":"Unknown model 'no-such-model'. See GET /api/v1/models."}

429 Rate limit exceeded

429 Too Many Requests
{"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.

Python
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.