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

# Introduction

> Base URL, authentication, request format, and error handling for the Starrise AI API.

## Base URL

All API requests are sent to:

```
https://dayu.cdn-fly.com/
```

## Authentication

Starrise AI uses Bearer Token authentication. Include your API key in the `Authorization` header of every request:

```
Authorization: Bearer YOUR_API_KEY
```

You can generate and manage API keys in the [Console](https://dayu.cdn-fly.com/console/token?lang=en).

> [!WARNING]
>
> Keep your API key secure. Do not expose it in client-side code or public repositories.

## Request Format

All requests must use `Content-Type: application/json` with a JSON-encoded request body.

```bash theme={null}
curl https://dayu.cdn-fly.com/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-3-5-sonnet-20241022",
    "messages": [
      {"role": "user", "content": "Hello!"}
    ]
  }'
```

## Supported Endpoints

| Endpoint | Description |
| - | - |
| `POST /v1/chat/completions` | Chat completion (OpenAI-compatible) |
| `POST /v1/images/generations` | Image generation (ByteDance Seedream) |
| `POST /v1/video/generations` | Video generation (ByteDance Seedance) |
| `GET /v1/video/generations/{id}` | Query video generation task status |
| `POST /kling/v1/videos/text2video` | Kuaishou Kling text-to-video |
| `POST /kling/v1/videos/image2video` | Kuaishou Kling image-to-video |
| `POST /kling/v1/videos/multi-image2video` | Kuaishou Kling multi-image-to-video |
| `GET /kling/v1/videos/{id}` | Query Kling task status |

## Response Format

All responses are JSON-encoded. Successful responses typically contain:

```json theme={null}
{
  "id": "chatcmpl-abc123",
  "object": "chat.completion",
  "model": "claude-3-5-sonnet-20241022",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Hello! How can I help you?"
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 10,
    "completion_tokens": 12,
    "total_tokens": 22
  }
}
```

## Error Handling

When an error occurs, the API returns a JSON response containing an `error` object:

```json theme={null}
{
  "error": {
    "message": "The provided API key is invalid.",
    "type": "authentication_error",
    "code": "invalid_api_key"
  }
}
```

### HTTP Status Codes

| Status Code | Description |
| - | - |
| `200` | Success |
| `400` | Bad Request — invalid parameters |
| `401` | Unauthorized — API key missing or invalid |
| `403` | Forbidden — insufficient permissions |
| `404` | Not Found — invalid endpoint |
| `429` | Rate Limit Exceeded — too many requests |
| `500` | Internal Server Error |

## Rate Limits

Rate limits vary by model and subscription tier. When rate limits are exceeded, the API returns a `429` status code. We recommend implementing exponential backoff to handle rate limits gracefully.

## OpenAI SDK Compatibility

Starrise AI is compatible with the OpenAI SDK. Simply change the `base_url` to use it:

```python Python theme={null}
from openai import OpenAI

client = OpenAI(
    api_key="YOUR_API_KEY",
    base_url="https://dayu.cdn-fly.com/v1"
)
```

```javascript Node.js theme={null}
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: "YOUR_API_KEY",
  baseURL: "https://dayu.cdn-fly.com/v1",
});
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.