Blame

80ef53 admin 2024-08-22 15:54:43 1
# AI-Now Image and Video Generation API Documentation
2
3
## Introduction
4
5
This API provides access to various AI models for generating music, images, and videos based on text prompts. It supports multiple models with different capabilities and token costs.
6
7
## Authentication
8
9
Authentication is required for all API requests. Use Bearer token authentication by including an API key in the Authorization header:
10
11
```
12
Authorization: Bearer YOUR_API_KEY
13
```
14
15
To obtain an API key, contact [email protected].
16
17
## API Endpoints
18
19
### Ping
20
21
Endpoint: `GET /api/ping`
22
23
Use this endpoint to check if the API is operational.
24
25
**Response:**
26
```
27
pong
28
```
29
30
### Generate
31
32
Endpoint: `POST /api/generate`
33
34
This endpoint generates music, images, or videos based on the specified model and prompt.
35
36
**Request Body:**
37
38
```json
39
{
40
"model": "string",
41
"prompt": "string",
42
"style": "string" (optional)
43
}
44
```
45
46
- `model`: The AI model to use (e.g., "suno", "luma", "pika", "run")
47
- `prompt`: The text prompt for generation
48
- `style`: Optional style parameter for some models
49
50
**Response:**
51
52
The response is a server-sent event stream. Events include:
53
54
- Processing updates
55
- Error messages
56
- Final result with generated content URL
57
58
## Models
59
60
1. **Suno** (Music Generation)
61
- Token Cost: 10
62
- Generation Time: 1-3 minutes
63
64
2. **Luma** (Video Generation)
65
- Token Cost: 30
66
- Generation Time: Variable, may fail during peak hours
67
68
3. **Pika** (Video Generation)
69
- Token Cost: 10
70
- Generation Time: 1-3 minutes
71
72
4. **Run** (Video Generation)
73
- Token Cost: 30
74
- Generation Time: 1-3 minutes
75
76
## Styles
77
78
### Pika API Styles
79
80
- Anime (value: '1')
81
- Moody (value: '2')
82
- 3D (value: '3')
83
- Watercolor (value: '4')
84
- Natural (value: '5')
85
- Claymation (value: '6')
86
- Black & White (value: '7')
87
88
### Run API Styles
89
90
- Abandoned (value: 'abandoned')
91
- Abstract Sculpture (value: 'abstract_sculpture')
92
- Anime (value: 'anime')
93
- Cartoon (value: 'cartoon')
94
- Cine Lens (value: 'cine_lens')
95
- Claymation (value: 'claymation')
96
- Concept Art (value: 'concept_art')
97
- Digital Art (value: 'digital_art')
98
- Forestpunk (value: 'forestpunk')
99
- Frost (value: 'frost')
100
- Graphic Novel (value: 'graphic_novel')
101
- Graphite (value: 'graphite')
102
- Isometric 3D (value: 'isometric_3d')
103
- Low Poly 3D (value: 'low_poly_3d')
104
- Marker Drawing (value: 'marker_drawing')
105
- Moody Film (value: 'moody_film')
106
- Pixel Art (value: 'pixel_art')
107
- Retro (value: 'retro')
108
- Sci-fi Art (value: 'sci_fi_art')
109
- Stickers (value: 'stickers')
110
- Storyboard (value: 'storyboard')
111
- Thriller (value: 'thriller')
112
- 3D Cartoon (value: '3d_cartoon')
113
- 3D Render (value: '3d_render')
114
- 80s Vaporwave (value: '80s_vaporwave')
115
116
## Error Handling
117
118
The API returns appropriate HTTP status codes and error messages:
119
120
- 401: Unauthorized (missing or invalid API key)
121
- 418: Insufficient tokens
122
- 500: Internal Server Error
123
124
Error responses are in JSON format:
125
126
```json
127
{
128
"status": "Error",
129
"message": "Error description"
130
}
131
```
132
133
## Rate Limiting and Tokens
134
135
Each API key has a token balance. Tokens are deducted for each generation request based on the model used. Ensure your account has sufficient tokens before making requests.
136
137
## Examples
138
139
### Generate a song using Suno
140
141
**Request:**
142
143
```bash
144
curl -X POST https://api.ai-now.space/api/generate \
145
-H "Authorization: Bearer YOUR_API_KEY" \
146
-H "Content-Type: application/json" \
147
-d '{
148
"model": "suno",
149
"prompt": "A upbeat pop song about summer"
150
}'
151
```
152
153
**Response:**
154
155
The response is a server-sent event stream. Here's an example of the events you might receive:
156
157
```
158
data: {"status": "Processing started"}
159
160
data: {"status": "Processing"}
161
162
data: {"status": "Cookie generated"}
163
164
data: {"status": "Processing"}
165
166
data: {"status": "Completed", "url": "https://dl.ai-now.space/summer_pop_song_12345.mp3"}
167
```
168
169
### Generate a video using Pika with a specific style
170
171
**Request:**
172
173
```bash
174
curl -X POST https://api.ai-now.space/api/generate \
175
-H "Authorization: Bearer YOUR_API_KEY" \
176
-H "Content-Type: application/json" \
177
-d '{
178
"model": "pika",
179
"prompt": "A serene lake surrounded by mountains",
180
"style": "4"
181
}'
182
```
183
184
**Response:**
185
186
```
187
data: {"status": "Processing started"}
188
189
data: {"status": "Processing"}
190
191
data: {"status": "Cookie generated"}
192
193
data: {"status": "Processing"}
194
195
data: {"status": "Processing"}
196
197
data: {"status": "Completed", "url": "https://dl.ai-now.space/serene_lake_mountains_67890.mp4"}
198
```
199
200
In these examples, the final event contains a `url` field with the download link for the generated content. The URL structure is:
201
202
```
203
https://dl.ai-now.space/<generated_file_name>.<extension>
204
```
205
206
Where:
207
- `<generated_file_name>` is a unique identifier for the generated content
208
- `<extension>` is the appropriate file extension for the content type (e.g., ".mp3" for audio, ".mp4" for video)
209
210
Note that the actual file names and identifiers will vary with each generation.
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9