# Weyl - Complete Documentation > Weyl is purpose-built inference infrastructure for generative media. Sub-100ms latency for diffusion models on NVIDIA Blackwell with FP4 precision. Weyl AI is a Fleek research lab building next-generation AI infrastructure. We specialize in low-latency generative media APIs, Nix-based GPU compute infrastructure, and developer tooling for AI-native workflows. --- ## Table of Contents 1. [About Weyl](#about-weyl) 2. [API Documentation](#api-documentation) 3. [AI Workflows](#ai-workflows) 4. [Weyl Standard](#weyl-standard) 5. [Blog Posts](#blog-posts) 6. [Open Source](#open-source) 7. [Research Papers](#research-papers) --- ## About Weyl Weyl provides: - **Sub-100ms Latency**: Optimized CUDA kernels on NVIDIA Blackwell architecture - **FP4 Quantization**: 4x throughput improvement with maintained quality - **Dual Tiers**: Sync for real-time applications, Async for cost optimization - **Advanced Models**: FLUX.2, FLUX.1, Z-Image Turbo, WAN 2.2 Video ### Key Capabilities | Feature | Description | |---------|-------------| | Image Generation | FLUX.2 Kontext, FLUX.1 dev/schnell, Z-Image Turbo | | Video Generation | WAN 2.2 video synthesis | | Real-time API | WebSocket and REST endpoints | | AI Workflow Integration | Cursor, Claude, v0, Lovable, Bolt.new | --- ## API Documentation ### API Reference #### API Overview **URL**: https://weyl.ai/api/ **Description**: Weyl Render API - Generative media at the speed of thought > // the street finds its own uses for things Generative media at the speed of thought. Images and video from the edge, served hot off Blackwell tensor cores. ## Quick Example ``` curl -X POST "https://sync.render.weyl.ai/image/flux/schnell/t2i?format=1024" \ -H "Authorization: Bearer $WEYL_API_KEY" \ -H "Content-Type: application/json" \ -d '{"prompt":"cyberpunk street at night, neon rain"}' \ -o output.webp ``` You POST. You get bytes. The `Content-Location` header points to the CDN. ## Service Tiers ### sync.render.weyl.ai **Dedicated bare metal, SLA-backed.** - POST, receive bytes immediately - No queue, no polling - 503 if capacity exhausted - WebSocket available for streaming frames **Use when:** Real-time preview, interactive tools, live generation ### async.render.weyl.ai **Queue-backed, CDN-arbitraged pricing.** - POST returns 202 with job ID - Poll, SSE, or WebSocket for progress - Equal quality, lower cost, higher latency **Use when:** Batch workflows, cost optimization, non-critical timing ### cdn.render.weyl.ai **Immutable asset delivery.** - Every generated asset gets a permanent URL - Cache-forever semantics - Global CDN distribution ## Next Steps - [Authentication](/api/authentication/) - Set up your API keys - [Sync Tier](/api/sync/) - Real-time generation - [Async Tier](/api/async/) - Queue-based workflows --- #### Detail Enhancement **URL**: https://weyl.ai/api/advanced/detail/ **Description**: Upscaling and detail recovery Upscale and enhance generated images post-processing. ## Basic Upscaling ``` curl -X POST "https://sync.render.weyl.ai/image/flux/dev/t2i?format=1024" \ -H "Authorization: Bearer $WEYL_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "prompt": "portrait", "upscale": 2 }' \ -o output.webp ``` **Scales:** 1.5×, 2×, 4× ## Latent Upscaling Generate at higher resolution by upscaling latents before final decode. ``` { "prompt": "detailed landscape", "format": "1024", "latent_upscale": 1.5 } ``` **Output:** 1536×1536 (1024 × 1.5) ## Detail Recovery Add fine details after generation: ``` { "prompt": "portrait", "detail_enhance": true, "detail_strength": 0.5 } ``` **Strength range:** 0.0 - 1.0 - `0.3` - Subtle sharpening - `0.5` - Balanced (default) - `0.8` - Strong detail ## Performance Impact | Operation | Latency Increase | |------------------|------------------| | 1.5× upscale | +20% | | 2× upscale | +40% | | 4× upscale | +150% | | Detail enhance | +15% | --- #### Guidance Tuning **URL**: https://weyl.ai/api/advanced/guidance/ **Description**: CFG scale optimization Control prompt adherence with classifier-free guidance (CFG). ## Understanding Guidance **Low guidance (1.0-2.0):** Loose interpretation, more creative **Medium guidance (2.5-4.0):** Balanced **High guidance (4.5-10.0):** Strict adherence, can over-saturate ## FLUX Family ### FLUX Dev2 **Range:** 1.0 - 5.0 **Sweet spots:** - Short prompts: `3.5` - strong adherence - Medium prompts: `2.5` - balanced - Detailed prompts: `1.5` - let model breathe - Very detailed: `1.0` - maximum freedom ``` # Detailed prompt with low guidance curl -X POST "..." \ -d '{ "prompt": "portrait, 35mm, natural light, golden hour, ...", "guidance": 1.5 }' ``` ### FLUX Dev **Range:** 2.0 - 5.0 **Default:** `3.5` **Recommendation:** Stay at 3.5 for consistency ### FLUX Schnell **Fixed:** `3.5` Cannot be changed (distilled for this value). ## Z-Image **Fixed:** `1.0` (internally) The `guidance` parameter is ignored. Z-Image uses fixed CFG. ## WAN Video **Range:** 6.0 - 8.0 **Default:** `7.0` **Recommendation:** - Subtle motion: `6.0` - Normal: `7.0` - Strong motion: `8.0` --- #### LoRA Adapters **URL**: https://weyl.ai/api/advanced/loras/ **Description**: Fine-tuned model adapters Load Low-Rank Adaptation (LoRA) weights to customize model behavior. ## Basic Usage ``` curl -X POST "https://sync.render.weyl.ai/image/flux/dev/t2i?format=1024" \ -H "Authorization: Bearer $WEYL_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "prompt": "a portrait in the style of artgerm", "loras": [ { "url": "https://example.com/artgerm_lora.safetensors", "weight": 0.8 } ] }' \ -o output.webp ``` ## Multiple LoRAs Stack multiple adapters: ``` { "prompt": "cyberpunk portrait", "loras": [ { "url": "https://cdn.render.weyl.ai/loras/cyberpunk.safetensors", "weight": 0.7 }, { "url": "https://cdn.render.weyl.ai/loras/cinematic.safetensors", "weight": 0.5 } ] } ``` ## Weight Tuning **Range:** 0.0 - 1.5 - `0.3-0.5` - Subtle influence - `0.6-0.9` - Moderate influence (recommended) - `1.0-1.2` - Strong influence - `1.3+` - Maximum (may overfit) ## Compatibility **Supported:** - FLUX Dev ✓ - FLUX Dev2 ✓ (FLUX.1 LoRAs work) **Not Supported:** - FLUX Schnell (distilled) - Z-Image (different architecture) ## LoRA Sources - Hugging Face Hub - CivitAI - Custom trained --- #### Samplers **URL**: https://weyl.ai/api/advanced/samplers/ **Description**: Available sampling methods Control the generation sampling algorithm. ## Available Samplers | Sampler | Family | Speed | Quality | Notes | |-------------|---------------|----------|----------|-----------------------| | `euler` | FLUX, Z-Image | Fast | Good | Default for most | | `euler_a` | FLUX | Fast | Good | Ancestral (random) | | `dpmpp_2m` | FLUX | Medium | Better | 2M solver | | `heun` | FLUX | Slow | Best | High quality | ## Usage ``` curl -X POST "https://sync.render.weyl.ai/image/flux/dev/t2i?format=1024" \ -H "Authorization: Bearer $WEYL_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "prompt": "portrait", "sampler": "dpmpp_2m", "steps": 25 }' \ -o output.webp ``` ## Recommendations ### FLUX Schnell **Use:** `euler` (only) **Steps:** 4 (fixed) Schnell is distilled for euler at 4 steps. Other samplers won't work. ### FLUX Dev / Dev2 **Fast:** `euler` - 20-25 steps **Quality:** `dpmpp_2m` - 25-30 steps **Best:** `heun` - 30-40 steps ### Z-Image **Use:** `euler` (only) Z-Image uses custom scheduling. Other samplers ignored. --- #### Schedulers **URL**: https://weyl.ai/api/advanced/schedulers/ **Description**: Noise scheduling strategies Control how noise is scheduled during denoising. ## Available Schedulers | Scheduler | Family | Characteristics | |------------|--------|---------------------------| | `simple` | FLUX | Default, fast, consistent | | `normal` | FLUX | Beta schedule variant | | `sgm` | FLUX | Stable diffusion style | ## Usage ``` curl -X POST "https://sync.render.weyl.ai/image/flux/dev/t2i?format=1024" \ -H "Authorization: Bearer $WEYL_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "prompt": "portrait", "scheduler": "simple", "steps": 25 }' \ -o output.webp ``` ## Scheduler Guide ### `simple` (Default) **Best for:** Most use cases **Characteristics:** - Linear noise schedule - Predictable behavior - Fast convergence **Recommended steps:** 20-30 ### `normal` **Best for:** Alternative beta scheduling **Characteristics:** - Beta-based schedule - Slightly different aesthetic **Recommended steps:** 25-35 ### `sgm` **Best for:** Stable Diffusion compatibility **Characteristics:** - Matches SD-style scheduling - Useful for LoRA trained on SD **Recommended steps:** 30-40 ## Model Defaults - **FLUX Dev2/Dev:** `simple` - **FLUX Schnell:** `simple` (fixed) - **Z-Image:** Custom (not configurable) --- #### Async Tier Overview **URL**: https://weyl.ai/api/async/ **Description**: Queue-based generation **Base URL:** `https://async.render.weyl.ai` Queue-backed generation with CDN-arbitraged pricing. ## How It Works ``` 1. POST /queue → 202 Accepted + job ID 2. Poll /jobs/{id} OR subscribe to SSE 3. GET /jobs/{id} → 303 redirect to CDN when complete ``` ## Submit Job ``` curl -X POST "https://async.render.weyl.ai/queue" \ -H "Authorization: Bearer $WEYL_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "modality": "image", "family": "flux", "model": "schnell", "task": "t2i", "format": "1024", "prompt": "cyberpunk cityscape" }' ``` ## Check Status ``` curl "https://async.render.weyl.ai/jobs/j_abc123" \ -H "Authorization: Bearer $WEYL_API_KEY" ``` When complete, returns 303 redirect to the CDN URL. --- #### Job Management **URL**: https://weyl.ai/api/async/jobs/ **Description**: Check status and retrieve outputs Manage async jobs: check status, cancel, retrieve outputs. ## Get Job Status **Endpoint:** `GET /jobs/{id}` ``` curl "https://async.render.weyl.ai/jobs/j_abc123" \ -H "Authorization: Bearer $WEYL_API_KEY" ``` ### States **Queued:** ``` { "id": "j_abc123", "status": "queued", "position": 3, "eta_seconds": 45 } ``` **Running:** ``` { "id": "j_abc123", "status": "running", "progress": 0.65, "eta_seconds": 8 } ``` **Complete (303 Redirect):** ``` HTTP/1.1 303 See Other Location: https://cdn.render.weyl.ai/i/abc123.webp ``` ## Cancel Job **Endpoint:** `DELETE /jobs/{id}` ``` curl -X DELETE "https://async.render.weyl.ai/jobs/j_abc123" \ -H "Authorization: Bearer $WEYL_API_KEY" ``` --- #### Queue Submission **URL**: https://weyl.ai/api/async/queue/ **Description**: Submit jobs to the async queue **Endpoint:** `POST /queue` Submit generation jobs to the async queue. ## Request Format ``` curl -X POST "https://async.render.weyl.ai/queue" \ -H "Authorization: Bearer $WEYL_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "modality": "image", "family": "flux", "model": "schnell", "task": "t2i", "format": "1024", "prompt": "portrait in natural lighting" }' ``` ## Response (202) ``` { "id": "j_abc123", "status": "queued", "position": 5, "eta_seconds": 75 } ``` ## Queue Options ### Priority ``` { "priority": "normal", // low, normal, high "prompt": "..." } ``` ### Webhook ``` { "webhook": "https://myapp.com/callback", "prompt": "..." } ``` ### Idempotency ``` { "idempotency_key": "unique_key_123", "prompt": "..." } ``` --- #### Server-Sent Events (SSE) **URL**: https://weyl.ai/api/async/sse/ **Description**: Real-time job progress via SSE streaming **Endpoint:** `GET /jobs/{id}/events` Subscribe to job progress via Server-Sent Events. ## Basic Usage ``` curl -N "https://async.render.weyl.ai/jobs/j_abc123/events" \ -H "Authorization: Bearer $WEYL_API_KEY" ``` ## Event Stream ``` event: position data: {"position": 3, "eta_seconds": 45} event: started data: {} event: progress data: {"progress": 0.65, "step": 20} event: complete data: {"output": "https://cdn.render.weyl.ai/i/xyz.webp"} ``` ## Python Client ``` def stream_job_events(job_id: str): url = f"https://async.render.weyl.ai/jobs/{job_id}/events" headers = {"Authorization": f"Bearer {API_KEY}"} with requests.get(url, headers=headers, stream=True) as resp: for line in resp.iter_lines(decode_unicode=True): if line.startswith('data:'): data = json.loads(line[6:]) print(data) ``` --- #### Authentication **URL**: https://weyl.ai/api/authentication/ **Description**: API key management and security All API requests require authentication using Bearer tokens. ## Getting API Keys 1. Request access to the Weyl API 2. Fill out the access request form with your project details 3. Receive your API key via email within 24 hours 4. Store securely (keep the email safe for future reference) ## Using API Keys Include your key in the `Authorization` header: ``` Authorization: Bearer wyl_sk_1234567890abcdef ``` ## Security Best Practices ### Environment Variables **Never hardcode API keys.** Use environment variables: ``` # .env.local WEYL_API_KEY=wyl_sk_prod_1234567890abcdef ``` ## Rate Limits Rate limits are enforced per API key. Check response headers for current limits. --- #### Core Concepts **URL**: https://weyl.ai/api/concepts/ **Description**: Understanding Weyl API fundamentals ## Model Families Each family is a distinct transformer backbone with its own characteristics. | Family | Modality | Default Backend | Status | |----------|----------|-----------------|--------------| | `flux` | image | nunchaku | **active** | | `zimage` | image | nunchaku | **active** | | `wan` | video | torch | coming soon | ## Backends Three inference backends, each with different tradeoffs: | Backend | Stack | Notes | |------------|----------------------|------------------------------| | `nunchaku` | NVFP4 on Blackwell | Fastest, 4-bit quantized | | `torch` | diffusers + CUDA | Flexible, full precision | | `tensorrt` | TRT-LLM + ModelOpt | NVIDIA-optimized, production | ## Formats ### Image Formats | Format | Dimensions | Aspect | |------------------|------------|--------| | `1024` | 1024×1024 | 1:1 | | `512` | 512×512 | 1:1 | | `portrait` | 768×1024 | 3:4 | | `landscape` | 1024×768 | 4:3 | ### Video Formats | Format | Dimensions | Aspect | |-----------------|------------|--------| | `720p` | 1280×720 | 16:9 | | `480p` | 832×480 | ~16:9 | | `square` | 640×640 | 1:1 | ## Tasks | Task | Requires | Produces | Description | |--------|---------------------|----------|----------------------------| | `t2v` | prompt | video | text to video | | `i2v` | prompt + image | video | animate a still | | `t2i` | prompt | image | text to image | | `i2i` | prompt + image | image | transform / style transfer | | `edit` | prompt + image + mask | image | inpaint / outpaint | --- #### Model Aliases **URL**: https://weyl.ai/api/infrastructure/aliases/ **Description**: Stable model references Use stable aliases instead of version-specific model names. ## Why Aliases? Model names like `dev2`, `dev`, `schnell` are version-specific. Aliases provide stable references that automatically point to recommended versions. ## Available Aliases | Alias | Current Target | Description | |-------------|----------------|--------------------------| | `latest` | `dev2` | Newest FLUX model | | `default` | `dev` | Balanced quality/speed | | `fast` | `schnell` | Fastest generation | | `turbo` | `turbo` | Z-Image fast model | ## Usage ### Using Alias ``` curl -X POST "https://sync.render.weyl.ai/image/flux/latest/t2i?format=1024" \ -H "Authorization: Bearer $WEYL_API_KEY" \ -d '{"prompt": "portrait"}' ``` ### Using Specific Version ``` curl -X POST "https://sync.render.weyl.ai/image/flux/dev2/t2i?format=1024" \ -H "Authorization: Bearer $WEYL_API_KEY" \ -d '{"prompt": "portrait"}' ``` ## When to Use ### Use Aliases When: - Building for long-term stability - Want automatic upgrades to better models - Prototyping / experimentation ### Use Specific Versions When: - Need reproducible results - Production systems with change control - Benchmarking ## Alias Stability **Aliases are stable references.** They may point to different underlying models over time as we release improvements, but: - Output quality will improve or stay the same - API interface remains compatible - Performance will improve or stay the same **Notice:** We announce alias updates 7 days in advance. ## Query Current Mapping ``` curl "https://api.render.weyl.ai/models/aliases" \ -H "Authorization: Bearer $WEYL_API_KEY" ``` Response: ``` { "aliases": { "latest": "dev2", "default": "dev", "fast": "schnell", "turbo": "turbo" }, "updated_at": "2024-01-15T00:00:00Z" } ``` --- #### Model Discovery **URL**: https://weyl.ai/api/infrastructure/discovery/ **Description**: List available models Query available models and their capabilities. ## List Models **Endpoint:** `GET /models` ``` curl "https://api.render.weyl.ai/models" \ -H "Authorization: Bearer $WEYL_API_KEY" ``` ## Response ``` { "models": [ { "family": "flux", "model": "dev2", "modality": "image", "tasks": ["t2i", "i2i"], "backends": ["nunchaku", "torch"], "default_backend": "nunchaku", "formats": ["1024", "512", "portrait", "landscape"], "status": "active", "info": { "parameters": "32B", "default_steps": 25, "guidance_range": [1.0, 5.0] } }, { "family": "flux", "model": "schnell", "modality": "image", "tasks": ["t2i"], "backends": ["nunchaku", "torch", "tensorrt"], "default_backend": "nunchaku", "formats": ["1024", "512", "portrait", "landscape"], "status": "active", "info": { "parameters": "12B", "fixed_steps": 4 } } ] } ``` ## Filter by Family ``` curl "https://api.render.weyl.ai/models?family=flux" \ -H "Authorization: Bearer $WEYL_API_KEY" ``` ## Filter by Modality ``` curl "https://api.render.weyl.ai/models?modality=video" \ -H "Authorization: Bearer $WEYL_API_KEY" ``` ## Model Status | Status | Meaning | |-------------|--------------------------------| | `active` | Available for use | | `beta` | Testing phase | | `coming_soon` | Announced, not yet available | | `deprecated` | Being phased out | ## Use Cases ### Dynamic Model Selection ``` def get_fastest_image_model(): resp = requests.get( 'https://api.render.weyl.ai/models?modality=image', headers={'Authorization': f'Bearer {API_KEY}'} ) models = resp.json()['models'] # Filter for schnell/turbo variants fast_models = [ m for m in models if 'schnell' in m['model'] or 'turbo' in m['model'] ] return fast_models[0] if fast_models else models[0] ``` --- #### Image Uploads **URL**: https://weyl.ai/api/infrastructure/uploads/ **Description**: Upload images for i2i and i2v tasks Upload images for image-to-image and image-to-video tasks. ## Methods ### 1. Direct URL Reference any publicly accessible image: ``` { "prompt": "convert to watercolor", "image": "https://example.com/photo.jpg" } ``` ### 2. Data URI Embed image data directly: ``` { "prompt": "convert to watercolor", "image": "data:image/jpeg;base64,/9j/4AAQSkZJRg..." } ``` ### 3. Upload Endpoint **Endpoint:** `POST /uploads` Upload to Weyl CDN first, then reference: ``` # 1. Upload curl -X POST "https://api.render.weyl.ai/uploads" \ -H "Authorization: Bearer $WEYL_API_KEY" \ -F "file=@portrait.jpg" # Response: # { "url": "https://cdn.render.weyl.ai/u/xyz.jpg" } # 2. Use in generation curl -X POST "https://sync.render.weyl.ai/image/flux/dev/i2i?format=1024" \ -H "Authorization: Bearer $WEYL_API_KEY" \ -d '{ "prompt": "watercolor style", "image": "https://cdn.render.weyl.ai/u/xyz.jpg" }' ``` ## Image Requirements ### Formats - **Supported:** JPEG, PNG, WebP - **Max size:** 20 MB - **Max dimensions:** 4096×4096 ### Recommendations - Use WebP for best compression - Keep under 2048×2048 for faster upload - Ensure proper aspect ratio for target format ## Upload Limits - **Max file size:** 20 MB - **Rate limit:** 100 uploads/min - **Retention:** 24 hours (use in generation within 24h) ## Python Example ``` # Upload image with open('portrait.jpg', 'rb') as f: resp = requests.post( 'https://api.render.weyl.ai/uploads', headers={'Authorization': f'Bearer {API_KEY}'}, files={'file': f} ) image_url = resp.json()['url'] # Use in generation resp = requests.post( 'https://sync.render.weyl.ai/image/flux/dev/i2i?format=1024', headers={'Authorization': f'Bearer {API_KEY}'}, json={ 'prompt': 'watercolor style', 'image': image_url } ) ``` --- #### Models Overview **URL**: https://weyl.ai/api/models/ **Description**: Available models and capabilities Weyl supports multiple model families for image and video generation. ## Active Models | Family | Modality | Models | Best For | |----------|----------|------------------|-----------------------------| | `flux` | image | dev2, dev, schnell | General purpose, quality | | `zimage` | image | turbo | Speed, iteration | ## FLUX Family **Black Forest Labs - State of the art image generation** - **dev2** - FLUX.2 Dev (32B parameters) - Best quality - **dev** - FLUX.1 Dev (12B parameters) - Balanced - **schnell** - FLUX.1 Schnell (12B, 4 steps) - Fastest ### Example ``` curl -X POST "https://sync.render.weyl.ai/image/flux/schnell/t2i?format=1024" \ -H "Authorization: Bearer $WEYL_API_KEY" \ -H "Content-Type: application/json" \ -d '{"prompt": "portrait, natural lighting"}' \ -o output.webp ``` ## Z-Image Family **Alibaba Tongyi Lab - Ultra-fast generation** - **turbo** - Z-Image Turbo (6B parameters) - Sub-second generation ### Example ``` curl -X POST "https://sync.render.weyl.ai/image/zimage/turbo/t2i?format=512" \ -H "Authorization: Bearer $WEYL_API_KEY" \ -H "Content-Type: application/json" \ -d '{"prompt": "portrait"}' \ -o output.webp ``` --- #### Backend Comparison **URL**: https://weyl.ai/api/models/backends/ **Description**: Nunchaku vs Torch vs TensorRT Weyl supports three inference backends with different characteristics. ## Overview | Backend | Precision | Speed | Models | |------------|-----------|------------|---------------------| | `nunchaku` | FP4 | ⚡⚡⚡ | FLUX, Z-Image | | `torch` | FP16 | ⚡⚡ | FLUX, WAN | | `tensorrt` | Mixed | ⚡⚡⚡ | FLUX Dev/Schnell | ## Nunchaku **NVIDIA FP4 quantization on Blackwell GB200** - **Precision:** FP4 (4-bit floating point) - **Speed:** Fastest (3-4× faster than FP16) - **Quality:** Minimal loss vs FP16 **Supported Models:** - FLUX Dev2 ✓ - FLUX Dev ✓ - FLUX Schnell ✓ - Z-Image Turbo ✓ ## Torch **PyTorch diffusers with CUDA** - **Precision:** FP16 (half precision) - **Framework:** diffusers + transformers - **Flexibility:** Maximum flexibility **Supported Models:** - FLUX Dev2 ✓ - FLUX Dev ✓ - FLUX Schnell ✓ - WAN ✓ ## TensorRT **NVIDIA TensorRT-LLM with ModelOpt** - **Precision:** Mixed (INT8 + FP16) - **Optimization:** Ahead-of-time compilation **Supported Models:** - FLUX Dev ✓ - FLUX Schnell ✓ ## Performance **FLUX @ 1024×1024:** | Model | Backend | Latency | |---------|------------|---------| | schnell | nunchaku | 450ms | | schnell | tensorrt | 380ms | | dev | nunchaku | 1.8s | | dev | tensorrt | 1.5s | --- #### FLUX Models **URL**: https://weyl.ai/api/models/flux/ **Description**: FLUX.2 Dev, FLUX.1 Dev, FLUX.1 Schnell guide **Family:** `flux` **Creator:** Black Forest Labs **Modality:** Image generation State-of-the-art text-to-image models from the creators of Stable Diffusion. ## Model Variants ### FLUX.2 Dev (dev2) **32B parameter model with Mistral-3 24B text encoder** ``` curl -X POST "https://sync.render.weyl.ai/image/flux/dev2/t2i?format=1024" \ -H "Authorization: Bearer $WEYL_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "prompt": "portrait in natural light", "guidance": 3.5, "steps": 25 }' \ -o output.webp ``` **Characteristics:** - Best prompt understanding - Excellent fine detail - ~2.4s @ 1024px on nunchaku **Guidance Tuning:** - Short prompts: `guidance: 3.5` - Detailed prompts: `guidance: 1.5` ### FLUX.1 Dev (dev) **12B parameter model with T5-XXL encoder** **Characteristics:** - Excellent quality/speed balance - Strong baseline model - ~1.8s @ 1024px on nunchaku **Guidance:** Standard `guidance: 3.5` ### FLUX.1 Schnell (schnell) **12B distilled model, optimized for 4 steps** **Characteristics:** - Fastest FLUX variant - Fixed 4 steps - ~450ms @ 1024px on nunchaku - Apache-2.0 license **Fixed Parameters:** - Steps: `4` (always) - Guidance: `3.5` (fixed) --- #### Formats Reference **URL**: https://weyl.ai/api/models/formats/ **Description**: Video and image format specifications Complete reference for video and image output formats. ## Image Formats All image models support these formats via `?format=` parameter. | Format | Dimensions | Aspect | Use Case | |------------------|------------|--------|---------------------| | `1024` | 1024×1024 | 1:1 | High-res square | | `512` | 512×512 | 1:1 | Fast iteration | | `portrait` | 768×1024 | 3:4 | Standard portrait | | `portrait-wide` | 576×1024 | 9:16 | TikTok, Stories | | `landscape` | 1024×768 | 4:3 | Standard landscape | | `landscape-wide` | 1024×576 | 16:9 | Widescreen | ## Video Formats Video models (WAN) support these formats. | Format | Dimensions | Aspect | Use Case | |-----------------|------------|--------|------------------| | `720p` | 1280×720 | 16:9 | HD landscape | | `720p-portrait` | 720×1280 | 9:16 | TikTok, Reels | | `480p` | 832×480 | ~16:9 | Faster gen | | `480p-portrait` | 480×832 | ~9:16 | Mobile portrait | | `square` | 640×640 | 1:1 | Social square | ## Output Specifications ### Image Output - **Format:** WebP - **Quality:** 90 - **Color Space:** sRGB - **Bit Depth:** 8-bit ### Video Output - **Container:** MP4 - **Codec:** H.264 - **FPS:** 24 - **Bitrate:** ~8 Mbps (720p), ~4 Mbps (480p) --- #### WAN Video Models **URL**: https://weyl.ai/api/models/wan/ **Description**: Video generation (coming soon) **Family:** `wan` **Model:** `default` (WAN 2.2) **Modality:** Video generation **Status:** Coming Soon Image-to-video generation with high motion coherence. ## Basic Usage (When Available) ``` curl -X POST "https://sync.render.weyl.ai/video/wan/default/i2v?format=720p" \ -H "Authorization: Bearer $WEYL_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "prompt": "she turns to face camera", "image": "https://example.com/portrait.jpg", "duration": 3, "cfg": 7.0 }' \ -o output.mp4 ``` ## Parameters **Required:** - `prompt` - Motion description - `image` - Source image **Optional:** - `duration` - 0.5-10 seconds - `cfg` - 6-8 recommended - `steps` - inference steps - `seed` - random seed ## Format Support | Format | Dimensions | Aspect | |-----------------|------------|--------| | `720p` | 1280×720 | 16:9 | | `480p` | 832×480 | ~16:9 | | `square` | 640×640 | 1:1 | --- #### Z-Image Turbo **URL**: https://weyl.ai/api/models/zimage/ **Description**: Ultra-fast image generation **Family:** `zimage` **Model:** `turbo` **Creator:** Alibaba Tongyi Lab **License:** Apache-2.0 Ultra-fast image generation optimized for iteration. ## Overview Z-Image Turbo is a 6B parameter model delivering sub-second generation at 1024×1024. ## Basic Usage ``` curl -X POST "https://sync.render.weyl.ai/image/zimage/turbo/t2i?format=1024" \ -H "Authorization: Bearer $WEYL_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "prompt": "portrait, natural lighting" }' \ -o output.webp ``` ## Performance | Resolution | Steps | Latency (p50) | |------------|-------|---------------| | 512×512 | 5 | 140ms | | 1024×1024 | 8 | 320ms | **3-8× faster than FLUX Schnell** ## Parameters ``` { "prompt": "description", "steps": 8, "seed": 42 } ``` **Note:** Z-Image uses fixed CFG 1.0 internally. The `guidance` parameter is ignored. --- #### Error Reference **URL**: https://weyl.ai/api/reference/errors/ **Description**: Complete error code reference Complete reference for all API error codes. ## HTTP Status Codes | Code | Meaning | Typical Cause | |------|--------------------------|----------------------------| | 400 | Bad Request | Invalid parameters | | 401 | Unauthorized | Missing/invalid API key | | 403 | Forbidden | Policy violation | | 404 | Not Found | Invalid endpoint | | 429 | Too Many Requests | Rate limit exceeded | | 503 | Service Unavailable | Capacity exhausted | | 500 | Internal Server Error | Server-side error | ## Error Codes ### Authentication Errors #### `invalid_token` **Status:** 401 **Meaning:** API key is malformed or invalid ``` { "error": "invalid_token", "message": "API key format invalid" } ``` #### `token_expired` **Status:** 401 **Meaning:** API key has expired #### `insufficient_credits` **Status:** 402 **Meaning:** Account has insufficient credits ### Request Errors #### `invalid_prompt` **Status:** 400 **Meaning:** Prompt violates constraints ``` { "error": "invalid_prompt", "message": "Prompt too long (max 5000 chars)" } ``` #### `invalid_parameters` **Status:** 400 **Meaning:** Request parameters invalid #### `unsupported_format` **Status:** 400 **Meaning:** Format not supported for model ### Content Policy Errors #### `nsfw_detected` **Status:** 403 **Meaning:** Content policy violation detected ``` { "error": "nsfw_detected", "message": "Content policy violation" } ``` #### `prompt_filtered` **Status:** 403 **Meaning:** Prompt triggered safety filter ### Capacity Errors #### `capacity_exhausted` **Status:** 503 **Meaning:** Sync tier at capacity ``` { "error": "capacity_exhausted", "message": "sync tier at capacity, retry in 30s", "retry_after": 30 } ``` #### `queue_full` **Status:** 429 **Meaning:** Async queue at capacity ### Rate Limit Errors #### `rate_limit_exceeded` **Status:** 429 **Meaning:** Too many requests ``` { "error": "rate_limit_exceeded", "message": "Rate limit: 100/min", "retry_after": 15 } ``` ## Error Response Format All errors follow this schema: ``` interface ErrorResponse { error: string; message: string; retry_after?: number; details?: Record; } ``` --- #### Request Schemas **URL**: https://weyl.ai/api/reference/requests/ **Description**: Complete request format reference Complete schemas for all API requests. ## Image Generation Request ``` interface ImageRequest { prompt: string; negative_prompt?: string; steps?: number; guidance?: number; seed?: number; sampler?: 'euler' | 'euler_a' | 'dpmpp_2m' | 'heun'; scheduler?: 'simple' | 'normal' | 'sgm'; loras?: LoRAConfig[]; upscale?: 1.5 | 2 | 4; detail_enhance?: boolean; } interface LoRAConfig { url: string; weight: number; } ``` ## Video Generation Request ``` interface VideoRequest { prompt: string; image: string; duration?: number; cfg?: number; steps?: number; seed?: number; } ``` ## Image-to-Image Request ``` interface I2IRequest { prompt: string; image: string; strength?: number; steps?: number; guidance?: number; seed?: number; } ``` ## Async Queue Request ``` interface QueueRequest { modality: 'image' | 'video'; family: 'flux' | 'zimage' | 'wan'; model: string; task: 't2i' | 'i2i' | 't2v' | 'i2v' | 'edit'; format: string; prompt: string; priority?: 'low' | 'normal' | 'high'; webhook?: string; idempotency_key?: string; // ... other generation params } ``` ## Validation Rules ### Prompt - **Min length:** 3 characters - **Max length:** 5000 characters - **Required:** Yes (except i2i with strength > 0.8) ### Steps - **FLUX Dev/Dev2:** 15-50 - **FLUX Schnell:** 4 (fixed) - **Z-Image:** 5-12 ### Guidance - **FLUX:** 1.0-5.0 - **WAN:** 6.0-8.0 - **Z-Image:** Ignored (fixed 1.0) ### Seed - **Range:** 0 - 4294967295 - **Default:** Random --- #### Response Schemas **URL**: https://weyl.ai/api/reference/responses/ **Description**: Complete response format reference Complete schemas for all API responses. ## Sync Success (200) ``` HTTP/1.1 200 OK Content-Type: image/webp Content-Location: https://cdn.render.weyl.ai/i/xyz.webp X-Generation-Time: 1847 X-Seed: 42 ``` ## Sync Capacity Exhausted (503) ``` HTTP/1.1 503 Service Unavailable Retry-After: 30 Content-Type: application/json { "error": "capacity_exhausted", "message": "sync tier at capacity, retry in 30s", "retry_after": 30 } ``` ## Async Job Queued (202) ``` { "id": "j_abc123", "status": "queued", "position": 5, "eta_seconds": 75, "created_at": "2024-01-15T10:30:00Z" } ``` ## Async Job Status ### Queued ``` { "id": "j_abc123", "status": "queued", "position": 3, "eta_seconds": 45 } ``` ### Running ``` { "id": "j_abc123", "status": "running", "progress": 0.65, "step": 20, "total_steps": 30, "eta_seconds": 8 } ``` ### Complete (303) ``` HTTP/1.1 303 See Other Location: https://cdn.render.weyl.ai/i/xyz.webp ``` Or with body: ``` { "id": "j_abc123", "status": "complete", "output": "https://cdn.render.weyl.ai/i/xyz.webp", "duration_ms": 2340, "completed_at": "2024-01-15T10:31:23Z" } ``` ### Failed ``` { "id": "j_abc123", "status": "failed", "error": { "code": "nsfw_detected", "message": "Content policy violation" }, "failed_at": "2024-01-15T10:30:45Z" } ``` ## Headers ### Response Headers - `Content-Location` - Permanent CDN URL - `X-Generation-Time` - Latency in milliseconds - `X-Seed` - Seed used for generation - `Retry-After` - Seconds to wait before retry --- #### Type Reference **URL**: https://weyl.ai/api/reference/types/ **Description**: TypeScript type definitions Complete TypeScript type definitions for the Weyl API. ## Core Types ``` type Modality = 'image' | 'video'; type Family = 'flux' | 'zimage' | 'wan'; type Task = 't2i' | 'i2i' | 't2v' | 'i2v' | 'edit'; type ImageFormat = | '1024' | '512' | 'portrait' | 'portrait-wide' | 'landscape' | 'landscape-wide'; type VideoFormat = | '720p' | '720p-portrait' | '480p' | '480p-portrait' | 'square'; type Backend = 'nunchaku' | 'torch' | 'tensorrt'; type Sampler = 'euler' | 'euler_a' | 'dpmpp_2m' | 'heun'; type Scheduler = 'simple' | 'normal' | 'sgm'; type Priority = 'low' | 'normal' | 'high'; type JobStatus = 'queued' | 'running' | 'complete' | 'failed' | 'cancelled'; ``` ## Request Types ``` interface BaseGenerationRequest { prompt: string; negative_prompt?: string; steps?: number; guidance?: number; seed?: number; } interface ImageGenerationRequest extends BaseGenerationRequest { sampler?: Sampler; scheduler?: Scheduler; loras?: LoRAConfig[]; upscale?: 1.5 | 2 | 4; detail_enhance?: boolean; detail_strength?: number; } interface I2IRequest extends ImageGenerationRequest { image: string; strength?: number; } interface VideoGenerationRequest extends BaseGenerationRequest { image: string; duration?: number; cfg?: number; } interface LoRAConfig { url: string; weight: number; } ``` ## Response Types ``` interface Job { id: string; status: JobStatus; created_at: string; started_at?: string; completed_at?: string; failed_at?: string; } interface QueuedJob extends Job { status: 'queued'; position: number; eta_seconds: number; } interface RunningJob extends Job { status: 'running'; progress: number; step: number; total_steps: number; eta_seconds: number; } interface CompleteJob extends Job { status: 'complete'; output: string; duration_ms: number; } interface FailedJob extends Job { status: 'failed'; error: { code: string; message: string; }; } ``` ## WebSocket Types ``` interface WSMessage { type: string; [key: string]: unknown; } interface WSAuthMessage extends WSMessage { type: 'auth'; token: string; } interface WSGenerateMessage extends WSMessage { type: 'generate'; modality: Modality; family: Family; model: string; task: Task; format: string; stream_frames?: boolean; } interface WSFrameMessage extends WSMessage { type: 'frame'; step: number; total_steps: number; data: string; } interface WSCompleteMessage extends WSMessage { type: 'complete'; output: string; latency_ms?: number; } ``` --- #### Sync Tier Overview **URL**: https://weyl.ai/api/sync/ **Description**: Real-time synchronous generation **Base URL:** `https://sync.render.weyl.ai` Synchronous generation on dedicated bare metal. POST your request, receive bytes directly. ## Image Generation ``` curl -X POST "https://sync.render.weyl.ai/image/flux/schnell/t2i?format=1024" \ -H "Authorization: Bearer $WEYL_API_KEY" \ -H "Content-Type: application/json" \ -d '{"prompt": "cyberpunk street scene"}' \ -o output.webp ``` ## Video Generation ``` curl -X POST "https://sync.render.weyl.ai/video/wan/default/i2v?format=720p" \ -H "Authorization: Bearer $WEYL_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "prompt": "she turns to face the camera", "image": "https://example.com/portrait.jpg" }' \ -o output.mp4 ``` ## Response Success returns 200 with binary data. The `Content-Location` header contains the permanent CDN URL. --- #### Capacity Management **URL**: https://weyl.ai/api/sync/capacity/ **Description**: Handling 503 errors The sync tier runs on dedicated capacity. When exhausted, requests return 503. ## Understanding 503 ``` HTTP/1.1 503 Service Unavailable Retry-After: 30 { "error": "capacity_exhausted", "message": "sync tier at capacity, retry in 30s or use async" } ``` ## Response Strategy ### 1. Retry with Backoff ``` def generate_with_backoff(url, data, headers, max_attempts=5): for attempt in range(max_attempts): resp = requests.post(url, json=data, headers=headers) if resp.status_code == 200: return resp.content if resp.status_code == 503: retry_after = int(resp.headers.get('Retry-After', 30)) backoff = retry_after * (2 ** attempt) time.sleep(backoff) continue resp.raise_for_status() ``` ### 2. Fallback to Async Switch to async tier when sync is exhausted. ``` # Try sync first try: resp = requests.post(sync_url, ...) if resp.status_code == 200: return resp.content except: pass # Fall back to async resp = requests.post(async_url, ...) ``` --- #### Image Generation (Sync) **URL**: https://weyl.ai/api/sync/image/ **Description**: Synchronous image generation **Endpoint:** `POST /image/{family}/{model}/{task}` Generate images with immediate response. ## Text-to-Image (t2i) ``` curl -X POST "https://sync.render.weyl.ai/image/flux/schnell/t2i?format=1024" \ -H "Authorization: Bearer $WEYL_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "prompt": "cyberpunk street at night", "guidance": 3.5, "seed": 42 }' \ -o output.webp ``` ## Image-to-Image (i2i) Transform an existing image. ``` curl -X POST "https://sync.render.weyl.ai/image/flux/dev/i2i?format=1024" \ -H "Authorization: Bearer $WEYL_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "prompt": "convert to watercolor style", "image": "https://example.com/photo.jpg", "strength": 0.7 }' \ -o transformed.webp ``` ## Common Parameters - `prompt` - Generation prompt (required) - `negative_prompt` - What to avoid - `steps` - Inference steps - `guidance` - Prompt adherence (1.0-5.0) - `seed` - Random seed --- #### Video Generation (Sync) **URL**: https://weyl.ai/api/sync/video/ **Description**: Synchronous video generation **Endpoint:** `POST /video/{family}/{model}/{task}` Generate video with immediate response. ## Image-to-Video (i2v) Animate a still image with motion. ``` curl -X POST "https://sync.render.weyl.ai/video/wan/default/i2v?format=720p" \ -H "Authorization: Bearer $WEYL_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "prompt": "she slowly turns to face the camera", "image": "https://example.com/portrait.jpg", "duration": 3, "cfg": 7.0 }' \ -o output.mp4 ``` ## Parameters **Required:** - `prompt` - Motion description - `image` - Source image URL or data URI **Optional:** - `duration` - Video length in seconds (0.5-10, default: 2) - `cfg` - Guidance scale (6-8 for WAN) - `steps` - Inference steps - `seed` - Random seed ## Response ``` HTTP/1.1 200 OK Content-Type: video/mp4 Content-Location: https://cdn.render.weyl.ai/v/xyz123.mp4