# Errors

Page: https://galatea.co/api/docs/errors

Every failure has the same OpenAI-style body, and the SDKs turn it into a typed exception.

A failed request returns the HTTP status and a body with an error object: message, type, param and code. Branch on code. The message is for people and can change.

```json
{"error": {"message": "...", "type": "invalid_request_error", "param": "model", "code": "model_not_found"}}
```

```python
import os
import openai
from openai import OpenAI

client = OpenAI(base_url="https://api.galatea.co/v1", api_key=os.environ["GALATEA_API_KEY"], max_retries=0)
try:
    client.chat.completions.create(model="no-such-model", messages=[{"role": "user", "content": "Hi"}])
except openai.RateLimitError as error:
    print("wait", error.response.headers.get("Retry-After"), "seconds, then retry")
except openai.APIStatusError as error:
    print(error.status_code, error.code, error.message)
```

Every code, its status and whether a retry helps is in the Errors table of the API reference.
