> ## Documentation Index
> Fetch the complete documentation index at: https://docs.crazyrouter.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Status Codes

> Status code reference for all API types

> 更新日: 2026-06-06

## HTTP Status Codes

| Status Code | Description              | Recommended Action                                                     |
| ----------- | ------------------------ | ---------------------------------------------------------------------- |
| 200         | Request successful       | -                                                                      |
| 400         | Bad request parameters   | Check request body format and parameters                               |
| 401         | Authentication failed    | Check if API Key is correct                                            |
| 403         | Insufficient permissions | Check if the token has access to the requested model                   |
| 404         | Resource not found       | Check URL path                                                         |
| 429         | Rate limit exceeded      | Reduce request frequency or contact admin                              |
| 500         | サーバー側 5xx エラー            | リトライ可。CrazyRouter 内部エラーの場合もあれば、上流 5xx を CrazyRouter 経由で返している場合もあります    |
| 502         | ゲートウェイまたは上流結果取得失敗        | 通常は CrazyRouter が上流呼び出し段階までは到達したものの、有効な上流レスポンスまたは結果を取得できなかった状態です。リトライ可 |
| 503         | Service unavailable      | System maintenance in progress                                         |

## 500 と 502 の違い

* `500` はより広いサーバー側エラーです。CrazyRouter では、当社側の内部エラーを指す場合もあれば、上流が返した `5xx` をそのまま中継している場合もあります。
* `502` はより具体的で、CrazyRouter から上流への接続や結果取得の段階で失敗したことを示します。たとえば、上流が到達不能、無効なゲートウェイ応答、または生成結果 URL の取得失敗などです。
* 同じ問題が続く場合:
  * `502` が多いときは、上流の可用性、接続性、結果 URL の取得可否を優先して確認してください。
  * `500` が多いときは、エラー分類やログで切り分けてください。`site_internal` や panic 系として明示されたものだけを CrazyRouter 側の問題として扱うのが適切です。

## Chat Completions Error Codes

```json theme={null}
{
  "error": {
    "message": "Error description",
    "type": "error_type",
    "code": "error_code"
  }
}
```

| code                      | Description                              |
| ------------------------- | ---------------------------------------- |
| `invalid_api_key`         | API Key is invalid or expired            |
| `insufficient_quota`      | Insufficient balance                     |
| `model_not_found`         | Model does not exist or is not enabled   |
| `context_length_exceeded` | Input exceeds model context length limit |
| `rate_limit_exceeded`     | Rate limit exceeded                      |
| `content_filter`          | Content blocked by safety filter         |

## Midjourney Task Status Codes

| Status        | Description           |
| ------------- | --------------------- |
| `NOT_START`   | Task not started      |
| `SUBMITTED`   | Submitted             |
| `IN_PROGRESS` | Generating            |
| `SUCCESS`     | Generation successful |
| `FAILURE`     | Generation failed     |
| `CANCEL`      | Cancelled             |

### MJ Error Codes

| code | Description           |
| ---- | --------------------- |
| 1    | Submission successful |
| 21   | Task already exists   |
| 22   | Queued                |
| 23   | Queue full            |
| 24   | Submission failed     |

## Kling Video Status Codes

| Status       | Description                   |
| ------------ | ----------------------------- |
| `queued`     | Submitted or waiting in queue |
| `processing` | Processing                    |
| `succeeded`  | Generation successful         |
| `failed`     | Generation failed             |

## Jimeng Task Status Codes

| Status       | Description                   |
| ------------ | ----------------------------- |
| `queued`     | Submitted or waiting in queue |
| `processing` | Processing                    |
| `succeeded`  | Generation successful         |
| `failed`     | Generation failed             |

## Luma Video Status Codes

| Status       | Description |
| ------------ | ----------- |
| `pending`    | Pending     |
| `processing` | Processing  |
| `completed`  | Completed   |
| `failed`     | Failed      |

## Suno Music Status Codes

| Status       | Description |
| ------------ | ----------- |
| `submitted`  | Submitted   |
| `processing` | Generating  |
| `complete`   | Completed   |
| `error`      | Error       |

## Runway Video Status Codes

| Status      | Description |
| ----------- | ----------- |
| `PENDING`   | Pending     |
| `RUNNING`   | Generating  |
| `SUCCEEDED` | Succeeded   |
| `FAILED`    | Failed      |

## General Error Handling Recommendations

<Warning>
  When encountering a 429 error, do not retry immediately. Use an exponential backoff strategy, starting with a 1-second wait and doubling each time.
</Warning>

```python theme={null}
import time
import requests

def request_with_retry(url, headers, json_data, max_retries=3):
    for i in range(max_retries):
        response = requests.post(url, headers=headers, json=json_data)
        if response.status_code == 429:
            wait = 2 ** i
            print(f"Rate limited, waiting {wait} seconds before retrying...")
            time.sleep(wait)
            continue
        return response
    return response
```
