# Create API Key Source: https://docs.weryai.com/api-reference/account/create-api-key /openapi-en.json post /v1/generation/api-key Create a new API Key for the current user. Each account can create up to 10000 API keys per day. # List API Key Source: https://docs.weryai.com/api-reference/account/list-api-key /openapi-en.json get /v1/generation/api-key/list Get the list of all API key configurations for the current user. # Query API Account Credits Source: https://docs.weryai.com/api-reference/account/query-api-account-credits /openapi-en.json get /v1/generation/balance Get the current credits balance for the specified API account # Submit Speech Recognition Task Source: https://docs.weryai.com/api-reference/audio-tools/submit-speech-recognition-task /openapi-en.json post /v1/generation/speech-recognize Submit an audio file for speech recognition # Submit Text-to-Speech Task Source: https://docs.weryai.com/api-reference/audio-tools/submit-text-to-speech-task /openapi-en.json post /v1/generation/text-to-audio Convert input text into speech audio. Supports custom voice, speed, and volume settings. Results are returned asynchronously via task polling or webhook callback. # Chat Completion Source: https://docs.weryai.com/api-reference/chat/chat-completion /openapi-en.json post /v1/chat/completions Send messages to a chat model and receive a response. Compatible with OpenAI Chat Completions protocol. Supports multi-turn conversations by providing message history. # Get Chat Models List Source: https://docs.weryai.com/api-reference/chat/get-chat-models-list /openapi-en.json get /v1/chat/models Get the list of available chat models with their capabilities and pricing information # Query Corpus Document List Source: https://docs.weryai.com/api-reference/deep-research/query-corpus-document-list /openapi-en.json get /v1/generation/file_search_stores/documents Retrieve the list of documents in the current user's research corpus (knowledge store). # Submit Deep Research Task Source: https://docs.weryai.com/api-reference/deep-research/submit-deep-research-task /openapi-en.json post /v1/generation/deep_research Submit a Deep Research task. Supports multi-round research sessions, file-based context input, and configurable AI agent tools. # Upload File to Corpus Source: https://docs.weryai.com/api-reference/deep-research/upload-file-to-corpus /openapi-en.json post /v1/generation/file_search_stores Upload a file to the research corpus (knowledge store). **Supported file types:** `txt`, `pdf`, `md`, `csv`, `json`, `docx`, `xlsx`, `pptx` **Max file size:** 100 MB # Check Effect Template Config Availability Source: https://docs.weryai.com/api-reference/effect-template/check-effect-template-config-availability /openapi-en.json post /v1/generation/effect-template/check Check the availability of effect template configuration options by their IDs. Returns a list of unavailable config IDs. # Get Effect Template List Source: https://docs.weryai.com/api-reference/effect-template/get-effect-template-list /openapi-en.json get /v1/generation/effect-template/list Get a paginated list of effect templates with their configurations. Currently only IMAGE type templates are available via Open API. # Submit Effect Template Creation Task Source: https://docs.weryai.com/api-reference/effect-template/submit-effect-template-creation-task /openapi-en.json post /v1/generation/effect-template Submit an effect image template creation task. Use `template_config_id` from the template list endpoint and provide required images. # Upload File Source: https://docs.weryai.com/api-reference/file-upload/upload-file /openapi-en.json post /v1/generation/upload-file Upload a single media file for generation workflows. > **Note:** Only paying users are allowed to upload files. Supported file types: - Image: jpg, jpeg, png, webp, gif (max 100MB) - Video/Audio: common formats supported by platform (max 50MB) - JSON: .json (max 5MB) # Submit Image-to-Image Task Source: https://docs.weryai.com/api-reference/image-generation/submit-image-to-image-task /openapi-en.json post /v1/generation/image-to-image Generate new images based on reference images and text prompts # Submit Text-to-Image Task Source: https://docs.weryai.com/api-reference/image-generation/submit-text-to-image-task /openapi-en.json post /v1/generation/text-to-image Generate images based on text prompts # Image to Prompt Source: https://docs.weryai.com/api-reference/image-tools/image-to-prompt /openapi-en.json post /v1/generation/image-to-prompt Analyze an image and generate a descriptive text prompt. This is a **synchronous** API that returns the result directly. # Submit Image Background Change Task Source: https://docs.weryai.com/api-reference/image-tools/submit-image-background-change-task /openapi-en.json post /v1/generation/image-bg-change Replace or modify the background of an image. Either `prompt` or `bg_color` must be provided. # Submit Image Background Remove Task Source: https://docs.weryai.com/api-reference/image-tools/submit-image-background-remove-task /openapi-en.json post /v1/generation/image-bg-remove Automatically remove the background from an image. # Submit Image Expand Task Source: https://docs.weryai.com/api-reference/image-tools/submit-image-expand-task /openapi-en.json post /v1/generation/image-expand Expand the canvas of an image and fill in the new areas with AI-generated content. # Submit Image Reframe Task Source: https://docs.weryai.com/api-reference/image-tools/submit-image-reframe-task /openapi-en.json post /v1/generation/image-reframe Modify the aspect ratio of an image. # Submit Image Repair Task Source: https://docs.weryai.com/api-reference/image-tools/submit-image-repair-task /openapi-en.json post /v1/generation/image-repair Restore and enhance old or damaged photos. # Submit Image Text Erase Task Source: https://docs.weryai.com/api-reference/image-tools/submit-image-text-erase-task /openapi-en.json post /v1/generation/image-text-erase Erase text or watermarks from an image. # Submit Image Text Extract Task Source: https://docs.weryai.com/api-reference/image-tools/submit-image-text-extract-task /openapi-en.json post /v1/generation/image-text-extract Extract text content from an image using OCR. # Submit Image Translate Task Source: https://docs.weryai.com/api-reference/image-tools/submit-image-translate-task /openapi-en.json post /v1/generation/image-translate Translate text within an image to the specified target language. # Submit Image Upscale Task Source: https://docs.weryai.com/api-reference/image-tools/submit-image-upscale-task /openapi-en.json post /v1/generation/image-upscale Enhance image quality and resolution (2x upscale). # Submit Music Generation Task Source: https://docs.weryai.com/api-reference/music-generation/submit-music-generation-task /openapi-en.json post /v1/generation/music/generate Generate music based on text description and style preferences. Supports vocal songs and instrumental music. **Important**: At least one of `description` or `styles` must be provided. When `type` is `ONLY_MUSIC`, the result will not include lyrics or cover image. # Generate Podcast Audio Source: https://docs.weryai.com/api-reference/podcast-generation/generate-podcast-audio /openapi-en.json post /v1/generation/podcast/generate/{taskId}/audio Generate audio for a podcast. If scripts parameter is provided, it will use the custom scripts; otherwise, it will use the default text from the task. # Get Podcast Speakers List Source: https://docs.weryai.com/api-reference/podcast-generation/get-podcast-speakers-list /openapi-en.json get /v1/generation/podcast/speakers/list Get the list of available podcast speakers/voices # Submit Podcast Text Generation Task Source: https://docs.weryai.com/api-reference/podcast-generation/submit-podcast-text-generation-task /openapi-en.json post /v1/generation/podcast/generate/text Generate podcast content based on a query and selected speakers. **Important**: When using `mode: debate`, you must provide exactly 2 speakers. # Query Batch Task Status Source: https://docs.weryai.com/api-reference/tasks/query-batch-task-status /openapi-en.json get /v1/generation/batch/{batchId}/status Query detailed information of all tasks in a batch based on batch ID, including task status and execution results # Query Task Details Source: https://docs.weryai.com/api-reference/tasks/query-task-details /openapi-en.json get /v1/generation/{taskId}/status Query detailed information about a task based on task ID, including task status and execution results. **Important for Podcast Generation**: When polling podcast generation tasks, you MUST check the `content_status` field instead of `task_status`: - `text-success`: Text generation completed, you can now call the audio generation endpoint - `text-fail`: Text generation failed, regenerate text - `audio-success`: Audio generation completed, task fully finished - `audio-fail`: Audio generation failed, regenerate audio # Submit Almighty Reference-to-Video Task Source: https://docs.weryai.com/api-reference/video-generation/submit-almighty-reference-to-video-task /openapi-en.json post /v1/generation/almighty-reference-to-video Generate video using mixed references (images/videos/audios) and prompt. # Submit First-and-Last-Frame-to-Video Task Source: https://docs.weryai.com/api-reference/video-generation/submit-first-and-last-frame-to-video-task /openapi-en.json post /v1/generation/first-last-image-to-video Generate videos with a start frame and an end frame. `first_pic_url` is required as the start frame image, and `end_pic_url` is required as the end frame image. # Submit Image-to-Video Task Source: https://docs.weryai.com/api-reference/video-generation/submit-image-to-video-task /openapi-en.json post /v1/generation/image-to-video Generate videos based on reference images and text prompts # Submit Multi-Image-to-Video Task Source: https://docs.weryai.com/api-reference/video-generation/submit-multi-image-to-video-task /openapi-en.json post /v1/generation/multi-image-to-video Generate videos based on multiple reference images and text prompts # Submit Text-to-Video Task Source: https://docs.weryai.com/api-reference/video-generation/submit-text-to-video-task /openapi-en.json post /v1/generation/text-to-video Generate videos based on text prompts # Submit Video Anime Replace Task Source: https://docs.weryai.com/api-reference/video-tools/submit-video-anime-replace-task /openapi-en.json post /v1/generation/video-anime-replace Replace or move elements in a video using anime-style AI processing # Submit Video Audio Merge Task Source: https://docs.weryai.com/api-reference/video-tools/submit-video-audio-merge-task /openapi-en.json post /v1/generation/video-audio-merge Merge a video stream with a separate audio stream into one output video # Submit Video Background Remove Task Source: https://docs.weryai.com/api-reference/video-tools/submit-video-background-remove-task /openapi-en.json post /v1/generation/video-background-remove Remove or replace the background of a video with a solid color # Submit Video Extend Task Source: https://docs.weryai.com/api-reference/video-tools/submit-video-extend-task /openapi-en.json post /v1/generation/video-extend Extend the duration of a video using AI with a specified style and prompt # Submit Video Lips Change Task Source: https://docs.weryai.com/api-reference/video-tools/submit-video-lips-change-task /openapi-en.json post /v1/generation/video-lips-change Sync the lip movements in a video to match a provided audio file # Submit Video Magic Style Transfer Task Source: https://docs.weryai.com/api-reference/video-tools/submit-video-magic-style-transfer-task /openapi-en.json post /v1/generation/video-magic Apply a magic style transformation to a video # Submit Video Merge Task Source: https://docs.weryai.com/api-reference/video-tools/submit-video-merge-task /openapi-en.json post /v1/generation/video-merge Merge multiple videos into a single output video # Submit Video Subtitle Erase Task Source: https://docs.weryai.com/api-reference/video-tools/submit-video-subtitle-erase-task /openapi-en.json post /v1/generation/video-subtitle-erase Erase subtitles or text from a video, optionally specifying regions to clean # Submit Video Subtitle Translate Task Source: https://docs.weryai.com/api-reference/video-tools/submit-video-subtitle-translate-task /openapi-en.json post /v1/generation/video-subtitle-translate Translate the subtitles in a video to the specified target language # Submit Video Upscaler Task Source: https://docs.weryai.com/api-reference/video-tools/submit-video-upscaler-task /openapi-en.json post /v1/generation/video-upscaler Enhance and upscale the resolution of a video using AI # Submit Video Watermark Remove Task Source: https://docs.weryai.com/api-reference/video-tools/submit-video-watermark-remove-task /openapi-en.json post /v1/generation/video-watermark-remove Remove watermarks from a video, optionally specifying regions to process # Development Guide Source: https://docs.weryai.com/en/development Best practices and advanced usage for WeryAI API ## Overview This guide covers best practices, optimization techniques, and advanced features to help you get the most out of the WeryAI API. ## API Basics ### Base URL ``` https://api.weryai.com ``` ### Request Format All API requests should use: * **Method**: POST for generation endpoints, GET for query endpoints * **Content-Type**: `application/json` * **Authorization**: `Bearer YOUR_API_KEY` ### Response Format All responses follow a consistent structure: ```json theme={null} { "status": 0, // 0 = success, non-zero = error "desc": "success", // Status description "message": "success", // User-facing message "data": {} // Response data } ``` ## Authentication ### Securing Your API Key > [!WARNING] > > Never expose your API key in client-side code, public repositories, or logs. **Best Practices:** 1. Store API keys in environment variables: ```bash theme={null} export WERYAI_API_KEY="sk-xxxxxxxxxxxxxxxx" ``` 2. Use a backend proxy to make API calls: ```javascript theme={null} // Frontend calls your backend fetch('/api/generate', { method: 'POST', body: data }) // Your backend calls WeryAI // This keeps the API key secure on the server ``` 3. Rotate keys regularly from the [API Keys page](https://weryai.com/api/keys) 4. If a key is compromised, immediately delete the old key and create a new one on the [API Keys page](https://weryai.com/api/keys) ## Webhook Integration ### Setting Up Webhooks Webhooks allow you to receive results asynchronously without polling. Add the `webhook_url` parameter to your request: ```json theme={null} { "model": "FLUX_PRO", "prompt": "A futuristic city at night", "aspect_ratio": "16:9", "webhook_url": "https://your-server.com/api/webhook" } ``` ### Webhook Response When the task completes, WeryAI sends a POST request to your webhook URL: ```json theme={null} { "status": 0, "desc": "success", "message": "success", "data": { "task_id": "task_abc123", "task_status": "SUCCESS", "images": ["https://cdn.weryai.com/result/image1.png"] } } ``` ### Handling Webhook Requests Here's a simple example of webhook handling: ```javascript theme={null} // Express.js example app.post('/api/webhook', (req, res) => { const { task_id, task_status, images } = req.body.data; if (task_status === 'SUCCESS') { // Process successful result console.log('Generation completed, task ID:', task_id); console.log('Generated images:', images); // Update database, notify user, etc. } else if (task_status === 'FAILED') { // Handle failure console.error('Generation failed:', req.body.data.msg); } res.status(200).send('OK'); }); ``` ## Optimizing Generation Quality ### Writing Better Prompts > [!TIP] > > Good prompts are specific, descriptive, and clear. **Examples:** ❌ **Bad**: "a cat" ✅ **Good**: "A fluffy orange tabby cat sitting on a windowsill, soft natural lighting, photorealistic, high detail" **Prompt Tips:** 1. **Be specific**: Include details about style, lighting, composition 2. **Use descriptive adjectives**: "vibrant", "dramatic", "soft", "detailed" 3. **Specify quality**: "high quality", "8k", "professional" 4. **Add style keywords**: "photorealistic", "anime style", "oil painting" ### Using Negative Prompts Negative prompts help exclude unwanted elements: ```json theme={null} { "prompt": "A beautiful landscape with mountains and a lake", "negative_prompt": "blurry, low quality, distorted, watermark, text, people" } ``` ### Aspect Ratio Selection Choose the right aspect ratio for your use case: * **1:1** - Profile pictures, thumbnails, social media posts * **16:9** - Widescreen, YouTube thumbnails, presentations * **9:16** - Vertical video, Instagram Stories, TikTok * **4:3** - Traditional displays * **21:9** - Ultra-wide, cinematic ## Error Handling ### Common Error Codes | Status Code | Description | Solution | | - | - | - | | 1001 | Parameter error | Check request parameter format and required fields | | 1002 | Unauthorized | Verify your API key is correct | | 1003 | Not found | Check if task ID or batch ID is valid | | 1004 | Insufficient credits | Go to [Pricing page](https://weryai.com/api/pricing) to purchase credits | | 1005 | Content moderation failed | Modify prompt to avoid sensitive content | ### Robust Error Handling Implement comprehensive error handling: ```python theme={null} import requests def generate_with_error_handling(prompt): try: response = requests.post( "https://api.weryai.com/v1/generation/text-to-image", headers={"Authorization": f"Bearer {API_KEY}"}, json={ "model": "FLUX_PRO", "prompt": prompt, "aspect_ratio": "16:9" }, timeout=30 ) response.raise_for_status() result = response.json() if result["status"] != 0: print(f"API Error: {result['message']}") return None return result["data"] except requests.exceptions.Timeout: print("Request timed out, please retry later") except requests.exceptions.RequestException as e: print(f"Request failed: {e}") except Exception as e: print(f"Unexpected error: {e}") return None ``` ## Task Status Polling ### Polling Best Practices When not using Webhooks, you need to poll for task status: ```python theme={null} import time import requests def wait_for_completion(task_id, max_wait=300): """ Wait for task completion Args: task_id: Task ID max_wait: Maximum wait time in seconds """ url = f"https://api.weryai.com/v1/generation/{task_id}/status" headers = {"Authorization": f"Bearer {API_KEY}"} start_time = time.time() while time.time() - start_time < max_wait: response = requests.get(url, headers=headers) result = response.json() if result["status"] != 0: print(f"Query failed: {result['message']}") return None status = result["data"]["task_status"] print(f"Task status: {status}") if status == "SUCCESS": return result["data"] elif status == "FAILED": print(f"Task failed: {result['data'].get('msg')}") return None # Wait 3-5 seconds before next query time.sleep(3) print("Wait timeout") return None ``` > [!NOTE] > > We recommend a polling interval of 3-5 seconds. Too frequent polling wastes resources, while too long intervals affect user experience. ## Credit Management ### Monitor Credit Balance Regularly check your account credit balance to avoid service interruptions: * Visit the [Pricing page](https://weryai.com/api/pricing) to view real-time balance * Pay attention to balance-related information in API responses * Set up balance alerts and recharge in time when credits are low ### Optimize Credit Usage Different models consume different amounts of credits. Choose the right model to optimize costs: ```python theme={null} # Choose appropriate model based on needs if need_high_quality: model = "WERYAI_IMAGE_2_0" # 1 credit/image elif need_fast_generation: model = "QWEN_IMAGE" # 1 credit/image else: model = "GPT_IMAGE_MINI" # 1 credit/image ``` Check the [Pricing page](https://weryai.com/api/pricing) for detailed rates of each model. ## Monitoring and Debugging ### Using WeryAI Platform Features WeryAI platform provides comprehensive monitoring and management features: > [card] [API Key Management](https://weryai.com/api/keys) > > Create, view, copy, and delete API keys > [card] [Call History](https://weryai.com/api/history) > > View all API request records and details > [card] [Credit Balance](https://weryai.com/api/pricing) > > View credit balance in real-time and purchase credits > [card] [Model Rates](https://weryai.com/api/pricing) > > Learn about credit consumption for different models ### Call History Features On the [Call History page](https://weryai.com/api/history) you can: * View complete records of all API requests * Search for specific API calls by request ID * View detailed information for each request (time, method, path, status code, duration) * Analyze API call patterns and frequency * Quickly locate and debug issues ### Local Logging In addition to platform features, implement logging in your application: ```python theme={null} import logging logging.basicConfig( level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s' ) logger = logging.getLogger(__name__) def generate_image_with_logging(prompt): logger.info(f"Starting image generation, prompt: {prompt[:50]}...") try: response = make_api_request(prompt) task_id = response["data"]["task_ids"][0] logger.info(f"Task created successfully, ID: {task_id}") result = wait_for_completion(task_id) if result: logger.info(f"Task completed: {task_id}") else: logger.error(f"Task failed: {task_id}") return result except Exception as e: logger.error(f"Generation failed: {e}", exc_info=True) raise ``` ## Best Practices Summary > [card] Security > > * Store API keys in environment variables > * Call API through backend proxy > * Rotate keys regularly > * Delete compromised keys immediately > [card] Reliability > > * Implement comprehensive error handling > * Use Webhooks for async results > * Set reasonable polling intervals > * Keep detailed logs > [card] Cost Optimization > > * Monitor credit balance > * Choose appropriate models based on needs > * Check [Pricing page](https://weryai.com/api/pricing) for rates > * Enjoy discounts with bulk purchases > [card] Quality Enhancement > > * Write detailed and specific prompts > * Use negative prompts to exclude unwanted elements > * Choose appropriate aspect ratios > * Learn from successful examples ## Platform Features Details ### API Key Management Visit the [API Keys page](https://weryai.com/api/keys) to manage your keys: ![API Keys Management Interface](https://mintcdn.com/weryai/ZYwyNjTqEUSFUTNm/images/api-keys-management-en.png?fit=max\&auto=format\&n=ZYwyNjTqEUSFUTNm\&q=85\&s=95f0dccd6b3b73de3b07fd3061ffe0d0) * **Create Keys**: Click "Create New Key" button to generate new API keys * **View Keys**: See all created keys (keys are partially hidden for security) * **Copy Keys**: Click copy button to quickly copy keys for development * **Delete Keys**: Remove unused keys to improve security > [!TIP] > > We recommend creating different API keys for different projects or environments (development, testing, production) for better management and tracking. ### Credit Purchase Plans Choose a suitable package on the [Pricing page](https://weryai.com/api/pricing): | Amount | Credits | Unit Price | | - | - | - | | \$50.00 | 1,000 | \$0.05/credit | | \$200.00 | 4,000 | \$0.05/credit | | \$500.00 | 12,500 | \$0.04/credit | | \$1000.00 | 25,000 | \$0.04/credit | | \$2000.00 | 50,000 | \$0.04/credit | | \$3000.00 | 100,000 | \$0.03/credit | | \$6000.00 | 200,000 | \$0.03/credit | > [!NOTE] > > Larger packages offer better unit prices. Choose the right package based on your usage to save costs. ## Next Steps > [card] [API Reference](/api-reference) > > Explore all available API endpoints and parameters > [card] [API Keys](https://weryai.com/api/keys) > > Create and manage your API keys > [card] [Call History](https://weryai.com/api/history) > > View and analyze API call records > [card] [Pricing](https://weryai.com/api/pricing) > > Purchase credits and view model rates # API Introduction Source: https://docs.weryai.com/en/index Discover all you can do with WeryAI API - Integrate advanced AI image and video generation into your applications ## Overview Welcome to the WeryAI API documentation! WeryAI's all-in-one API platform empowers developers and businesses to harness the power of cutting-edge AI image and video generation. With a simple RESTful API, you can seamlessly integrate world-class AI models into your applications, delivering high-quality, scalable AI content creation solutions. This API documentation provides detailed interface specifications and technical references. All API key management, call history viewing, credit purchases, and other account-related features are managed on the [WeryAI platform](https://weryai.com/api). ## Why Choose WeryAI API? ### Comprehensive AI Model Support WeryAI offers access to a wide range of advanced and comprehensive AI models across multiple platforms. For instance, you can leverage: * **Image Generation Models**: GPT Image 2, Nano Banana Pro, Nano Banana 2, Nano Banana 2 Lite, WeryAI Image 2.0, GPT Image 1.5, Seedream 5.0 Lite, Seedream 4.5, Seedream 4.0, Recraft V4 Pro, Recraft V4, Recraft V4 Pro Vector, Recraft V4 Vector, Qwen Image 2 Pro, Qwen Image 2, Qwen Image, Flux 2 Flash, Flux, Grok 2, Imagen4, GPT Image Mini, WeryAI Image 1.0, Wan 2.7 Pro, Wan 2.7, Wan 2.6, Wan 2.5, Dreamina 4.0, Dreamina 3.1, and Dreamina 3.0. * **Video Generation Models**: Seedance 2.5, Seedance 2.0, Werydance 2.5, Werydance 2.0, Seedance 2.0 Fast, Werydance 2.0 Fast, Seedance 2.0 Mini, Werydance 2.0 Mini, Sora 2, Sora 2 Pro, Veo 3.1, Veo 3.1 Fast, Kling 3.0 Pro, Kling 3.0 Standard, MiniMax H3, Vidu Q3, WeryAI Video 1.0, Kling 2.6 Pro, Kling O1, Kling 2.5 Turbo, Kling 2.1 Standard, Kling 2.1 Master, Kling 2.1 Pro, Runway Gen 4.5, Runway Gen 4, Grok Imagine Video, Google Omni Flash, Pika 2.2, Pixverse V6, Hailuo 2.3 Pro, Hailuo 2.3 Standard, Hailuo 2.3 Pro Fast, Hailuo 2.3 Standard Fast, Veo 3, Veo 3 Fast, Wan 2.6, Wan 2.5, Dreamina 3.0 Pro, and Dreamina 3.0. Recent model updates include **Seedance 2.5, Werydance 2.5, MiniMax H3, Nano Banana 2, Nano Banana 2 Lite, Nano Banana Pro, GPT Image 2, Flux 2 Flash, and the Recraft V4 family**. This extensive model support enables you to choose the most suitable AI engine for your specific needs. ### Versatile Functionality Our API supports a wide array of tasks, including: > [card] Text-to-Image > > Generate high-quality images from text descriptions using advanced AI models > [card] Image-to-Image > > Transform existing images into new styles with AI-powered editing > [card] Text-to-Video > > Create stunning videos from text prompts with state-of-the-art models > [card] Image-to-Video > > Bring static images to life by converting them into dynamic video content This versatility allows you to tackle various creative challenges with ease. ### Budget-Friendly Excellence Enjoy premium AI tools at competitive prices. Our pricing strategy ensures you can maintain high-quality standards while keeping your projects cost-effective. > [card] [View Pricing Details](https://weryai.com/api/pricing) > > Visit our pricing page to learn about credit consumption for each model and purchase plans ### Simple and Reliable Integration * **RESTful API Design**: Industry-standard architecture that's easy to understand and use * **Webhook Support**: Automatic notifications to your server when async tasks complete * **Comprehensive Error Handling**: Clear error codes and messages help quickly identify issues * **High Availability**: Stable service ensures business continuity ## Get Started with WeryAI API Today **1. Create Account and Get API Key** Visit [WeryAI API Keys Management](https://weryai.com/api/keys) to register and create your API key **2. Purchase Credits** Go to the [Pricing page](https://weryai.com/api/pricing) to buy credits and choose a plan that fits your needs **3. Quick Start** Check out our [Quick Start Guide](/en/quickstart) to make your first API request **4. Explore API Documentation** Browse the complete API reference to learn about all available endpoints and parameters ## Core Features ### API Key Management On the [API Keys page](https://weryai.com/api/keys) you can: ![API Keys Management Page](https://mintcdn.com/weryai/ZYwyNjTqEUSFUTNm/images/api-keys-page-en.png?fit=max\&auto=format\&n=ZYwyNjTqEUSFUTNm\&q=85\&s=e31029f9461094e1de57e2546291d449) * Create new API keys * View existing key list * Delete unused keys * Copy keys for API calls > [!WARNING] > > Keep your API keys secure! Never expose them in public code repositories or client-side code. ### Call History On the [Call History page](https://weryai.com/api/history) you can: ![Call History Page](https://mintcdn.com/weryai/INucYDvCUQzFjRZI/images/history-page-en.png?fit=max\&auto=format\&n=INucYDvCUQzFjRZI\&q=85\&s=d197d2b03bff1518bae973b3b61cef31) * View all API call records * Search for specific requests by request ID * View request method, path, duration and other details * Filter and view request details ### Pricing and Billing On the [Pricing page](https://weryai.com/api/pricing) you can: ![Pricing Page](https://mintcdn.com/weryai/ZYwyNjTqEUSFUTNm/images/pricing-page-en.png?fit=max\&auto=format\&n=ZYwyNjTqEUSFUTNm\&q=85\&s=9d6f1c28cf1406bb140c01d41b43c536) * Check current account balance * Purchase credit packages ($50 to $6000 multiple tiers) * Learn about credit consumption rates for different models * Calculate your usage costs ![Model Consumption Rates](https://mintcdn.com/weryai/52IbEmNmjm6QFOsv/images/model-rates-en.png?fit=max\&auto=format\&n=52IbEmNmjm6QFOsv\&q=85\&s=d38c4cd834d2261678661860f5644732) ## Use Cases * **Content Creation Platforms**: Generate creative content at scale for social media, marketing, and advertising * **E-commerce**: Automatically generate product images, scene renders, and promotional videos * **Game Development**: Quickly generate game assets, character designs, and concept art * **Education & Training**: Create educational videos and visual learning materials * **Entertainment Apps**: Provide AI creation tools and special effects features for users * **Automated Workflows**: Integrate AI generation into content production pipelines ## Quick Links > [card] [Quick Start](/en/quickstart) > > Make your first API call in minutes > [card] [API Reference](/api-reference) > > Detailed endpoint documentation and parameters > [card] [Development Guide](/en/development) > > Best practices and advanced usage > [card] [API Keys](https://weryai.com/api/keys) > > Manage your API keys > [card] [Call History](https://weryai.com/api/history) > > View API call records > [card] [Pricing](https://weryai.com/api/pricing) > > View pricing and purchase credits > [!NOTE] > > Have questions or need technical support? Visit [WeryAI website](https://weryai.com) to contact our team. # Quick Start Source: https://docs.weryai.com/en/quickstart Get started with WeryAI API in minutes ## Prerequisites Before you start using WeryAI API, you need to complete the following setup: ### 1. Register and Create API Key Visit [WeryAI API Keys Management](https://weryai.com/api/keys) to: ![API Keys Management Page](https://mintcdn.com/weryai/ZYwyNjTqEUSFUTNm/images/api-keys-page-en.png?fit=max\&auto=format\&n=ZYwyNjTqEUSFUTNm\&q=85\&s=e31029f9461094e1de57e2546291d449) **1. Register or Login** If you don't have an account yet, register for a WeryAI account **2. Create API Key** On the API Keys page, click the "Create New Key" button to generate your API Key ![Create API Key Button](https://mintcdn.com/weryai/ZYwyNjTqEUSFUTNm/images/create-key-button-en.png?fit=max\&auto=format\&n=ZYwyNjTqEUSFUTNm\&q=85\&s=d07ba21f6ec3732be2ed85fa4deb48fb) **3. Copy and Save Key** Copy the generated API key and save it securely (key format like: `sk-d77e1...343e`) ![Copy API Key](https://mintcdn.com/weryai/ZYwyNjTqEUSFUTNm/images/copy-key-en.png?fit=max\&auto=format\&n=ZYwyNjTqEUSFUTNm\&q=85\&s=ec5c07b2e1b811048ec7c6f1e2a58df7) > [!WARNING] > > Keep your API key secure! Never share it publicly or commit it to version control. Store it in environment variables. ### 2. Purchase Credits Visit the [Pricing page](https://weryai.com/api/pricing) to purchase credits: ![Pricing Page - Credit Balance](https://mintcdn.com/weryai/ZYwyNjTqEUSFUTNm/images/pricing-balance-en.png?fit=max\&auto=format\&n=ZYwyNjTqEUSFUTNm\&q=85\&s=a7333aa8f0b370983a1ae1a67a173786) * Check your current account balance * Choose a suitable recharge package ($50.00 to $6000.00 multiple tiers) * After payment, credits will be added to your account immediately ![Credit Packages](https://mintcdn.com/weryai/ZYwyNjTqEUSFUTNm/images/pricing-packages-en.png?fit=max\&auto=format\&n=ZYwyNjTqEUSFUTNm\&q=85\&s=f1ed9d30980a38e238109d7dfccb0d6a) > [!NOTE] > > Different AI models consume different amounts of credits. You can view the detailed model consumption rate table on the pricing page. ![Model Consumption Rates](https://mintcdn.com/weryai/52IbEmNmjm6QFOsv/images/model-rates-en.png?fit=max\&auto=format\&n=52IbEmNmjm6QFOsv\&q=85\&s=d38c4cd834d2261678661860f5644732) ## Authentication All API requests require authentication using your API key in the `Authorization` header: ```bash theme={null} Authorization: Bearer YOUR_API_KEY ``` Replace `YOUR_API_KEY` with the actual key you created on the [API Keys page](https://weryai.com/api/keys). ## Your First Request Let's generate your first image using the text-to-image API: ```bash cURL theme={null} curl -X POST https://api.weryai.com/v1/generation/text-to-image \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "FLUX_PRO", "prompt": "A beautiful sunset over the ocean, vibrant colors", "aspect_ratio": "16:9", "resolution": "1080p", "image_number": 1 }' ``` ```python Python theme={null} import requests url = "https://api.weryai.com/v1/generation/text-to-image" headers = { "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json" } payload = { "model": "FLUX_PRO", "prompt": "A beautiful sunset over the ocean, vibrant colors", "aspect_ratio": "16:9", "resolution": "1080p", "image_number": 1 } response = requests.post(url, json=payload, headers=headers) result = response.json() print(result) ``` ```javascript JavaScript theme={null} const response = await fetch('https://api.weryai.com/v1/generation/text-to-image', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json' }, body: JSON.stringify({ model: 'FLUX_PRO', prompt: 'A beautiful sunset over the ocean, vibrant colors', aspect_ratio: '16:9', resolution: '1080p', image_number: 1 }) }); const result = await response.json(); console.log(result); ``` ### Response The API will return a response containing `batch_id` and `task_ids`: ```json theme={null} { "status": 0, "desc": "success", "message": "success", "data": { "batch_id": 123456789, "task_ids": ["task_abc123"] } } ``` ## Query Task Status Since generation tasks are processed asynchronously, use the task ID to query the status: ```bash cURL theme={null} curl -X GET https://api.weryai.com/v1/generation/task_abc123/status \ -H "Authorization: Bearer YOUR_API_KEY" ``` ```python Python theme={null} import requests import time url = "https://api.weryai.com/v1/generation/task_abc123/status" headers = {"Authorization": "Bearer YOUR_API_KEY"} # Poll until task completes while True: response = requests.get(url, headers=headers) result = response.json() status = result["data"]["task_status"] print(f"Task status: {status}") if status == "succeed": images = result["data"]["images"] print(f"Generated images: {images}") break elif status == "failed": print(f"Task failed: {result['data'].get('msg')}") break time.sleep(3) # Wait 3 seconds before checking again ``` ```javascript JavaScript theme={null} async function checkTaskStatus(taskId) { const url = `https://api.weryai.com/v1/generation/${taskId}/status`; while (true) { const response = await fetch(url, { headers: { 'Authorization': 'Bearer YOUR_API_KEY' } }); const result = await response.json(); const status = result.data.task_status; console.log(`Task status: ${status}`); if (status === 'succeed') { console.log('Generated images:', result.data.images); break; } else if (status === 'failed') { console.log('Task failed:', result.data.msg); break; } await new Promise(resolve => setTimeout(resolve, 3000)); } } checkTaskStatus('task_abc123'); ``` ### Success Response When the task completes, you'll receive the generated images: ```json theme={null} { "status": 0, "desc": "success", "message": "success", "data": { "task_id": "task_abc123", "task_status": "succeed", "images": [ "https://cdn.weryai.com/result/image1.png" ] } } ``` ## Using Webhooks You can provide a `webhook_url` to automatically receive results instead of polling: ```json theme={null} { "model": "FLUX_PRO", "prompt": "A beautiful sunset over the ocean", "aspect_ratio": "16:9", "webhook_url": "https://your-server.com/webhook" } ``` When the task completes, WeryAI will send a POST request with the results to your webhook URL. ## Task Status Tasks can have the following statuses: * **waiting** - Task is waiting to be processed * **processing** - Task is being generated * **succeed** - Task completed successfully * **failed** - Task failed (check the `msg` field for error details) ## View Call History You can view all API call records on the [Call History page](https://weryai.com/api/history): ![Call History Page](https://mintcdn.com/weryai/INucYDvCUQzFjRZI/images/history-page-en.png?fit=max\&auto=format\&n=INucYDvCUQzFjRZI\&q=85\&s=d197d2b03bff1518bae973b3b61cef31) * View detailed information for each request * Search for specific requests by request ID * View request method, path, status code, and duration * Convenient for debugging and tracking issues ## Next Steps > [card] [API Reference](/api-reference) > > Explore all available endpoints and parameters > [card] [Development Guide](/en/development) > > Learn best practices and advanced features > [card] [Generate Videos](/api-reference/video-generation) > > Create stunning videos with AI > [card] [View Pricing](https://weryai.com/api/pricing) > > Learn about model consumption and purchase credits ## FAQ > [accordion] 401 Authentication Failed Error > > Check if your API key is correct and properly formatted in the Authorization header. You can view or recreate keys on the [API Keys page](https://weryai.com/api/keys). > [accordion] Task Stuck in waiting Status > > Peak times may cause delays. Tasks usually start processing within a few minutes. You can view request details on the [Call History page](https://weryai.com/api/history). > [accordion] Task Failed Content Moderation > > Your prompt may violate content policies. Please review and modify your prompt to avoid sensitive or inappropriate content. > [accordion] How to Check Credit Balance? > > Visit the [Pricing page](https://weryai.com/api/pricing) to view your current account credit balance and purchase more credits. > [accordion] How Many Credits Do Different Models Consume? > > On the [Pricing page](https://weryai.com/api/pricing), scroll down to see the "Model Consumption Rate" table, which lists all models and their credit consumption. > [!NOTE] > > Need help? Visit [WeryAI website](https://weryai.com) to contact our support team.