Skip to main content

API Documentation

Welcome to the Kie.ai API documentation. This guide will help you understand how to use our API services effectively.

API Services Overview​

We currently offer the following API services:

  1. Video Generation - Create high-quality AI videos with customizable content and styles using Runway's technology

    • Text-to-video generation
    • Image-to-video transformation
    • Support for different aspect ratios (16:9 or 9:16)
    • Video extension capabilities
    • Callback notifications for asynchronous processing
  2. Music Generation - Create original music tracks with AI, supporting various styles, custom lyrics, and instrumental options

    • Text-to-music generation
    • Custom and non-custom generation modes
    • Audio extension capabilities
    • Multiple model versions (V3.5 and V4)
    • Asynchronous processing with callbacks
  3. Lyrics Generation - Generate creative and contextually appropriate lyrics for music production

    • Song lyrics creation based on prompts
    • Structured lyrical content for music tracks
    • Timestamped lyrics for synchronization
    • Status tracking for generation tasks
  4. WAV Conversion - Convert audio files to professional-grade WAV format for high-quality processing

    • High-quality audio conversion
    • Ideal for professional audio workflows
    • Enhanced audio quality compared to standard formats
  5. Vocal Removal - Extract vocals or create instrumental versions by separating vocal tracks from music

    • Isolate vocals from instrumentals
    • Create karaoke tracks
    • Process existing audio into component tracks
  6. Music Video Generation - Transform audio tracks into visually engaging MP4 videos

    • Create visual content from audio tracks
    • Add artist attribution and branding
    • Asynchronous processing with task status tracking
  7. 4o Image - Create detailed and creative AI-generated images using the advanced GPT-4o multimodal model

    • Text-to-image generation
    • Image-based creation with up to 5 reference images
    • Customizable image dimensions (1:1, 3:2, 2:3)
    • Asynchronous processing with callbacks
  8. Flux Kontext - Advanced AI image generation and editing powered by the Flux Kontext model

    • Text-to-image generation with high-quality outputs
    • Image editing with text prompts
    • Multiple aspect ratios (21:9, 16:9, 4:3, 1:1, 3:4, 9:16, 16:21)
    • Two model versions (pro and max) for different use cases
    • Asynchronous processing with callbacks
  9. Account Management - Monitor and manage your account information, credit balance, usage quotas, and API access settings

    • Credit balance checking
    • Usage tracking
    • API access management

Basic Information​

  • API Server: https://api.kie.ai
  • API Version: 1.0.0
  • Technical Support: support@kie.ai

Authentication​

All APIs require Bearer Token authentication:

Authorization: Bearer YOUR_API_KEY

To get your API key:

  1. Visit API Key Management Page
  2. Generate your personal API key
  3. Use it in all API requests

Important:

  • Keep your API key secure
  • Never share your API key
  • Reset immediately if compromised

API Services​

Video Generation​

The Video Generation API enables AI-powered video creation:

  • Create videos from text prompts via /api/v1/runway/generate
  • Transform images into videos with textual guidance
  • Support for different aspect ratios (16:9 or 9:16)
  • Extend existing videos with /api/v1/runway/extend
  • Webhook callbacks for asynchronous processing
  • Query generation status via /api/v1/runway/record-detail

Key features:

  • Generated videos are stored for 14 days
  • Video generation is asynchronous with callbacks
  • Both text-only and image-based generation supported
  • Video extension maintains visual consistency

Learn more about Video Generation API →

Music Generation​

The Music Generation API provides AI-powered audio creation capabilities:

  • Create music tracks from text prompts via /api/v1/generate
  • Support for both instrumental and vocal music
  • Custom and non-custom generation modes
  • Audio extension capabilities with /api/v1/generate/extend
  • Timestamped lyrics support via /api/v1/generate/get-timestamped-lyrics

Key features:

  • Generated audio files are stored for 14 days
  • Asynchronous processing with callback notifications
  • Multiple model versions (V3.5 and V4) support
  • Query generation status via /api/v1/generate/record-info

Learn more about Music Generation API →

Lyrics Generation​

The Lyrics Generation API enables creation of song lyrics:

  • Generate lyrics based on text prompts
  • Create structured lyrical content for music tracks
  • Query lyrics generation task details

Key features:

  • Multiple lyric variations per request
  • Status tracking for generation progress
  • Error handling for content filtering

Learn more about Lyrics Generation API →

WAV Conversion​

The WAV Conversion API provides high-quality audio format conversion:

  • Generate professional-grade WAV format audio files via /api/v1/wav/generate
  • Ideal for audio production workflows
  • Enhanced audio quality compared to standard formats
  • Query conversion status via /api/v1/wav/record-info

Key features:

  • Converted WAV files maintained for 14 days
  • Uncompressed audio for professional editing
  • Asynchronous processing with status tracking

Learn more about WAV Conversion API →

Vocal Removal​

The Vocal Removal API enables audio track separation:

  • Separate vocals from instrumental tracks via /api/v1/vocal-removal/generate
  • Extract vocal and instrumental components from audio files
  • Process existing audio to create isolated tracks
  • Query separation status via /api/v1/vocal-removal/record-info

Key features:

  • All three audio files (original, vocal, instrumental) retained for 14 days
  • Asynchronous processing with status tracking
  • Ideal for remixing and karaoke applications

Learn more about Vocal Removal API →

Music Video Generation​

The Music Video Generation API transforms audio into visual content:

  • Generate MP4 videos from audio tracks via /api/v1/mp4/generate
  • Create visual music videos with synchronized elements
  • Add artist attribution and branding options
  • Query video generation status via /api/v1/mp4/record-info

Key features:

  • Generated videos are stored for 14 days
  • Asynchronous processing with task status tracking
  • Optimized for social media sharing

Learn more about Music Video Generation API →

4o Image Generation​

The 4o Image API provides AI-powered image generation capabilities:

  • Create AI-generated images via /api/v1/gpt4o-image/generate
  • Support for both prompt-based and image-based creation
  • Reference up to 5 images as inspiration
  • Customize image dimensions with three aspect ratios (1:1, 3:2, 2:3)
  • Query generation task details via /api/v1/gpt4o-image/record-info

Key features:

  • Generated images are stored for 14 days
  • Asynchronous processing with callback notifications
  • Multiple generation statuses for tracking progress
  • Flexible image creation from text or reference images

Learn more about 4o Image API →

Flux Kontext Image Generation and Editing​

The Flux Kontext API provides advanced AI image generation and editing capabilities:

  • Create or edit images via /api/v1/flux/kontext/generate
  • Support for both text-to-image generation and image editing
  • Multiple aspect ratios (21:9, 16:9, 4:3, 1:1, 3:4, 9:16, 16:21)
  • Two model versions:
    • flux-kontext-pro: Standard model for general use
    • flux-kontext-max: Enhanced model for complex scenes
  • Query generation task details via /api/v1/flux/kontext/record-info

Key features:

  • Generated images are stored for 14 days
  • High-quality output with professional-grade results
  • Flexible image editing capabilities

Learn more about Flux Kontext API →

Account Management​

Monitor and manage your API usage through the credits system:

  • Check remaining credits via /api/v1/chat/credit
  • Track usage history
  • Set up usage alerts

Learn more about Account Management →

Error Handling​

Our APIs use standard HTTP status codes along with detailed error messages:

CodeDescription
200Success - Request has been processed successfully
401Unauthorized - Authentication credentials are missing or invalid
402Insufficient Credits - Account does not have enough credits to perform the operation
404Not Found - The requested resource or endpoint does not exist
422Validation Error - The request parameters failed validation checks
429Rate Limited - Request limit has been exceeded for this resource
455Service Unavailable - System is currently undergoing maintenance
500Server Error - An unexpected error occurred while processing the request
505Feature Disabled - The requested feature is currently disabled

Best Practices​

  1. Authentication

    • Store your API key securely
    • Rotate keys periodically for enhanced security
    • Implement proper error handling for authentication failures
  2. Video Generation

    • Provide detailed prompts describing visual elements clearly
    • When using reference images, ensure they match the target aspect ratio
    • Implement robust callback handling for asynchronous results
    • Store taskIds for status checking and consider the 14-day expiration
  3. Music Generation

    • For beginners, start with non-custom mode for simpler usage
    • In custom mode, provide detailed style guidelines for better results
    • Choose appropriate model versions based on quality requirements
    • Implement proper callback handling for all generation stages
  4. Lyrics Generation

    • Provide clear creative direction in your prompts
    • Implement proper error handling for content filtering
    • Store taskIds for status checking and result retrieval
  5. WAV Conversion

    • Account for larger file sizes compared to compressed formats
    • Implement robust download and storage strategies
    • Plan for 14-day file expiration in your applications
  6. Vocal Removal

    • Works best with professionally recorded music with clear vocal parts
    • Implement playback features for all three output types (original, vocal, instrumental)
    • Consider quality variations based on the complexity of the source audio
  7. Music Video Generation

    • Use artist attribution options for professional presentation
    • Optimize playback and sharing for social media platforms
    • Consider processing time variations based on audio length
  8. 4o Image Generation

    • Provide clear, descriptive prompts for better image generation results
    • When using reference images, consider using multiple for more creative control
    • Specify appropriate aspect ratio based on your application needs
    • Implement proper error handling for different generation statuses
  9. Flux Kontext Image Generation

    • Choose appropriate model version (pro/max) based on complexity needs
    • Handle image upload size limits (max 10MB) and format restrictions
    • Implement proper error handling for concurrent task limits
    • Monitor task status through callbacks or record-info endpoint
  10. Account Management

    • Monitor credit usage regularly
    • Implement fallback mechanisms for depleted credits
    • Consider caching responses where appropriate

Need Help?​

If you encounter any issues or have questions, please contact us through:

Language Support

This documentation is available in both English and Chinese. You can switch languages using the language selector in the navigation bar.