AI-Now Image and Video Generation API Documentation
Table of Contents
- Introduction
- Authentication
- API Endpoints
- Models
- Styles
- Error Handling
- Rate Limiting and Tokens
- Examples
Introduction
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.
Authentication
Authentication is required for all API requests. Use Bearer token authentication by including an API key in the Authorization header:
Authorization: Bearer YOUR_API_KEY
To obtain an API key, contact [email protected].
API Endpoints
Ping
Endpoint: GET /api/ping
Use this endpoint to check if the API is operational.
Response:
pong
Generate
Endpoint: POST /api/generate
This endpoint generates music, images, or videos based on the specified model and prompt.
Request Body:
{
"model": "string",
"prompt": "string",
"style": "string" (optional)
}
model
: The AI model to use (e.g., "suno", "luma", "pika", "run")prompt
: The text prompt for generationstyle
: Optional style parameter for some models
Response:
The response is a server-sent event stream. Events include:
- Processing updates
- Error messages
- Final result with generated content URL
Models
Suno (Music Generation)
- Token Cost: 10
- Generation Time: 1-3 minutes
Luma (Video Generation)
- Token Cost: 30
- Generation Time: Variable, may fail during peak hours
Pika (Video Generation)
- Token Cost: 10
- Generation Time: 1-3 minutes
Run (Video Generation)
- Token Cost: 30
- Generation Time: 1-3 minutes
Styles
Pika API Styles
- Anime (value: '1')
- Moody (value: '2')
- 3D (value: '3')
- Watercolor (value: '4')
- Natural (value: '5')
- Claymation (value: '6')
- Black & White (value: '7')
Run API Styles
- Abandoned (value: 'abandoned')
- Abstract Sculpture (value: 'abstract_sculpture')
- Anime (value: 'anime')
- Cartoon (value: 'cartoon')
- Cine Lens (value: 'cine_lens')
- Claymation (value: 'claymation')
- Concept Art (value: 'concept_art')
- Digital Art (value: 'digital_art')
- Forestpunk (value: 'forestpunk')
- Frost (value: 'frost')
- Graphic Novel (value: 'graphic_novel')
- Graphite (value: 'graphite')
- Isometric 3D (value: 'isometric_3d')
- Low Poly 3D (value: 'low_poly_3d')
- Marker Drawing (value: 'marker_drawing')
- Moody Film (value: 'moody_film')
- Pixel Art (value: 'pixel_art')
- Retro (value: 'retro')
- Sci-fi Art (value: 'sci_fi_art')
- Stickers (value: 'stickers')
- Storyboard (value: 'storyboard')
- Thriller (value: 'thriller')
- 3D Cartoon (value: '3d_cartoon')
- 3D Render (value: '3d_render')
- 80s Vaporwave (value: '80s_vaporwave')
Error Handling
The API returns appropriate HTTP status codes and error messages:
- 401: Unauthorized (missing or invalid API key)
- 418: Insufficient tokens
- 500: Internal Server Error
Error responses are in JSON format:
{
"status": "Error",
"message": "Error description"
}
Rate Limiting and Tokens
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.
Examples
Generate a song using Suno
Request:
curl -X POST https://api.ai-now.space/api/generate \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "suno",
"prompt": "A upbeat pop song about summer"
}'
Response:
The response is a server-sent event stream. Here's an example of the events you might receive:
data: {"status": "Processing started"} data: {"status": "Processing"} data: {"status": "Cookie generated"} data: {"status": "Processing"} data: {"status": "Completed", "url": "https://dl.ai-now.space/summer_pop_song_12345.mp3"}
Generate a video using Pika with a specific style
Request:
curl -X POST https://api.ai-now.space/api/generate \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "pika",
"prompt": "A serene lake surrounded by mountains",
"style": "4"
}'
Response:
data: {"status": "Processing started"} data: {"status": "Processing"} data: {"status": "Cookie generated"} data: {"status": "Processing"} data: {"status": "Processing"} data: {"status": "Completed", "url": "https://dl.ai-now.space/serene_lake_mountains_67890.mp4"}
In these examples, the final event contains a url
field with the download link for the generated content. The URL structure is:
https://dl.ai-now.space/<model>/<generated_file_name>.<extension>
Where:
<model>
is the name of the model used (e.g., "suno", "pika", "luma", "run")<generated_file_name>
is a unique identifier for the generated content<extension>
is the appropriate file extension for the content type (e.g., ".mp3" for audio, ".mp4" for video)
Note that the actual file names and identifiers will vary with each generation.