# Base64 to URL Source: https://docs.modelslab.com/3d-api/base64-to-url POST /3d/base64_to_url Let's you to upload a 3D object in base64 format and retrieve a URL for the object. ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v6/3d/base64_to_url' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key":"", "init_obj":"data:model/obj;base64," } ``` # Fetch 3D Source: https://docs.modelslab.com/3d-api/fetch POST /3d/fetch/{id} The Fetch 3D Response endpoint retrieves queued or already generated 3D objects. Note:This endpoint does not generate new 3D objects; it only returns already generated or queued ones. ## Request Send a `POST` request to the endpoint below with to retrieve queued images this does not generate new ones. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v6/3d/fetch/{id}' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "" } ``` # Image to 3D Source: https://docs.modelslab.com/3d-api/image-to-3d POST /3d/image_to_3d The Image to 3D API generates a 3D character from an input image. ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body to the endpoint. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v6/3d/image_to_3d' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key", "init_image": "https://i.pinimg.com/736x/7c/83/64/7c83645c903677dd93ef50fe953dceea.jpg", "ss_sampling_steps" : 50, "slat_sampling_steps" : 50, "output_format":"glb", "webhook": null, "track_id": null, "temp": "no" } ``` # 3D Generation API Source: https://docs.modelslab.com/3d-api/overview Transform text and images into 3D models and objects. Generate 3D characters from text prompts or reference images via ModelsLab's 3D API. ### Endpoints Generate a 3D image from a text prompt. Generate a 3D image from an input image. Let's you to upload a 3D object in base64 format and retrieve a URL for the object. Fetch the processing request status. # Text to 3D Source: https://docs.modelslab.com/3d-api/text-to-3d POST /3d/text_to_3d The Text to 3D endpoint generates a 3D object from a text-based prompt. ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v6/3d/text_to_3d' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key", "foreground_ratio": "0.85", "prompt": "a ghost wearing white bedsheet", "num_inference_steps": "30", "resolution": 512, "guidance_scale": "3", "ss_sampling_steps": 50, "slat_sampling_steps": 50, "seed": 0, "temp": "no", "webhook": null, "track_id": null } ``` # ModelsLab Agent Skills Source: https://docs.modelslab.com/agent-skills Install ModelsLab Agent Skills to generate AI images, videos, and audio directly from coding agents like Claude Code, Cursor, and other MCP-compatible tools. ## Overview ModelsLab Agent Skills are modular capabilities that extend your coding agents with ModelsLab-specific workflows. Each Skill bundles instructions (and optional resources) so your agent can use ModelsLab APIs consistently without repeating setup across projects. **What you get**: * Pre-built skills for image, video, audio, 3D, and more * A consistent workflow your agent can reuse automatically * Easy installation via the Skills CLI ## Quick Start ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} # Install all ModelsLab skills npx skills add modelslab/skills --all # Install a specific skill npx skills add modelslab/skills --skill modelslab-image-generation # List available skills npx skills add modelslab/skills --list ``` Use `--all` if you want your agent to cover all ModelsLab capabilities. ## Available Skills ### Generation Skills | Skill | Description | Use Cases | | ------------------------------------------------------ | ------------------------------------------------------------------- | ----------------------------------------------- | | 🎨 **Image Generation** (`modelslab-image-generation`) | Generate high-quality images from text prompts or transform images. | Product photos, marketing graphics, concept art | | 🎬 **Video Generation** (`modelslab-video-generation`) | Generate videos from text or animate images. | Product demos, social media videos, animations | | 🎵 **Audio Generation** (`modelslab-audio-generation`) | Generate speech, music, and sound effects with voice cloning. | Audiobooks, podcasts, game audio | | ✂️ **Image Editing** (`modelslab-image-editing`) | Background removal, upscaling, and editing tools. | E-commerce, real estate, restoration | | 🎲 **3D Generation** (`modelslab-3d-generation`) | Generate 3D models from text or images. | Game assets, 3D printing, AR/VR | | 🏠 **Interior Design** (`modelslab-interior-design`) | Room redesign and decoration. | Staging, renovation, mockups | ### Agent Control Plane Skills | Skill | Description | Use Cases | | ------------------------------------------------------------------ | ------------------------------------------------------------------ | -------------------------------------------------------- | | 🔑 **Account Management** (`modelslab-account-management`) | Signup, login, tokens, profile, API keys, and team management. | Agent bootstrapping, API key rotation, team onboarding | | 💳 **Billing & Subscriptions** (`modelslab-billing-subscriptions`) | Wallet funding, payment methods, subscriptions, invoices, coupons. | Auto-recharge, subscription lifecycle, invoice retrieval | | 🔍 **Model Discovery** (`modelslab-model-discovery`) | Search 50,000+ models and monitor usage analytics. | Model selection, usage monitoring, cost tracking | ### Platform Skills | Skill | Description | Use Cases | | ---------------------------------------- | --------------------------------------------- | --------------------------------------- | | 🔔 **Webhooks** (`modelslab-webhooks`) | Handle async work with webhook notifications. | Batch jobs, background tasks | | 📦 **SDK Usage** (`modelslab-sdk-usage`) | Guidance for ModelsLab SDKs. | Type safety, autocomplete, cleaner code | ## How Skills Work Skills live on disk as folders containing a `SKILL.md` file. When your agent sees a matching task, it loads only the relevant Skill instructions and any referenced resources. This keeps context light while still giving your agent expert guidance when it matters. ```text theme={"theme":{"light":"github-light","dark":"github-dark"}} modelslab-image-generation/ ├── SKILL.md ├── templates/ └── scripts/ ``` ## Install to Specific Agents You can target specific agents that support the Skills CLI: ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} npx skills add modelslab/skills --all -a claude-code -a cursor ``` ## Resources * **ModelsLab Skills repo**: [https://github.com/ModelsLab/skills](https://github.com/ModelsLab/skills) * **Docs**: [https://docs.modelslab.com](https://docs.modelslab.com) * **Dashboard**: [https://modelslab.com/dashboard](https://modelslab.com/dashboard) * **Discord**: [https://discord.gg/modelslab](https://discord.gg/modelslab) ## Next Steps Create a project and grab your key in the dashboard: [https://modelslab.com/dashboard](https://modelslab.com/dashboard) Run `npx skills add modelslab/skills --all` to enable all ModelsLab Skills. Ask your agent to generate images, videos, audio, or 3D using ModelsLab APIs. # Authentication Source: https://docs.modelslab.com/agents-api/authentication Agent signup, login/logout, password reset, email verification, and token refresh endpoints for the control plane. ## Endpoints | Method | Endpoint | Auth | Notes | | ------ | ----------------------------------------- | ------------ | ----------------------------------------------------------------------------------------------- | | `POST` | `/api/agents/v1/auth/signup` | None | Create user, create Stripe customer, send verification email | | `POST` | `/api/agents/v1/auth/login` | None | Returns Bearer token. Supports `token_expiry` selector | | `POST` | `/api/agents/v1/auth/verify-email` | None | Verify email with `verification_code` (no browser required). Returns `access_token` + `api_key` | | `POST` | `/api/agents/v1/auth/refresh` | Bearer token | Refresh/rotate access token without re-login | | `POST` | `/api/agents/v1/auth/logout` | Bearer token | Revokes current token | | `POST` | `/api/agents/v1/auth/logout-all` | Bearer token | Revokes all user tokens | | `POST` | `/api/agents/v1/auth/resend-verification` | None | Resends verification email | | `POST` | `/api/agents/v1/auth/forgot-password` | None | Sends password reset email | | `POST` | `/api/agents/v1/auth/reset-password` | None | Resets password with token | | `GET` | `/verify/{token}` | None | Compatibility verification endpoint | ## Signup ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} curl --request POST 'https://modelslab.com/api/agents/v1/auth/signup' \ --header 'Content-Type: application/json' \ --data '{ "email": "agent@example.com", "password": "secret123", "name": "Agent Runner" }' ``` ## Login ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} curl --request POST 'https://modelslab.com/api/agents/v1/auth/login' \ --header 'Content-Type: application/json' \ --data '{ "email": "agent@example.com", "password": "secret123", "device_name": "orchestrator-prod", "token_expiry": "1_month" }' ``` Supported `token_expiry` values: * `1_week` * `1_month` (default) * `3_months` * `never` Example response: ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "data": { "access_token": "", "token_type": "Bearer", "token_expiry": "1_month", "expires_at": "2026-03-21T09:30:00Z", "user": { "id": 123, "name": "Agent Runner", "email": "agent@example.com", "username": "agent", "verified": true }, "api_key": "" }, "error": null, "meta": { "request_id": "..." } } ``` ## Logout ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} curl --request POST 'https://modelslab.com/api/agents/v1/auth/logout' \ --header 'Authorization: Bearer ' ``` ## Resend Verification ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} curl --request POST 'https://modelslab.com/api/agents/v1/auth/resend-verification' \ --header 'Content-Type: application/json' \ --data '{"email":"agent@example.com"}' ``` ## Forgot / Reset Password ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} curl --request POST 'https://modelslab.com/api/agents/v1/auth/forgot-password' \ --header 'Content-Type: application/json' \ --data '{"email":"agent@example.com"}' ``` ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} curl --request POST 'https://modelslab.com/api/agents/v1/auth/reset-password' \ --header 'Content-Type: application/json' \ --data '{ "email":"agent@example.com", "token":"", "password":"new-secret123", "password_confirmation":"new-secret123" }' ``` ## Verify Email (Headless) Verify a user's email address using the `verification_code` from the verification email. This is the headless alternative to clicking the browser verification link, returning an `access_token` and `api_key` directly. ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} curl --request POST 'https://modelslab.com/api/agents/v1/auth/verify-email' \ --header 'Content-Type: application/json' \ --data '{ "verification_code": "" }' ``` Example response: ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "data": { "message": "Email verified successfully.", "access_token": "", "token_type": "Bearer", "expires_at": "2026-03-21T09:30:00Z", "user": { "id": 123, "name": "Agent Runner", "email": "agent@example.com", "username": "agent", "verified": true }, "api_key": "" }, "error": null, "meta": { "request_id": "..." } } ``` Use this endpoint in headless agent flows to avoid browser-based verification entirely. The `verification_code` is the token embedded in the verification email link. ## Refresh Token Rotate the current access token without re-authenticating with email/password. The old token is revoked and a new one is issued. ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} curl --request POST 'https://modelslab.com/api/agents/v1/auth/refresh' \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data '{ "token_expiry": "1_month", "device_name": "orchestrator-prod" }' ``` Example response: ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "data": { "access_token": "", "token_type": "Bearer", "token_expiry": "1_month", "expires_at": "2026-03-21T09:30:00Z", "message": "Token refreshed successfully. Previous token has been revoked." }, "error": null, "meta": { "request_id": "..." } } ``` Both `token_expiry` and `device_name` are optional. If omitted, the new token defaults to `1_month` expiry and inherits the previous token name. ## Verification Compatibility Route ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} curl --request GET 'https://modelslab.com/verify/' ``` This route exists for compatibility and supports browser redirect flow as well as JSON response mode. # Billing and Wallet Source: https://docs.modelslab.com/agents-api/billing-and-wallet Manage payment methods, billing profile, invoices, and wallet operations from the control plane. ## Billing Endpoints | Method | Endpoint | Auth | Purpose | | -------- | ----------------------------------------------------- | ------------ | ------------------------------------------------------------ | | `GET` | `/api/agents/v1/billing/overview` | Bearer token | Wallet summary, cards, subscriptions, invoice count | | `GET` | `/api/agents/v1/billing/stripe-config` | Bearer token | Get Stripe publishable key for client-side card tokenization | | `POST` | `/api/agents/v1/billing/setup-intent` | Bearer token | Create Stripe SetupIntent for headless card tokenization | | `POST` | `/api/agents/v1/billing/payment-link` | Bearer token | Create Stripe-hosted payment URL for human-assisted payments | | `GET` | `/api/agents/v1/billing/payment-methods` | Bearer token | List payment methods | | `POST` | `/api/agents/v1/billing/payment-methods` | Bearer token | Attach payment method | | `PUT` | `/api/agents/v1/billing/payment-methods/{id}/default` | Bearer token | Set default payment method | | `DELETE` | `/api/agents/v1/billing/payment-methods/{id}` | Bearer token | Remove payment method | | `GET` | `/api/agents/v1/billing/info` | Bearer token | Get billing profile | | `PUT` | `/api/agents/v1/billing/info` | Bearer token | Update billing profile | | `GET` | `/api/agents/v1/billing/invoices` | Bearer token | List invoices | | `GET` | `/api/agents/v1/billing/invoices/{id}` | Bearer token | Invoice detail | | `GET` | `/api/agents/v1/billing/invoices/{id}/pdf` | Bearer token | Invoice PDF/receipt URLs | ### Three Payment Paths ModelsLab supports three payment flows for agents, depending on the level of automation required: | Path | Flow | Best For | | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------- | | **Headless** | `GET /billing/stripe-config` -> tokenize card via Stripe API -> pass `payment_method_id` to `POST /wallet/fund` or `POST /subscriptions` | Fully automated agents with card details available | | **Setup Intent** | `POST /billing/setup-intent` -> confirm via Stripe -> reuse `payment_method_id` for future charges | Agents that save payment methods for repeated use | | **Human-Assisted** | `POST /billing/payment-link` -> forward URL to human -> human pays on Stripe Checkout -> agent polls `POST /wallet/confirm-checkout` or `POST /subscriptions/confirm-checkout` | Agents that need a human to complete payment | ### Get Stripe publishable key Retrieve the Stripe publishable key dynamically instead of hardcoding it. This ensures your agent always uses the current key. ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} curl --request GET 'https://modelslab.com/api/agents/v1/billing/stripe-config' \ --header 'Authorization: Bearer ' ``` Example response: ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "publishable_key": "pk_live_51JfPKxSDo1BGXG2x...", "instructions": "Use this key to call the Stripe API directly to create PaymentMethods. Card data is sent to Stripe only — never to ModelsLab." } ``` Always use this endpoint to fetch the publishable key — it handles key rotation automatically so your agent never needs redeploying. ### Create payment link (Human-Assisted flow) Create a Stripe-hosted payment URL that the agent can forward to a human user. The human completes payment on Stripe Checkout, then is redirected to ModelsLab's success page where they can copy the `session_id`. The agent then confirms the payment using `POST /wallet/confirm-checkout` or `POST /subscriptions/confirm-checkout`. ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} # Fund wallet — human pays $25 via Stripe Checkout curl --request POST 'https://modelslab.com/api/agents/v1/billing/payment-link' \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data '{ "purpose": "fund", "amount": 25 }' # Subscribe to a plan — human completes subscription via Stripe Checkout curl --request POST 'https://modelslab.com/api/agents/v1/billing/payment-link' \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data '{ "purpose": "subscribe", "plan_id": 10 }' ``` Parameters: * `purpose` (required, string): `"fund"` for wallet funding or `"subscribe"` for plan subscription * `amount` (required if `purpose` is `"fund"`, number): Amount in USD to fund the wallet * `plan_id` (required if `purpose` is `"subscribe"`, integer): The plan ID from `/subscriptions/plans` Example response: ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "payment_url": "https://checkout.stripe.com/c/pay/cs_live_...", "session_id": "cs_live_...", "purpose": "fund", "amount": 25, "expires_at": "2026-02-20T12:30:00Z", "instructions": "Forward this URL to the user. They will complete payment on Stripe's hosted checkout page. After payment, they are redirected to ModelsLab's success page where the session_id is displayed for copy-to-clipboard. Use the session_id to confirm the payment via POST /wallet/confirm-checkout or POST /subscriptions/confirm-checkout." } ``` The `success_url` and `cancel_url` are controlled by ModelsLab — agents do not pass them. After payment, the user is redirected to ModelsLab's payment success page where the `session_id` is shown with a copy-to-clipboard button. ### Card Data Policy Raw card PAN/CVV is **never** accepted on ModelsLab API endpoints. Agents must tokenize cards directly with the Stripe API using the ModelsLab publishable key, then pass the resulting `payment_method_id` to ModelsLab endpoints. ### Headless Card Tokenization (Recommended for Agents) Create a Stripe PaymentMethod directly using the ModelsLab publishable key. Card data goes to Stripe only — ModelsLab never sees raw card numbers. **Step 1 — Fetch the Stripe publishable key:** ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} curl --request GET 'https://modelslab.com/api/agents/v1/billing/stripe-config' \ --header 'Authorization: Bearer ' # Returns: { "publishable_key": "pk_live_...", "instructions": "..." } ``` **Step 2 — Create PaymentMethod via Stripe API:** ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} curl --request POST 'https://api.stripe.com/v1/payment_methods' \ --user ':' \ --data 'type=card' \ --data 'card[number]=4242424242424242' \ --data 'card[exp_month]=12' \ --data 'card[exp_year]=2027' \ --data 'card[cvc]=123' ``` Response includes a `payment_method_id` (e.g., `pm_1Xyz...`). **Step 3 — Use `payment_method_id` with ModelsLab endpoints:** ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} # Fund wallet curl --request POST 'https://modelslab.com/api/agents/v1/wallet/fund' \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data '{"amount": 25, "payment_method_id": "pm_1Xyz..."}' # Or subscribe to a plan curl --request POST 'https://modelslab.com/api/agents/v1/subscriptions' \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data '{"plan_id": 10, "payment_method_id": "pm_1Xyz..."}' ``` The publishable key is safe to embed in agent code — it can only create tokens, never charge directly. ### Attach payment method example ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} curl --request POST 'https://modelslab.com/api/agents/v1/billing/payment-methods' \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data '{ "payment_method_id": "pm_1Xyz...", "make_default": true }' ``` ## Wallet Endpoints | Method | Endpoint | Auth | Purpose | | -------- | ---------------------------------------- | ------------ | ------------------------------------------------------- | | `GET` | `/api/agents/v1/wallet/balance` | Bearer token | Quick wallet balance check | | `GET` | `/api/agents/v1/wallet/transactions` | Bearer token | Wallet ledger (deposits, charges, refunds) with filters | | `POST` | `/api/agents/v1/wallet/fund` | Bearer token | Fund wallet (payment method / checkout flow) | | `POST` | `/api/agents/v1/wallet/confirm-checkout` | Bearer token | Confirm a Stripe Checkout wallet funding session | | `PUT` | `/api/agents/v1/wallet/auto-funding` | Bearer token | Set auto-funding settings | | `DELETE` | `/api/agents/v1/wallet/auto-funding` | Bearer token | Disable auto-funding | | `POST` | `/api/agents/v1/wallet/withdraw` | Bearer token | Withdraw (reseller-only) | | `GET` | `/api/agents/v1/wallet/coupons/validate` | Bearer token | Validate coupon | | `POST` | `/api/agents/v1/wallet/coupons/redeem` | Bearer token | Redeem coupon | | `GET` | `/api/agents/v1/payments/{id}/status` | Bearer token | Check payment intent status | ### Wallet transactions example Query the wallet ledger with optional filters for transaction type, limit, and offset. ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} curl --request GET 'https://modelslab.com/api/agents/v1/wallet/transactions?type=credit&limit=20&offset=0' \ --header 'Authorization: Bearer ' ``` Query parameters: * `type` (optional): `credit` or `debit` * `limit` (optional, integer, max 200, default 50) * `offset` (optional, integer, default 0) Example response: ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "data": { "items": [ { "id": 456, "source": "stripe", "transaction_id": "pi_xxx", "type": "credit", "amount": 25.00, "status": "success", "usecase": "wallet_funding", "created_at": "2026-02-15T10:00:00Z" } ], "count": 1, "total": 12, "wallet": { "balance": 75.50, "currency": "USD", "total_credited": 150.00, "amount_used": 74.50 } }, "error": null, "meta": { "request_id": "..." } } ``` ### Wallet balance example Quick check of wallet balance without the full transaction ledger: ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} curl --request GET 'https://modelslab.com/api/agents/v1/wallet/balance' \ --header 'Authorization: Bearer ' ``` Example response: ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "data": { "balance": 75.50, "currency": "USD" }, "error": null, "meta": { "request_id": "..." } } ``` ### Wallet fund example Fund wallet with a `payment_method_id` obtained from the Stripe API (see [Headless Card Tokenization](#headless-card-tokenization-recommended-for-agents) above). ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} curl --request POST 'https://modelslab.com/api/agents/v1/wallet/fund' \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --header 'Idempotency-Key: fund-25-20260220-abc' \ --data '{ "amount": 25, "payment_method_id": "pm_1Xyz..." }' ``` ### Confirm wallet checkout (Human-Assisted flow) After a human completes payment via a Stripe Checkout URL (created with `POST /billing/payment-link`), the agent confirms the session to credit the wallet. The human is redirected to ModelsLab's success page after payment, where the `session_id` is displayed for them to copy and relay back to the agent. ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} curl --request POST 'https://modelslab.com/api/agents/v1/wallet/confirm-checkout' \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data '{ "session_id": "cs_live_..." }' ``` Parameters: * `session_id` (required, string): The Stripe Checkout session ID from `POST /billing/payment-link` response or copied by the human from the success page If the payment hasn't completed yet (human hasn't finished checkout), poll this endpoint with a short delay. Once the session is confirmed, the wallet balance is updated immediately. ### Coupon validate example Validate a coupon before redeeming (note: this is a GET request): ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} curl --request GET 'https://modelslab.com/api/agents/v1/wallet/coupons/validate?coupon_code=WELCOME50' \ --header 'Authorization: Bearer ' ``` ### Payment status example Check the status of a Stripe PaymentIntent (useful after wallet funding): ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} curl --request GET 'https://modelslab.com/api/agents/v1/payments/pi_xxx/status' \ --header 'Authorization: Bearer ' ``` Example response: ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "data": { "status": "succeeded", "payment_intent_id": "pi_xxx", "amount": 25.00, "currency": "usd" }, "error": null, "meta": { "request_id": "..." } } ``` Possible `status` values: `succeeded`, `pending`, `failed`. # Compatibility Notes Source: https://docs.modelslab.com/agents-api/compatibility-notes Migration and compatibility details for the new Agents API control plane. ## Email Verification Compatibility The compatibility endpoint is preserved: * `GET /verify/{token}` This supports existing verification links while enabling agent-first signup flows. ## Legacy AI Agent v6 Endpoints The following legacy endpoints are removed: * `POST /api/v6/ai_agent/create` * `POST /api/v6/ai_agent/get_queued_response` These calls now return route-not-found API error responses. ## Backward Compatibility Contract * Existing generation APIs and existing API key auth flow are unchanged. * New control-plane functionality is additive under `/api/agents/v1`. * Existing API consumers can continue using current generation endpoints without migration. ## Migration Guidance 1. Use `/api/agents/v1/auth/login` to obtain Bearer token (`token_expiry`: `1_week`, `1_month`, `3_months`, `never`). 2. Use Bearer token for profile, billing, team, and API-key management. 3. Continue using API keys for generation requests under `/api/v6`, `/api/v7`, `/api/v8`. # Headless Agent Flow Source: https://docs.modelslab.com/agents-api/headless-flow Complete account-to-generation workflow without a browser in 5 steps. ## Overview The Headless Agent Flow allows an AI agent or automation script to go from zero to generating content in 5 API calls, with no browser interaction required. Card data never touches ModelsLab servers — agents tokenize cards directly with Stripe. All responses include `X-RateLimit-Remaining` and `X-RateLimit-Reset` headers for rate-limit awareness. ## Stripe Publishable Key Agents fetch the Stripe publishable key via the API, then create PaymentMethods directly with Stripe. Card data never touches ModelsLab servers. ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} curl --request GET 'https://modelslab.com/api/agents/v1/billing/stripe-config' \ --header 'Authorization: Bearer ' ``` Returns `{ "publishable_key": "pk_live_...", "instructions": "..." }`. Always use this endpoint to get the current key — it handles key rotation automatically. ## The 5-Step Flow ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} curl --request POST 'https://modelslab.com/api/agents/v1/auth/signup' \ --header 'Content-Type: application/json' \ --data '{ "email": "agent@example.com", "password": "secret123", "name": "Agent Runner" }' ``` A verification email is sent automatically. Extract the `verification_code` from the verification email and verify without a browser. ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} curl --request POST 'https://modelslab.com/api/agents/v1/auth/verify-email' \ --header 'Content-Type: application/json' \ --data '{ "verification_code": "" }' ``` Returns `access_token` and `api_key` directly. Use the publishable key from Step 1 of the flow (fetched via `GET /billing/stripe-config`) to tokenize card details. Card data never touches ModelsLab servers. ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} curl --request POST 'https://api.stripe.com/v1/payment_methods' \ --user ':' \ --data 'type=card' \ --data 'card[number]=4242424242424242' \ --data 'card[exp_month]=12' \ --data 'card[exp_year]=2027' \ --data 'card[cvc]=123' ``` Returns a `payment_method_id` (e.g., `pm_1Xyz...`). Use this ID with ModelsLab endpoints — never send raw card numbers to ModelsLab. Use the `payment_method_id` from Step 3 to either fund the wallet or create a subscription. **Option A — Fund wallet (pay-as-you-go):** ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} curl --request POST 'https://modelslab.com/api/agents/v1/wallet/fund' \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data '{ "amount": 25, "payment_method_id": "pm_1Xyz..." }' ``` **Option B — Subscribe to a plan:** ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} curl --request POST 'https://modelslab.com/api/agents/v1/subscriptions' \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data '{ "plan_id": 10, "payment_method_id": "pm_1Xyz..." }' ``` Use `GET /subscriptions/plans` first to discover available plan IDs. Use the existing generation APIs (`/api/v6`, `/api/v7`, `/api/v8`) with the `api_key` returned in Step 2. See the [Image Generation](/image-generation/overview), [Video API](/video-api/overview), and [Speech & Audio](/voice-cloning/overview) docs for endpoint details. ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} curl --request POST 'https://modelslab.com/api/v6/images/text2img' \ --header 'Content-Type: application/json' \ --data '{ "key": "", "model_id": "flux", "prompt": "A futuristic cityscape at sunset", "width": 1024, "height": 1024 }' ``` ## Flow Diagram ```text theme={"theme":{"light":"github-light","dark":"github-dark"}} 1. POST /auth/signup --> account created, verification email sent 2. POST /auth/verify-email --> email verified, access_token + api_key returned 3. POST Stripe /v1/payment_methods --> card tokenized (pm_xxx), card data stays with Stripe 4. POST /wallet/fund or /subscriptions --> pay-as-you-go or subscription (headless, no redirect) 5. Use /api/v6, /api/v7, /api/v8 --> generate content with the api_key from step 2 ``` ## Alternative: Human-Assisted Payment If your agent does not have access to card details or the card requires 3D Secure, use the **Human-Assisted** flow instead. The agent creates a Stripe-hosted payment link and forwards it to a human: ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} curl --request POST 'https://modelslab.com/api/agents/v1/billing/payment-link' \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data '{"purpose": "fund", "amount": 25}' ``` The human completes payment on Stripe Checkout, is redirected to ModelsLab's success page with a `session_id`, and relays it to the agent. The agent then confirms: ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} # For wallet funding curl --request POST 'https://modelslab.com/api/agents/v1/wallet/confirm-checkout' \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data '{"session_id": "cs_live_..."}' # For subscriptions curl --request POST 'https://modelslab.com/api/agents/v1/subscriptions/confirm-checkout' \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data '{"session_id": "cs_live_..."}' ``` See [Billing & Wallet](/agents-api/billing-and-wallet#create-payment-link-human-assisted-flow) for full details on the three payment paths. ## Handling Card Failures When a card is declined, the API returns HTTP 402 with a structured error: ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "data": null, "error": { "code": "payment_declined", "message": "Your card was declined.", "details": { "decline_code": "insufficient_funds", "payment_intent_id": "pi_xxx" } } } ``` If a card requires 3D Secure authentication, the API returns HTTP 202: ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "data": { "payment": { "status": "requires_action", "payment_intent_id": "pi_xxx", "client_secret": "pi_xxx_secret_yyy" }, "message": "Additional authentication is required. Use modelslab.com/pricing to do payment for this transaction." } } ``` ## Rate Limits | Limiter | Limit | Applies to | | --------------- | ------------------- | ------------------------------------------- | | `agent-auth` | 20/min per IP+email | Signup, login, verify, forgot-password | | `agent-billing` | 15/min per IP+user | Wallet fund, subscriptions, payment methods | | `agent-general` | 120/min per IP+user | All other authenticated endpoints | ## Idempotency All billing mutations support an `Idempotency-Key` header. If you retry a request with the same key, the cached response is returned with `idempotency_replay: true` instead of charging again. ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} curl --request POST 'https://modelslab.com/api/agents/v1/wallet/fund' \ --header 'Authorization: Bearer ' \ --header 'Idempotency-Key: fund-25-20260220-abc' \ --header 'Content-Type: application/json' \ --data '{"amount": 25, "payment_method_id": "pm_1Xyz..."}' ``` Use deterministic idempotency keys (e.g., `fund-{amount}-{date}-{nonce}`) to prevent duplicate charges on retries. # Agents API (Control Plane) Source: https://docs.modelslab.com/agents-api/overview Manage the full ModelsLab account lifecycle via API: signup, auth, training, billing, wallet, subscriptions, servers, and more. The Agents API is the control plane for programmatic account management. It supports a fully headless workflow from signup to API key creation with no browser required. For content generation, use the existing generation APIs (`/api/v6`, `/api/v7`, `/api/v8`) with your API key. ## Base URL ```text theme={"theme":{"light":"github-light","dark":"github-dark"}} https://modelslab.com/api/agents/v1 ``` ## Authentication Model Split * **Agents API (`/api/agents/v1`)**: Bearer token (Sanctum personal access token) * **Generation APIs (`/api/v6`, `/api/v7`, `/api/v8`)**: existing API key flow continues Token issuance supports `token_expiry` on login: * `1_week` * `1_month` (default) * `3_months` * `never` Use a Bearer token to manage account and billing operations. Use API keys for generation requests via `/api/v6`, `/api/v7`, `/api/v8`. ## Standard Response Envelope (Agents API) ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "data": {}, "error": null, "meta": { "request_id": "" } } ``` Error shape: ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "data": null, "error": { "code": "validation_error", "message": "Human readable message", "details": {} }, "meta": { "request_id": "" } } ``` ## Rate Limiting Agents API uses dedicated limiters. All responses include `X-RateLimit-Remaining` and `X-RateLimit-Reset` headers. * `agent-auth`: signup/login/forgot/reset/resend verification * `agent-billing`: payment methods, wallet funding, coupon redemption, subscription mutations, server deployment * `agent-general`: authenticated control-plane endpoints ## Endpoint Groups Signup, login, logout, headless email verification, token refresh, and password reset. Read/update profile and manage API keys. Usage summaries/history and model discovery APIs. Payment methods, SetupIntent for headless card tokenization, billing info, invoices, wallet transactions, and wallet funding. Discover plans, pay-as-you-go options, direct headless subscriptions, and manage subscription lifecycle. Start and monitor model training and fine-tuning jobs. Deploy and manage custom/enterprise dedicated servers. Presigned URL and base64 file uploads for training and generation. Team members, invites, and invitation acceptance. Complete account-to-generation walkthrough in 6 steps with no browser. Verification compatibility route and removed legacy endpoints. # Profile and API Keys Source: https://docs.modelslab.com/agents-api/profile-and-api-keys Manage account profile/preferences and API keys through the Agents control plane. ## Profile Endpoints | Method | Endpoint | Auth | Purpose | | ------- | ------------------------------- | ------------ | ---------------------------------------------------- | | `GET` | `/api/agents/v1/me` | Bearer token | Get account profile, preferences, and wallet summary | | `PATCH` | `/api/agents/v1/me` | Bearer token | Update profile fields | | `PATCH` | `/api/agents/v1/me/preferences` | Bearer token | Update preference fields | ### Update profile example ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} curl --request PATCH 'https://modelslab.com/api/agents/v1/me' \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data '{ "name": "Agent Runner", "username": "agent-runner", "about_me": "Automation account" }' ``` ### Update preferences example ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} curl --request PATCH 'https://modelslab.com/api/agents/v1/me/preferences' \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data '{ "nsfw_content": false, "wallet_notification_enabled": true, "wallet_notification_threshold": 10 }' ``` ## API Key Endpoints | Method | Endpoint | Auth | Purpose | | -------- | ------------------------------ | ------------ | ----------------------- | | `GET` | `/api/agents/v1/api-keys` | Bearer token | List API keys | | `POST` | `/api/agents/v1/api-keys` | Bearer token | Create API key | | `GET` | `/api/agents/v1/api-keys/{id}` | Bearer token | Get API key details | | `PUT` | `/api/agents/v1/api-keys/{id}` | Bearer token | Update API key metadata | | `DELETE` | `/api/agents/v1/api-keys/{id}` | Bearer token | Delete API key | ### Create API key example ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} curl --request POST 'https://modelslab.com/api/agents/v1/api-keys' \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data '{ "name": "Production Key", "notes": "Used by orchestrator" }' ``` ### Use API key for generation APIs Generation endpoints still use API key flow. Example: `/api/v6/images/text2img` with `key` in payload. # Subscriptions Source: https://docs.modelslab.com/agents-api/subscriptions Create and manage plan subscriptions from the Agents control plane. ## Endpoints | Method | Endpoint | Auth | Purpose | | ------ | ----------------------------------------------- | ------------ | ---------------------------------------------------------------------------- | | `GET` | `/api/agents/v1/subscriptions/plans` | Bearer token | List available subscription plans and pay-as-you-go options | | `GET` | `/api/agents/v1/subscriptions` | Bearer token | List user subscriptions (addon, enterprise, normal) | | `POST` | `/api/agents/v1/subscriptions` | Bearer token | Create subscription — headless with `payment_method_id` or Checkout redirect | | `POST` | `/api/agents/v1/subscriptions/confirm-checkout` | Bearer token | Confirm a Stripe Checkout subscription session | | `GET` | `/api/agents/v1/subscriptions/{id}/status` | Bearer token | Check subscription status | | `PUT` | `/api/agents/v1/subscriptions/{id}` | Bearer token | Change subscription plan | | `POST` | `/api/agents/v1/subscriptions/{id}/pause` | Bearer token | Pause subscription | | `POST` | `/api/agents/v1/subscriptions/{id}/resume` | Bearer token | Resume subscription | | `POST` | `/api/agents/v1/subscriptions/{id}/reset-cycle` | Bearer token | Reset billing cycle anchor | ### Discover available plans Use this endpoint to list all subscription plans and learn about pay-as-you-go options before creating a subscription. ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} curl --request GET 'https://modelslab.com/api/agents/v1/subscriptions/plans' \ --header 'Authorization: Bearer ' \ --header 'Accept: application/json' ``` **Response structure:** ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "data": { "subscription_plans": [ { "id": 10, "name": "Basic Enterprise", "category": "enterprise", "period": "monthly", "type": "basic", "price": 249.0, "api_call_limit": 0, "rate_limit": 0, "features": ["Unlimited Images", "No Rate Limiter", "..."] } ], "pay_as_you_go": { "available": true, "description": "Pay only for what you use with wallet-based billing. No subscription required.", "minimum_topup_usd": 10.00, "currency": "USD", "auto_payments": { "supported": true, "description": "Automatically top up your wallet when balance drops below a threshold.", "configure_endpoint": "PUT /api/agents/v1/wallet/auto-funding", "disable_endpoint": "DELETE /api/agents/v1/wallet/auto-funding" }, "fund_endpoint": "POST /api/agents/v1/wallet/fund" }, "count": 37 } } ``` Use the `id` from a plan in `subscription_plans` as the `plan_id` when creating a subscription. Alternatively, use the pay-as-you-go option by funding your wallet directly. ### Create subscription (Headless — Recommended for Agents) Create a subscription using a `payment_method_id` obtained from the Stripe API. No browser redirect needed. First, fetch the publishable key via `GET /billing/stripe-config`, then create a PaymentMethod via the Stripe API (see [Headless Agent Flow](/agents-api/headless-flow) for details): ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} # Step 1: Fetch Stripe publishable key STRIPE_PK=$(curl -s 'https://modelslab.com/api/agents/v1/billing/stripe-config' \ -H 'Authorization: Bearer ' | jq -r '.publishable_key') # Step 2: Create PM via Stripe (card data stays with Stripe) curl --request POST 'https://api.stripe.com/v1/payment_methods' \ --user "$STRIPE_PK:" \ --data 'type=card' \ --data 'card[number]=4242424242424242' \ --data 'card[exp_month]=12' \ --data 'card[exp_year]=2027' \ --data 'card[cvc]=123' # Step 3: Subscribe with the pm_id curl --request POST 'https://modelslab.com/api/agents/v1/subscriptions' \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --header 'Idempotency-Key: sub-plan10-20260220' \ --data '{ "plan_id": 10, "payment_method_id": "pm_1Xyz..." }' ``` Parameters: * `plan_id` (required, integer): The plan ID from the `/subscriptions/plans` endpoint * `payment_method_id` (optional, string): Stripe PM ID from the Stripe API. If omitted, falls back to Stripe Checkout redirect. * `success_url` / `cancel_url` (optional): Only used when `payment_method_id` is omitted (Checkout redirect flow). Example response (headless): ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "data": { "message": "Subscription created.", "subscription": { "id": 45, "plan_id": 10, "feature": "enterprise", "status": "active" }, "stripe_subscription_id": "sub_xxx", "status": "active" }, "error": null, "meta": { "request_id": "..." } } ``` If the card requires 3D Secure, the response returns HTTP 402 with `decline_code` details. Cards requiring authentication should be handled via `modelslab.com/pricing` instead. ### Confirm subscription checkout (Human-Assisted flow) After a human completes a subscription payment via a Stripe Checkout URL (created with `POST /billing/payment-link` with `purpose: "subscribe"`), the agent confirms the session to activate the subscription. The human is redirected to ModelsLab's success page after payment, where the `session_id` is displayed for them to copy and relay back to the agent. ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} curl --request POST 'https://modelslab.com/api/agents/v1/subscriptions/confirm-checkout' \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data '{ "session_id": "cs_live_..." }' ``` Parameters: * `session_id` (required, string): The Stripe Checkout session ID from `POST /billing/payment-link` response or copied by the human from the success page If the payment hasn't completed yet (human hasn't finished checkout), poll this endpoint with a short delay. Once the session is confirmed, the subscription becomes active immediately. ### Check subscription status ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} curl --request GET 'https://modelslab.com/api/agents/v1/subscriptions/45/status' \ --header 'Authorization: Bearer ' ``` Example response: ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "data": { "id": 45, "plan_id": 10, "status": "active", "stripe_subscription_id": "sub_xxx", "current_period_start": "2026-02-20T00:00:00Z", "current_period_end": "2026-03-20T00:00:00Z" }, "error": null, "meta": { "request_id": "..." } } ``` Possible `status` values: `active`, `past_due`, `canceled`, `paused`, `trialing`. ### Update subscription plan example ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} curl --request PUT 'https://modelslab.com/api/agents/v1/subscriptions/45' \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data '{"new_plan_id": 456}' ``` # Teams Source: https://docs.modelslab.com/agents-api/teams Manage team members and invitations via the Agents control plane APIs. ## Endpoints | Method | Endpoint | Auth | Purpose | | -------- | ---------------------------------------------------- | ------------ | ------------------------------------- | | `GET` | `/api/agents/v1/teams` | Bearer token | List team members and pending invites | | `POST` | `/api/agents/v1/teams` | Bearer token | Send invite | | `GET` | `/api/agents/v1/teams/{id}` | Bearer token | Team member details | | `PUT` | `/api/agents/v1/teams/{id}` | Bearer token | Update role/permissions/status | | `DELETE` | `/api/agents/v1/teams/{id}` | Bearer token | Remove team member | | `POST` | `/api/agents/v1/teams/{id}/resend-invite` | Bearer token | Resend invite | | `POST` | `/api/agents/v1/teams/invitations/{inviteId}/accept` | Bearer token | Accept invitation | ### Send invite example ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} curl --request POST 'https://modelslab.com/api/agents/v1/teams' \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data '{"email": "teammate@example.com"}' ``` ### Accept invite example ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} curl --request POST 'https://modelslab.com/api/agents/v1/teams/invitations//accept' \ --header 'Authorization: Bearer ' ``` # Usage and Models Source: https://docs.modelslab.com/agents-api/usage-and-models Retrieve usage, product limits, and discover models through the Agents API and generic model-search APIs. ## Usage Endpoints | Method | Endpoint | Auth | Purpose | | ------ | ------------------------------- | ------------ | -------------------------------------- | | `GET` | `/api/agents/v1/usage/summary` | Bearer token | High-level usage, limits, and wallet | | `GET` | `/api/agents/v1/usage/products` | Bearer token | Product-wise plan limits/remaining | | `GET` | `/api/agents/v1/usage/history` | Bearer token | Usage timeline (`from`, `to`, `limit`) | Usage history query parameters: * `from` (optional, date) * `to` (optional, date) * `limit` (optional, integer, max 200) ## Agent Model Discovery Endpoints | Method | Endpoint | Auth | Purpose | | ------ | --------------------------------- | ------------ | -------------------------------------------------- | | `GET` | `/api/agents/v1/models` | Bearer token | Search/filter paginated model catalog | | `GET` | `/api/agents/v1/models/filters` | Bearer token | Filter metadata (sorts/types/base models/features) | | `GET` | `/api/agents/v1/models/tags` | Bearer token | Active model tags | | `GET` | `/api/agents/v1/models/providers` | Bearer token | Providers list | | `GET` | `/api/agents/v1/models/{modelId}` | Bearer token | Model details (includes `parameters` JSON Schema) | The model detail endpoint returns endpoint configurations with a `parameters` object — a JSON Schema describing each endpoint's accepted parameters (types, constraints, defaults, enums). This provides a clean, machine-readable alternative to the raw UI `config` array. Common model query parameters: * `feature` * `search` * `model_type` * `model_subcategory` * `base_model` * `provider` * `sort` (`recommended`, `latest`, `most-used`, `asc`, `desc`, `sort-asc`, `sort-desc`) * `per_page` * `tags` (array or comma-separated) ### Example ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} curl --request GET 'https://modelslab.com/api/agents/v1/models?feature=imagen&search=flux&per_page=20' \ --header 'Authorization: Bearer ' ``` ## Generic Model Discovery under Existing API Key Flow These endpoints are available for existing API-key users as well: | Method | Endpoint | Auth | | ------ | -------------------------------- | --------------- | | `GET` | `/api/v6/model-search` | API key (`key`) | | `GET` | `/api/v6/model-search/filters` | API key (`key`) | | `GET` | `/api/v6/model-search/tags` | API key (`key`) | | `GET` | `/api/v6/model-search/providers` | API key (`key`) | | `GET` | `/api/v6/model-search/{modelId}` | API key (`key`) | Example: ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} curl --request GET 'https://modelslab.com/api/v6/model-search?key=&search=flux' ``` # API Reference Source: https://docs.modelslab.com/api-reference ModelsLab API reference: endpoints for image generation, video creation, voice cloning, 3D models, and more. Request examples and response schemas. ModelsLab is a Developer-first [AI Platform](https://modelslab.com) for image generation, video creation, and multimodal AI applications. Built for developers and [Enterprise](https://modelslab.com/enterprise), ModelsLab provides state-of-the-art generative AI [Models](https://modelslab.com/models). Ready to start building? Here are your next steps: ### Quick Start Options Tutorials to integrate ModelsLab APIs into your applications Test models and experiment with parameters in our web interface Get started quickly with our official SDKs for popular languages ### Enterprise Solutions For enterprise customers requiring custom solutions, dedicated support, or private deployments: Contact our enterprise team at [support@modelslab.com](mailto:support@modelslab.com) to discuss custom pricing, SLAs, and deployment options. Start building the future of AI-powered applications with ModelsLab today! # Authentication Source: https://docs.modelslab.com/authentication Learn how to authenticate your ModelsLab API requests. Get your API key, configure headers, and securely integrate ModelsLab AI APIs into your application. ## Getting Your API Key Sign up at [modelslab.com](https://modelslab.com) if you haven't already. Navigate to your [API Keys Dashboard](https://modelslab.com/dashboard/api-keys). Click **Create New Key** and copy your API key immediately. Save your key in a secure location. You won't be able to see it again. Never share your API key publicly or commit it to version control. Treat it like a password. ## Using Your API Key Include your API key in every request using the `key` parameter in the request body: ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key_here", "prompt": "A beautiful sunset over mountains", ... } ``` ## Code Examples ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}} import requests API_KEY = "your_api_key_here" # Use environment variables in production response = requests.post( "https://modelslab.com/api/v6/images/text2img", json={ "key": API_KEY, "prompt": "A beautiful sunset over mountains", "model_id": "flux", "width": 512, "height": 512 } ) data = response.json() print(data) ``` ```javascript JavaScript theme={"theme":{"light":"github-light","dark":"github-dark"}} const API_KEY = "your_api_key_here"; // Use environment variables in production const response = await fetch("https://modelslab.com/api/v6/images/text2img", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ key: API_KEY, prompt: "A beautiful sunset over mountains", model_id: "flux", width: 512, height: 512 }) }); const data = await response.json(); console.log(data); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"github-dark"}} curl -X POST "https://modelslab.com/api/v6/images/text2img" \ -H "Content-Type: application/json" \ -d '{ "key": "your_api_key_here", "prompt": "A beautiful sunset over mountains", "model_id": "flux", "width": 512, "height": 512 }' ``` ```php PHP theme={"theme":{"light":"github-light","dark":"github-dark"}} $apiKey, "prompt" => "A beautiful sunset over mountains", "model_id" => "flux", "width" => 512, "height" => 512 ])); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); curl_close($ch); $data = json_decode($response, true); print_r($data); ?> ``` ```go Go theme={"theme":{"light":"github-light","dark":"github-dark"}} package main import ( "bytes" "encoding/json" "fmt" "net/http" ) func main() { apiKey := "your_api_key_here" payload := map[string]interface{}{ "key": apiKey, "prompt": "A beautiful sunset over mountains", "model_id": "flux", "width": 512, "height": 512, } jsonData, _ := json.Marshal(payload) resp, err := http.Post( "https://modelslab.com/api/v6/images/text2img", "application/json", bytes.NewBuffer(jsonData), ) if err != nil { panic(err) } defer resp.Body.Close() var result map[string]interface{} json.NewDecoder(resp.Body).Decode(&result) fmt.Println(result) } ``` ## Environment Variables Always use environment variables to store your API key in production applications. ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}} import os API_KEY = os.environ.get("MODELSLAB_API_KEY") ``` ```javascript JavaScript (Node.js) theme={"theme":{"light":"github-light","dark":"github-dark"}} const API_KEY = process.env.MODELSLAB_API_KEY; ``` ```bash Shell theme={"theme":{"light":"github-light","dark":"github-dark"}} export MODELSLAB_API_KEY="your_api_key_here" ``` ## Security Best Practices Never hardcode API keys in your source code. Use environment variables or secret management tools. Create different API keys for development, staging, and production environments. Periodically rotate your API keys, especially if you suspect they may have been compromised. Regularly check your [dashboard](https://modelslab.com/dashboard) for unusual API activity. ## Authentication Errors | Status Code | Error Message | Solution | | ----------- | --------------------- | ------------------------------------------------------ | | 401 | Invalid API key | Verify your API key is correct and hasn't been revoked | | 401 | API key required | Include the `key` parameter in your request body | | 402 | Insufficient credits | Add credits to your account or upgrade your plan | | 403 | Feature not available | This feature requires a higher subscription tier | For detailed error handling, see our [Error Codes](/error-codes) documentation. ## API Key Management You can manage your API keys from the [dashboard](https://modelslab.com/dashboard/api-keys): * **Create** new keys for different applications * **Revoke** compromised or unused keys * **View** usage statistics per key * **Set** rate limits (Enterprise plans) ## Next Steps Make your first API call in 5 minutes Understand API rate limits for your plan Handle errors gracefully in your application Use our official SDKs for faster development # Clear Cache Source: https://docs.modelslab.com/enterprise-api/3d-api/clear-cache POST /clear_cache This endpoint is used to clear the API's cache. ## Request Send a `POST` request to below endpoint to clear the API's cache. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/3d/clear_cache' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Clear Queue Source: https://docs.modelslab.com/enterprise-api/3d-api/clear-queue POST /clear_queue This endpoint is used to clear the API's queue. ## Request Send a `POST` request to below endpoint to clear the API's cache. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/3d/clear_queue' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Fetch 3D Source: https://docs.modelslab.com/enterprise-api/3d-api/fetch POST /fetch/{id} Fetch Queued generated response. This endpoint does not generate new images, it returns already generated/queued images. ## Request Send a `POST` request to below endpoint to return the corresponding queued images. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/3d/fetch/{id}' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Image to 3D Source: https://docs.modelslab.com/enterprise-api/3d-api/image-to-3d The Image to 3D API generates an 3D character from an image. Make sure you add your [s3 details](/enterprise-api/general/update-s3-details) for `realtime` server, so you can receive image generated in your bucket. Images generated without s3 details being added will be delete after **24hours** ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body to the endpoint. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/3d/image_to_3d' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key", "image": "https://i.pinimg.com/736x/7c/83/64/7c83645c903677dd93ef50fe953dceea.jpg", "ss_sampling_steps" : 50, "slat_sampling_steps" : 50, "output_format":"glb", "webhook": null, "track_id": null, "temp": "no" } ``` ## Body Attributes Your API Key used for request authorization. The input image for 3D conversion. Whether to render a NeRF video of the 3D model. The format of the output 3D object (`glb`, `obj`, `stl`, `ply`). Specifies the resolution of the generated 3D model. Max: 512. Determines whether multiple images are processed together. When set to true, image should contain multiple POVs of the subject in a transparent PNG. Controls the strength of style-space guidance. Number of sampling steps for style-space guidance. Range: 1 to 50. Controls the strength of slat guidance. Range: 0.0 to 10.0. Number of sampling steps for slat guidance. Range: 1 to 50. Degree of mesh simplification. Range: 0.90 to 0.98. Size of chunks used in the process (affects VRAM usage). Max: 12000. Random seed for reproducibility. If set to 0, a random seed will be generated. If set to `"yes"`, the output files will be saved in a temporary directory. # Enterprise 3D API Source: https://docs.modelslab.com/enterprise-api/3d-api/overview Enterprise-grade 3D generation on dedicated GPU servers. Text-to-3D and image-to-3D with full server management and cache control. Not on Enterprise yet? Get your enterprise plan at [ModelsLab](https://modelslab.com/enterprise) ### Endpoints This endpoint generates 3D from text. This endpoint generates 3D from an image. This endpoint returns an already generated response by passing its **ID** with the endpoint location. This endpoint clears the server cache. This endpoint clears the server queue. This endpoint updates the server to the latest version. This endpoint restarts the server. This endpoint provides system details of your enterprise server. # Restart Server Source: https://docs.modelslab.com/enterprise-api/3d-api/restart-server POST /restart_server This endpoint is used to restart your dedicated server. ## Request ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/3d/restart_server' \ ``` Send a `POST` request to below endpoint to restart your dedicated server. ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # System Details Source: https://docs.modelslab.com/enterprise-api/3d-api/system-details POST /system_details This endpoint returns information about your server. ## Request Send a `POST` request to below endpoint to get information about your server. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/3d/system_details' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Text to 3D Source: https://docs.modelslab.com/enterprise-api/3d-api/text-to-3d This endpoint generates an 3d object from a text prompt. Make sure you add your [s3 details](/enterprise-api/general/update-s3-details) for `3d` server, so you can receive image generated in your bucket. Images generated without s3 details being added will be delete after **24hours** ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/3d/text_to_3d' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key", "foreground_ratio": "0.85", "prompt": "a ghost wearing white bedsheet", "num_inference_steps": "30", "resolution": 512, "guidance_scale": "3", "ss_sampling_steps": 50, "slat_sampling_steps": 50, "output_format":"glb", "seed": 0, "temp": "no", "webhook": null, "track_id": null } ``` ## Body Attributes Your API Key used for request authorization. Specifies the model to be used for the 3D generation. Text prompt for generating the 3D model. Whether to render a NeRF video of the 3D model. The format of the output 3D object (`glb`, `obj`, `stl`, `ply`). Negative prompt to exclude certain elements. Controls the guidance between the prompt and the generated model. The number of inference steps to generate the 3D model. Controls the strength of style-space guidance. Number of sampling steps for style-space guidance. Range: 1 to 50. Controls the strength of slat guidance. Range: 0.0 to 10.0. Number of sampling steps for slat guidance. Range: 1 to 50. Degree of mesh simplification. Range: 0.90 to 0.98. Ratio of the foreground size to the image size. Only used when `remove_bg` is enabled. If true, removes the background from the generated 3D model. Specifies the resolution of the generated 3D model. Max: 512. Size of chunks used in the process (affects VRAM usage). Max: 12000. Random seed for reproducibility. If set to 0, a random seed will be generated. If set to `"yes"`, the output files will be saved in a temporary directory. # Update Server Source: https://docs.modelslab.com/enterprise-api/3d-api/update-server POST /update_server This endpoint is used to update your dedicated server ## Request Send a `POST` request to below endpoint to update your dedicated server. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/3d/update_server' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Clear Cache Source: https://docs.modelslab.com/enterprise-api/face-gen/clear-cache POST /face_gen/clear_cache This endpoint is used to clear cache your dedicated server. ## Request Send a `POST` request to below endpoint to clear the API's cache. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/face_gen/clear_cache' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Clear Queue Source: https://docs.modelslab.com/enterprise-api/face-gen/clear-queue POST /face_gen/clear_queue This endpoint is used to clear queue of your dedicated server. ## Request Send a `POST` request to below endpoint to clear the API's cache. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/face_gen/clear_queue' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Fetch Image Source: https://docs.modelslab.com/enterprise-api/face-gen/fetch POST /face_gen/fetch/{id} This endpoint is used to fetch your queued generations. ## Request Send a `POST` request to below endpoint to return the corresponding queued images. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/face_gen/fetch/{id}' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Face Generator Source: https://docs.modelslab.com/enterprise-api/face-gen/make-gen This endpoint allows you to generate image with the face image provided. Face gen endpoint result Make sure you add your [s3 details](/enterprise-api/general/update-s3-details) for `face_gen` server, so you can receive image generated in your bucket. Images generated without s3 details being added will be delete after **24hours** ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body to the endpoint. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/face_gen/make_gen' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key", "prompt": "pretty woman", "negative_prompt": "anime, cartoon, drawing, big nose, long nose, fat, ugly, big lips, big mouth, face proportion mismatch, unrealistic, monochrome, lowres, bad anatomy, worst quality, low quality, blurry", "face_image":"https://media.allure.com/photos/647f876463cd1ef47aab9c88/3:2/w_2465,h_1643,c_limit/angelina%20jolie%20blonde%20hair%20chloe.jpg", "width": "512", "height": "512", "samples": "1", "num_inference_steps": "21", "safety_checker": false, "s_scale":1.0, "seed":1234, "safety_checker_type":"blur", "base64": false, "guidance_scale": 7.5, "webhook": null, "track_id": null } ``` ## Body Attributes Your API Key used for request authorization. Text prompt with description of the things you want in the image to be generated. Link or valid base64 data (data:image/jpeg;base64,) of the face you want generations to resemble. Whether to run the safety checker to prevent NSFW image generation. Modify image if NSFW images are found. Options: blur, sensitive\_content\_text, pixelate, black. Width of your generated image. Max dimension: 512 x 768. Height of your generated image. Max dimension: 512 x 768. Number of denoising steps. Accepted values: 21, 31, 41. Scale for classifier-free guidance. Adjust the weight of the face structure. Range: 0.0 to 2.0. Seed used to reproduce results. Same seed will generate the same image again. Number of images to be returned in response. Max: 2. If true, face\_image is in base64 format or output images will be returned as base64 strings. URL to receive a POST call once image generation is complete. ID returned in the webhook API call to identify the request. # Enterprise Face Generation API Source: https://docs.modelslab.com/enterprise-api/face-gen/overview AI face generation on dedicated enterprise GPU servers. Generate realistic faces with full server management and cache control. Not on Enterprise yet? Get your enterprise plan at [ModelsLab](https://modelslab.com/enterprise) ## Available Endpoints This endpoint allows you to generate an image with the face image provided. This endpoint clears the server cache. This endpoint clears the server queue. This endpoint restarts the server. This endpoint checks for server details. This endpoint updates the server to the latest version. This endpoint fetches queued or processing requests. # Restart Server Source: https://docs.modelslab.com/enterprise-api/face-gen/restart-server POST /face_gen/restart_server This endpoint is used to restart your dedicated server. ## Request Send a `POST` request to below endpoint to restart your dedicated server. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/face_gen/restart_server' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # System Details Source: https://docs.modelslab.com/enterprise-api/face-gen/system-details POST /face_gen/system_details This endpoint is used to get system details of your dedicated server. ## Request Send a `POST` request to below endpoint to get information about your server. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/face_gen/system_details' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Update Server Source: https://docs.modelslab.com/enterprise-api/face-gen/update-server POST /face_gen/update_server This endpoint is used to update your dedicated server. ## Request Send a `POST` request to below endpoint to update your dedicated server. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/face_gen/update_server' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Clear Cache Source: https://docs.modelslab.com/enterprise-api/faceswap/clear-cache POST /faceswap/clear_cache This endpoint is used to clear the API's cache. ## Request Send a `POST` request to below endpoint to clear the API's cache. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/faceswap/clear_cache' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Clear Queue Source: https://docs.modelslab.com/enterprise-api/faceswap/clear-queue POST /faceswap/clear_queue This endpoint is used to clear the API's queue. ## Request Send a `POST` request to below endpoint to clear the API's cache. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/faceswap/clear_queue' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Fetch Queued Video Source: https://docs.modelslab.com/enterprise-api/faceswap/fetch POST /faceswap/fetch Fetch Queued Request API fetches queued request. This endpoint does not generate new video, it returns already generated/queued videos. ## Request Send a `POST` request to below endpoint to return the corresponding queued videos. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/faceswap/fetch/{id}' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Multiple Face Swap Source: https://docs.modelslab.com/enterprise-api/faceswap/multiple-face-swap Multiple Face Swap endpoint allows swapping faces in all detected faces within a single image. ## Request Make a `POST` request to below endpoint and pass the required parameters in the request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/faceswap/multiple_face_swap' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key", "init_image":"https://i.pinimg.com/564x/4c/6a/d0/4c6ad0f74a3a251344cb115699a9a7c9.jpg", "target_image":"https://i.pinimg.com/564x/11/ac/0d/11ac0ddaf6962e395f30abc61043393e.jpg", "base64":false, "webhook": null, "track_id": null } ``` ## Body Attributes Your API Key used for request authorization. The first image containing a face to be swapped. (URL string) The second image containing a face to replace the first image. (URL string) If provided `init_image` is in base64 format or if you want generated images as base64 string, set to true. Default: false. Set a URL to receive a POST API call once the image generation is complete. Whether the generated result should have a watermark. Available options: `true`, `false` The image to use as a watermark. If not provided, a default watermark will be used. Parameter is only used if `watermark` is set to `true`. This ID is returned in the response to the webhook API call. Used to identify the webhook request. # Enterprise Face Swap API Source: https://docs.modelslab.com/enterprise-api/faceswap/overview Enterprise face swap video generation on dedicated GPU servers. Face swapping with private infrastructure and full server control. Not on Enterprise yet? Get your enterprise plan at [ModelsLab](https://modelslab.com/enterprise) ## Endpoints The Single Face Swap endpoint allows swapping faces in a single image. The Multiple Face Swap endpoint allows swapping faces in all detected faces within a single image. The Single Video Swap endpoint allows swapping faces in all detected faces within a single video. The Specific Video Swap endpoint allows swapping specific faces according to a reference face. This endpoint clears the server cache. This endpoint restarts the server. This endpoint fetches queued and processing requests. This endpoint clears the server queue. This endpoint provides system details of your server. This endpoint updates the server to the latest version. # Restart Server Source: https://docs.modelslab.com/enterprise-api/faceswap/restart-server POST /faceswap/restart_server This endpoint is used to restart your dedicated server. ## Request Send a `POST` request to below endpoint to restart your dedicated server. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/faceswap/restart_server' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Single Video Swap Source: https://docs.modelslab.com/enterprise-api/faceswap/single-video-swap Single Video Swap endpoint allows swapping faces in all detected faces within a single video. ## Request Make a `POST` request to below endpoint and pass the required parameters in the request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/faceswap/single_video_swap' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key", "init_image":"https://plus.unsplash.com/premium_photo-1661508557554-e3d96f2fdde5?fm=jpg&q=60&w=3000&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxzZWFyY2h8OXx8YmVhdXRpZnVsJTIwZ2lybHxlbnwwfHwwfHx8MA%3D%3D", "init_video":"https://tawk.link/6332cd5154f06e12d8971855/vc/66d997a6a2bc5fe2b627a250/v/4239c555189b772d5ca1bd5aa4bf872c4c12a07e/sdfsdfsdf.mp4", "output_format":"mp4", "webhook":null, "track_id": null } ``` ## Body Attributes Your API Key used for request authorization. The image containing multiple faces to be swapped. (URL string) The video containing the face(s) to replace the faces in the image. Only videos less than 1 minute are accepted. If using YouTube, ensure the video is not made for kids or classified as adult content. (URL string) The output format of the video. Available options: `mp4` Whether the generated result should have a watermark. Available options: `true`, `false` The image to use as a watermark. If not provided, a default watermark will be used. Parameter is only used if `watermark` is set to `true`. Set a URL to receive a POST API call once the image generation is complete. This ID is returned in the response to the webhook API call. Used to identify the webhook request. # Specific Face Swap Source: https://docs.modelslab.com/enterprise-api/faceswap/specific-face-swap Specific Face Swap endpoint allows swapping faces in a single image. ## Request Make a `POST` request to below endpoint and pass the required parameters in the request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/faceswap/single_face_swap' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key":"enterprise_api_key", "init_image":"https://assets.modelslab.ai/generations/f139a3a7-1c64-4255-a53d-5b1c2a14b564", "target_image":"https://assets.modelslab.ai/generations/f139a3a7-1c64-4255-a53d-5b1c2a14b564", "reference_image":"https://assets.modelslab.ai/generations/f139a3a7-1c64-4255-a53d-5b1c2a14b564", "base64":false, "webhook": null, "track_id": null } ``` ## Body Attributes Your API Key used for request authorization. The first image containing the face to be swapped. (URL string) The second image containing the face to replace the face in the initial image. (URL string) The reference image of the particular face you want to swap from the init image. (URL string) Whether the generated result should have a watermark. Available options: `true`, `false` The image to use as a watermark. If not provided, a default watermark will be used. Parameter is only used if `watermark` is set to `true`. If provided `init_image` is in base64 format or if you want generated images as base64 string, set to true. Default: false. Provide a URL to receive a POST API call once the image generation is complete. This ID is included in the webhook API call to identify the request. # Specific Video Swap Source: https://docs.modelslab.com/enterprise-api/faceswap/specific-video-swap Specific Video Swap endpoint allows swapping specific faces according to reference face. ## Request Make a `POST` request to below endpoint and pass the required parameters in the request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/faceswap/specific_video_swap' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key", "init_video": "https://tawk.link/6332cd5154f06e12d8971855/vc/66d997a6a2bc5fe2b627a250/v/4239c555189b772d5ca1bd5aa4bf872c4c12a07e/sdfsdfsdf.mp4", "init_image" :"https://images-ext-1.discordapp.net/external/rJOvGZHIWsIijkfvCn5dByZNh_RfZZxUIiyyo7yOFIY/https/images.hindustantimes.com/rf/image_size_630x354/HT/p2/2017/12/27/Pictures/_1e5bc084-ead1-11e7-ad70-11504944e689.jpg?format=webp&width=984&height=553", "reference_image": "https://images-ext-1.discordapp.net/external/Z8sBOyxEy9tsqkd9gsNK2dHZh-Em6LDqrmyjcDeMXII/https/i.ibb.co/2PGZ3p7/lmao.png?format=webp&quality=lossless&width=412&height=662", "output_format": "mp4", "webhook": null, "track_id": null } ``` ## Body Attributes Your API Key used for request authorization. The image containing multiple faces to be swapped. (URL string) The video containing the face(s) to replace the faces in the image. (URL string) The reference image of the particular face you want to swap from the init image. (URL string) The output format of the video. Available options: `mp4` Whether the generated result should have a watermark. Available options: `true`, `false` The image to use as a watermark. If not provided, a default watermark will be used. Parameter is only used if `watermark` is set to `true`. Set a URL to receive a POST API call once the generation is complete. This ID is returned in the webhook API call to identify the request. # System Details Source: https://docs.modelslab.com/enterprise-api/faceswap/system-details POST /faceswap/system_details This endpoint returns information about your server. ## Request Send a `POST` request to below endpoint to get information about your server. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/faceswap/system_details' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Update Server Source: https://docs.modelslab.com/enterprise-api/faceswap/update-server POST /faceswap/update_server This endpoint is used to update your dedicated server. ## Request Send a `POST` request to below endpoint to update your dedicated server. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/faceswap/update_server' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Clear Cache Source: https://docs.modelslab.com/enterprise-api/flux-2-dev/clear-cache POST /flux/clear_cache This endpoint is used to clear the API's cache. ## Request Send a `POST` request to below endpoint to clear the API's cache. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/flux/clear_cache' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" "deploy_type": "flux_2_dev" } ``` # Clear Queue Source: https://docs.modelslab.com/enterprise-api/flux-2-dev/clear-queue POST /flux/clear_queue This endpoint is used to clear the API's queue. ## Request Send a `POST` request to below endpoint to clear the API's cache. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/flux/clear_queue' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key", "deploy_type": "flux_2_dev" } ``` ## Body Attributes Your enterprise API Key used for request authorization. This is the server type you are making request from. Use `flux_2_dev` for Flux 2 Dev servers. # Fetch Image Source: https://docs.modelslab.com/enterprise-api/flux-2-dev/fetch POST /flux/fetch Fetch Queued Images API fetches queued images for flux. ## Request Send a `POST` request to below endpoint to return the corresponding queued images. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/flux/fetch/{id}' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Image to Image Source: https://docs.modelslab.com/enterprise-api/flux-2-dev/img2img The Image2Image API generates an image from an image. Make sure you add your [s3 details](/enterprise-api/general/update-s3-details) for `flux` server, so you can receive image generated in your bucket. Images generated without s3 details being added will be delete after **24hours** ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body to the endpoint. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/flux/img2img' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key", "deploy_type": "flux_2_dev", "prompt": "a cat sitting on a bench", "negative_prompt": "bad quality", "init_image": [ "https://raw.githubusercontent.com/CompVis/stable-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo.png" ], "width": "512", "height": "512", "samples": "1", "temp": false, "safety_checker": false, "strength":0.7, "seed": null, "webhook": null, "track_id": null } ``` ## Body Attributes Your API Key used for request authorization. deployment type. Available deployment types `flux_2_dev` and `flux`. Text prompt with description of the things you want in the image to be generated. Items you don't want in the image. Link to the Initial Image. Max Height: Width: 1024x1024. Max Height: Width: 1024x1024. Number of images to be returned in response. The maximum value is 4. A checker for NSFW images. If such an image is detected, it will be replaced by a blank image. Get response as base64 string, default: false, options: true or false. Prompt strength when using init image. 1.0 corresponds to full destruction of information in the init image. Queue response instantly before processing finishes instead of waiting a minimum amount of time default: false, options: true or false. Seed is used to reproduce results, same seed will give you same image in return again. Pass null for a random number. Set an URL to get a POST API call once the image generation is complete. This ID is returned in the response to the webhook API call. This will be used to identify the webhook request. # Enterprise FLUX 2 Dev API Source: https://docs.modelslab.com/enterprise-api/flux-2-dev/overview Run FLUX 2 Dev models on dedicated enterprise GPU servers. Advanced text-to-image and image-to-image generation with full server control. Not on Enterprise yet? Get your enterprise plan at [ModelsLab](https://modelslab.com/enterprise) ## Available Endpoints This endpoint generates and returns an image from a text prompt using the Flux model. This endpoint generates and returns an image from an input image using the Flux model. This endpoint fetches already generated or queued images by ID. This endpoint clears the server cache. This endpoint clears the server queue. This endpoint restarts the server. This endpoint retrieves system and server details. This endpoint updates the server to the latest version. # Restart Server Source: https://docs.modelslab.com/enterprise-api/flux-2-dev/restart-server POST /flux/restart_server This endpoint is used to restart your dedicated server. ## Request Send a `POST` request to below endpoint to restart your dedicated server. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/flux/restart_server' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" "deploy_type": "flux_2_dev" } ``` # System Details Source: https://docs.modelslab.com/enterprise-api/flux-2-dev/system-details POST /flux/system_details This endpoint returns information about your server. ## Request Send a `POST` request to below endpoint to get information about your server. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/flux/system_details' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" "deploy_type": "flux_2_dev" } ``` # Text to Image Source: https://docs.modelslab.com/enterprise-api/flux-2-dev/text2img This endpoint generates an image from a text prompt using flux model. Make sure you add your [s3 details](/enterprise-api/general/update-s3-details.mdx) for `flux` server, so you can receive image generated in your bucket. Images generated without s3 details being added will be delete after **24hours** ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/flux/text2img' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key" : "enterprise_api_key", "deploy_type": "flux_2_dev", "prompt": "ultra realistic close up portrait ((beautiful pale cyberpunk female with heavy black eyeliner))", "negative_prompt": "bad quality", "width": "512", "height": "512", "safety_checker": false, "seed": null, "samples":1, "base64":false, "webhook": null, "track_id": null } ``` ## Body Attributes Your API Key used for request authorization. deployment type. Available deployment types `flux_2_dev` and `flux`. Text prompt with description of the things you want in the image to be generated. Items you don't want in the image. Max Height: Width: 1024x1024. Max Height: Width: 1024x1024. Number of images to be returned in response. The maximum value is 4. A checker for NSFW images. If such an image is detected, it will be replaced by a blank image. Seed is used to reproduce results. Same seed will give you the same image again. Pass null for a random number. Queue response instantly before processing finishes instead of waiting a minimum amount of time. default: false, options: true or false. Get response as base64 string. default: false, options: true or false. Set a URL to get a POST API call once the image generation is complete. This ID is returned in the response to the webhook API call. This will be used to identify the webhook request. # Update Server Source: https://docs.modelslab.com/enterprise-api/flux-2-dev/update-server POST /flux/update_server This endpoint is used to update your dedicated server. ## Request Send a `POST` request to below endpoint to update your dedicated server. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/realtime/update_server' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" "deploy_type": "flux_2_dev" } ``` # Clear Cache Source: https://docs.modelslab.com/enterprise-api/flux-headshot/clear-cache POST /flux_headshot/clear_cache This endpoint is used to clear the API's cache. ## Request Send a `POST` request to below endpoint to clear the API's cache. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/flux_headshot/clear_cache' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Clear Queue Source: https://docs.modelslab.com/enterprise-api/flux-headshot/clear-queue POST /flux_headshot/clear_queue This endpoint is used to clear the API's queue. ## Request Send a `POST` request to below endpoint to clear the API's cache. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/flux_headshot/clear_queue' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Fetch Image Source: https://docs.modelslab.com/enterprise-api/flux-headshot/fetch POST /flux_headshot/fetch/{id} Fetch Queued response. ## Request Send a `POST` request to below endpoint to return the corresponding queued images. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/flux_headshot/fetch/{id}' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Flux Head Shot Source: https://docs.modelslab.com/enterprise-api/flux-headshot/make-gen This endpoint allows you to generate head shot with flux capabilities. Face gen endpoint result Make sure you add your [s3 details](/enterprise-api/general/update-s3-details) for `flux_headshot` server, so you can receive image generated in your bucket. Images generated without s3 details being added will be delete after **24hours** ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body to the endpoint. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/flux_headshot/make_gen' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key", "prompt": "pretty woman", "negative_prompt": "anime, cartoon, drawing, big nose, long nose, fat, ugly, big lips, big mouth, face proportion mismatch, unrealistic, monochrome, lowres, bad anatomy, worst quality, low quality, blurry", "face_image":"https://assets.modelslab.ai/generations/dadf8fb5-ee78-4038-b0d7-3dde65547217", "width": "1024", "height": "1024", "num_inference_steps": "21", "seed":null, "guidance_scale": 7.5, "webhook": null, "track_id": null } ``` ## Body Attributes Required. Your API Key used for request authorization. Required. Text prompt with description of the things you want in the image to be generated. Required. Link or valid base64 string image. This is the face you want your generations to resemble. Width of your generated image. Max dimension: 2048 × 2048. Height of your generated image. Max dimension: 2048 × 2048. Number of denoising steps. Maximum accepted steps: 26. Scale for classifier-free guidance. Accepted range: 1.0 – 10.0. Required. Seed is used to reproduce results, same seed will give you the same image again. If provided `init_image` is in base64 format or if you want generated images as base64 string, set to true. Default: false. Set a URL to get a POST API call once the image generation is complete. This ID is returned in the response to the webhook API call. This will be used to identify the webhook request. # Enterprise FLUX Headshot API Source: https://docs.modelslab.com/enterprise-api/flux-headshot/overview Generate AI headshots on dedicated enterprise servers using FLUX. Professional portrait generation with private GPU infrastructure. ### Endpoints This endpoint allows you to generate image with the face image provided This endpoint clears the server cache. This endpoint clears the server queue. This endpoint restarts the server. This endpoint checks for server details. This endpoint updates the server to the latest version. This endpoint fetches queued or processing requests. # Restart Server Source: https://docs.modelslab.com/enterprise-api/flux-headshot/restart-server POST /flux_headshot/restart_server This endpoint is used to restart your dedicated server. ## Request Send a `POST` request to below endpoint to restart your dedicated server. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/flux_headshot/restart_server'' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # System Details Source: https://docs.modelslab.com/enterprise-api/flux-headshot/system-details POST /flux_headshot/system_details This endpoint returns information about your server. ## Request Send a `POST` request to below endpoint to get information about your server. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/flux_headshot/system_details' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Update Server Source: https://docs.modelslab.com/enterprise-api/flux-headshot/update-server POST /flux_headshot/update_server This endpoint is used to update your dedicated server. ## Request Send a `POST` request to below endpoint to update your dedicated server. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/flux_headshot/update_server' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Clear Cache Source: https://docs.modelslab.com/enterprise-api/flux-klein/clear-cache POST /flux_klein/clear_cache This endpoint is used to clear the API's cache. ## Request Send a `POST` request to below endpoint to clear the API's cache. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/flux_klein/clear_cache' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Clear Queue Source: https://docs.modelslab.com/enterprise-api/flux-klein/clear-queue POST /flux_klein/clear_queue This endpoint is used to clear the API's queue. ## Request Send a `POST` request to below endpoint to clear the API's queue. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/flux_klein/clear_queue' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Fetch Image Source: https://docs.modelslab.com/enterprise-api/flux-klein/fetch POST /flux_klein/fetch Fetch Queued Images API fetches queued images for Flux Klein. ## Request Send a `POST` request to below endpoint to return the corresponding queued images. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/flux_klein/fetch/{id}' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Image to Image Source: https://docs.modelslab.com/enterprise-api/flux-klein/img2img The Image2Image API generates an image from an image using Flux Klein model. Make sure you add your [s3 details](/enterprise-api/general/update-s3-details) for `flux_klein` server, so you can receive image generated in your bucket. Images generated without s3 details being added will be delete after **24hours** ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body to the endpoint. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/flux_klein/img2img' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key", "prompt": "a cat sitting on a bench", "negative_prompt": "bad quality", "init_image": [ "https://raw.githubusercontent.com/CompVis/stable-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo.png" ], "width": "512", "height": "512", "samples": "1", "temp": false, "safety_checker": false, "strength":0.7, "seed": null, "webhook": null, "track_id": null } ``` ## Body Attributes Your API Key used for request authorization. Text prompt with description of the things you want in the image to be generated. Items you don't want in the image. Array of up to 4 initial image URLs to use as reference. A single image URL string is also accepted. Max Height: Width: 1024x1024. Max Height: Width: 1024x1024. Number of images to be returned in response. The maximum value is 4. A checker for NSFW images. If such an image is detected, it will be replaced by a blank image. Get response as base64 string, default: false, options: true or false. Prompt strength when using init image. 1.0 corresponds to full destruction of information in the init image. Queue response instantly before processing finishes instead of waiting a minimum amount of time default: false, options: true or false. Seed is used to reproduce results, same seed will give you same image in return again. Pass null for a random number. Set an URL to get a POST API call once the image generation is complete. This ID is returned in the response to the webhook API call. This will be used to identify the webhook request. # Enterprise FLUX Klein API Source: https://docs.modelslab.com/enterprise-api/flux-klein/overview Run FLUX Klein models on dedicated enterprise GPU servers. Advanced text-to-image and image-to-image generation with full server control. Not on Enterprise yet? Get your enterprise plan at [ModelsLab](https://modelslab.com/enterprise) ## Available Endpoints This endpoint generates and returns an image from a text prompt using the Flux Klein model. This endpoint generates and returns an image from an input image using the Flux Klein model. This endpoint fetches already generated or queued images by ID. This endpoint clears the server cache. This endpoint clears the server queue. This endpoint restarts the server. This endpoint retrieves system and server details. This endpoint updates the server to the latest version. # Restart Server Source: https://docs.modelslab.com/enterprise-api/flux-klein/restart-server POST /flux_klein/restart_server This endpoint is used to restart your dedicated server. ## Request Send a `POST` request to below endpoint to restart your dedicated server. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/flux_klein/restart_server' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # System Details Source: https://docs.modelslab.com/enterprise-api/flux-klein/system-details POST /flux_klein/system_details This endpoint returns information about your server. ## Request Send a `POST` request to below endpoint to get information about your server. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/flux_klein/system_details' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Text to Image Source: https://docs.modelslab.com/enterprise-api/flux-klein/text2img This endpoint generates an image from a text prompt using Flux Klein model. Make sure you add your [s3 details](/enterprise-api/general/update-s3-details.mdx) for `flux_klein` server, so you can receive image generated in your bucket. Images generated without s3 details being added will be delete after **24hours** ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/flux_klein/text2img' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key" : "enterprise_api_key", "prompt": "ultra realistic close up portrait ((beautiful pale cyberpunk female with heavy black eyeliner))", "negative_prompt": "bad quality", "width": "512", "height": "512", "safety_checker": false, "seed": null, "samples":1, "base64":false, "webhook": null, "track_id": null } ``` ## Body Attributes Your API Key used for request authorization. Text prompt with description of the things you want in the image to be generated. Items you don't want in the image. Max Height: Width: 1024x1024. Max Height: Width: 1024x1024. Number of images to be returned in response. The maximum value is 4. A checker for NSFW images. If such an image is detected, it will be replaced by a blank image. Seed is used to reproduce results. Same seed will give you the same image again. Pass null for a random number. Queue response instantly before processing finishes instead of waiting a minimum amount of time. default: false, options: true or false. Get response as base64 string. default: false, options: true or false. Set a URL to get a POST API call once the image generation is complete. This ID is returned in the response to the webhook API call. This will be used to identify the webhook request. # Update Server Source: https://docs.modelslab.com/enterprise-api/flux-klein/update-server POST /flux_klein/update_server This endpoint is used to update your dedicated server. ## Request Send a `POST` request to below endpoint to update your dedicated server. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/flux_klein/update_server' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Clear Cache Source: https://docs.modelslab.com/enterprise-api/flux-kontext-dev/clear-cache POST /enterprise/flux_kontext_dev/clear_cache This endpoint is used to clear the API's cache. ## Request Send a `POST` request to below endpoint to clear the API's cache. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/flux_kontext_dev/clear_cache' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Clear Queue Source: https://docs.modelslab.com/enterprise-api/flux-kontext-dev/clear-queue POST /enterprise/flux_kontext_dev/clear_queue This endpoint is used to clear the API's queue. ## Request Send a `POST` request to below endpoint to clear the API's cache. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/flux_kontext_dev/clear_queue' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Fetch Image Source: https://docs.modelslab.com/enterprise-api/flux-kontext-dev/fetch-image POST /enterprise/flux_kontext_dev/fetch/{id} This endpoint is used to fetch a queued image. ## Request Send a `POST` request to below endpoint to return the corresponding queued Images. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/flux_kontext_dev/fetch/{id}' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Image to Image Source: https://docs.modelslab.com/enterprise-api/flux-kontext-dev/image-to-image The Endpoint generates an image from an image. Make sure you add your [s3 details](/enterprise-api/general/update-s3-details) for `flux` server, so you can receive image generated in your bucket. Images generated without s3 details being added will be delete after 24hours ## Request Make a POST request to below endpoint and pass the required parameters as a request body to the endpoint. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/flux_kontext_dev/img2img' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key", "prompt": "The girl from image one holding the can from image two.", "negative_prompt": "bad quality", "init_image": "https://assets.modelslab.ai/generations/4a89e381-cdd0-46fc-b13e-00d8824d8171", "init_image_2":"https://assets.modelslab.ai/generations/85b9944d-74c5-46b2-9be5-ec7a5e212789", "width": "512", "height": "512", "samples": "1", "temp": false, "safety_checker": false, "strength":0.7, "seed": null, "webhook": null, "track_id": null } ``` ## Body Attributes Your API Key used for request authorization. Text prompt with description of the things you want in the image to be generated. Items you don't want in the image. Upload the reference image you want to edit. Second image is optional. only upload second image when you want to merge 2 image. Max Width: 1024px Max Height: 1024px Number of images to be returned in response. The maximum value is 4. A checker for NSFW images. If such an image is detected, it will be replaced by a blank image. Get response as base64 string, default: false, options: true or false. Prompt strength when using init image. 1.0 corresponds to full destruction of information in the init image. Queue response instantly before processing finishes instead of waiting a minimum amount of time default: false, options: true or false. Seed is used to reproduce results, same seed will give you same image in return again. Pass null for a random number. Set an URL to get a POST API call once the image generation is complete. This ID is returned in the response to the webhook API call. This will be used to identify the webhook request. # Enterprise FLUX Kontext Dev API Source: https://docs.modelslab.com/enterprise-api/flux-kontext-dev/overview Run FLUX Kontext Dev image-to-image generation on dedicated enterprise servers. Context-aware image editing with private GPU infrastructure. ## Available Endpoints Generate a video from a text prompt using trained or public models Retrieve queued or processing image generation requests Clear the API’s server cache for fresh processing Clear the API’s server cache for fresh processing Restart your dedicated image generation server Get information about your server status and performance Update your dedicated server to the latest version # Restart Server Source: https://docs.modelslab.com/enterprise-api/flux-kontext-dev/restart-server POST /enterprise/flux_kontext_dev/restart_server This endpoint is used to restart your dedicated server. ## Request Send a `POST` request to below endpoint to restart your dedicated server. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/flux_kontext_dev/restart_server' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # System Details Source: https://docs.modelslab.com/enterprise-api/flux-kontext-dev/system-details POST /enterprise/flux_kontext_dev/system_details This endpoint is used to get information about your server. ## Request Send a `POST` request to below endpoint to get information about your server. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/flux_kontext_dev/system_details' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Update Server Source: https://docs.modelslab.com/enterprise-api/flux-kontext-dev/update-server POST /enterprise/flux_kontext_dev/update_server This endpoint is used to update your dedicated server. ## Request Send a `POST` request to below endpoint to update your dedicated server. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/flux_kontext_dev/update_server' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Clear Cache Source: https://docs.modelslab.com/enterprise-api/flux/clear-cache POST /flux/clear_cache This endpoint is used to clear the API's cache. ## Request Send a `POST` request to below endpoint to clear the API's cache. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/flux/clear_cache' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Clear Queue Source: https://docs.modelslab.com/enterprise-api/flux/clear-queue POST /flux/clear_queue This endpoint is used to clear the API's queue. ## Request Send a `POST` request to below endpoint to clear the API's cache. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/flux/clear_queue' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Fetch Image Source: https://docs.modelslab.com/enterprise-api/flux/fetch POST /flux/fetch Fetch Queued Images API fetches queued images for flux. ## Request Send a `POST` request to below endpoint to return the corresponding queued images. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/flux/fetch/{id}' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Image to Image Source: https://docs.modelslab.com/enterprise-api/flux/img2img The Image2Image API generates an image from an image. Make sure you add your [s3 details](/enterprise-api/general/update-s3-details) for `flux` server, so you can receive image generated in your bucket. Images generated without s3 details being added will be delete after **24hours** ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body to the endpoint. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/flux/img2img' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key", "prompt": "a cat sitting on a bench", "negative_prompt": "bad quality", "init_image": "https://raw.githubusercontent.com/CompVis/stable-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo.png", "width": "512", "height": "512", "samples": "1", "temp": false, "safety_checker": false, "strength":0.7, "seed": null, "webhook": null, "track_id": null } ``` ## Body Attributes Your API Key used for request authorization. Text prompt with description of the things you want in the image to be generated. Items you don't want in the image. Link to the Initial Image. Max Height: Width: 1024x1024. Max Height: Width: 1024x1024. Number of images to be returned in response. The maximum value is 4. A checker for NSFW images. If such an image is detected, it will be replaced by a blank image. Get response as base64 string, default: false, options: true or false. Prompt strength when using init image. 1.0 corresponds to full destruction of information in the init image. Queue response instantly before processing finishes instead of waiting a minimum amount of time default: false, options: true or false. Seed is used to reproduce results, same seed will give you same image in return again. Pass null for a random number. Set an URL to get a POST API call once the image generation is complete. This ID is returned in the response to the webhook API call. This will be used to identify the webhook request. # Enterprise FLUX API Source: https://docs.modelslab.com/enterprise-api/flux/overview Run FLUX image generation on dedicated enterprise servers. Text-to-image and image-to-image with private GPU infrastructure. Not on Enterprise yet? Get your enterprise plan at [ModelsLab](https://modelslab.com/enterprise) ## Available Endpoints This endpoint generates and returns an image from a text prompt using the Flux model. This endpoint generates and returns an image from an input image using the Flux model. This endpoint fetches already generated or queued images by ID. This endpoint clears the server cache. This endpoint clears the server queue. This endpoint restarts the server. This endpoint retrieves system and server details. This endpoint updates the server to the latest version. # Restart Server Source: https://docs.modelslab.com/enterprise-api/flux/restart-server POST /flux/restart_server This endpoint is used to restart your dedicated server. ## Request Send a `POST` request to below endpoint to restart your dedicated server. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/flux/restart_server' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # System Details Source: https://docs.modelslab.com/enterprise-api/flux/system-details POST /flux/system_details This endpoint returns information about your server. ## Request Send a `POST` request to below endpoint to get information about your server. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/flux/system_details' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Text to Image Source: https://docs.modelslab.com/enterprise-api/flux/text2img This endpoint generates an image from a text prompt using flux model. Make sure you add your [s3 details](/enterprise-api/general/update-s3-details.mdx) for `flux` server, so you can receive image generated in your bucket. Images generated without s3 details being added will be delete after **24hours** ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/flux/text2img' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key" : "enterprise_api_key", "prompt": "ultra realistic close up portrait ((beautiful pale cyberpunk female with heavy black eyeliner))", "negative_prompt": "bad quality", "width": "512", "height": "512", "safety_checker": false, "seed": null, "samples":1, "base64":false, "webhook": null, "track_id": null } ``` ## Body Attributes Your API Key used for request authorization. Text prompt with description of the things you want in the image to be generated. Items you don't want in the image. Max Height: Width: 1024x1024. Max Height: Width: 1024x1024. Number of images to be returned in response. The maximum value is 4. A checker for NSFW images. If such an image is detected, it will be replaced by a blank image. Seed is used to reproduce results. Same seed will give you the same image again. Pass null for a random number. Queue response instantly before processing finishes instead of waiting a minimum amount of time. default: false, options: true or false. Get response as base64 string. default: false, options: true or false. Set a URL to get a POST API call once the image generation is complete. This ID is returned in the response to the webhook API call. This will be used to identify the webhook request. # Update Server Source: https://docs.modelslab.com/enterprise-api/flux/update-server POST /flux/update_server This endpoint is used to update your dedicated server. ## Request Send a `POST` request to below endpoint to update your dedicated server. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/realtime/update_server' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Enterprise General Settings Source: https://docs.modelslab.com/enterprise-api/general/overview Manage enterprise server S3 storage settings. Configure and reset S3 details for your dedicated ModelsLab enterprise infrastructure. ### Endpoints This endpoint is used to update the S3 details on your dedicated server. This endpoint is used to reset/clear the S3 details on your dedicated server. This endpoint is used to get all your enterprise subscriptions. # Reset S3 Details Source: https://docs.modelslab.com/enterprise-api/general/reset-s3 This endpoint is used to reset the S3 details on your dedicated server. ## Request Send a POST request to below endpoint. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/reset_s3' \ ``` ### Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key", "deploy_type": "text_to_image" } ``` ## Body Attributes Your enterprise API Key used for request authorization. This is the server type you are making request from. It includes `text_to_image`, `image_editing`, `voice_cloning`, `text_to_3d`, `video`, `face_gen`, `deepfake`, `realtime`, `super_resolution`, `flux`, `flux_headshot` and `interior`. If nothing is passed `text_to_image` will be the default. # Subscription List Source: https://docs.modelslab.com/enterprise-api/general/subscription-list This endpoint is used to get all your enterprise subscriptions. ## Request Send a `POST` request to the below endpoint to retrieve all subscriptions associated with your enterprise account. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/subscriptions' \ ``` ### Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` ## Body Attributes Your enterprise API Key used for request authorization. ## Response ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "status": "success", "subscriptions": [ { "plan": "premium", "name": "Enterprise Premium", "created_at": "2026-06-01 10:22:04", "next_billing_date": "2026-07-01", "server": { "name": "swift-falcon", "status": "live" } } ] } ``` ## Response Attributes The status of the request. Returns `success` when the subscriptions are retrieved successfully. A list of your enterprise subscriptions. Each item contains the following fields: The plan identifier of the subscription (e.g. `premium`). The display name of the subscription plan. The date and time the subscription was created. The date of the next billing cycle for the subscription. Details of the server associated with the subscription. The name of the server. The current status of the server (e.g. `live`). # Update S3 Details Source: https://docs.modelslab.com/enterprise-api/general/update-s3-details This endpoint is used to update the S3 details on your dedicated server. **You can use any S3 compatible service like Cloudflare R2, Digital Ocean Spaces, AWS S3, Google Cloud Storage, Alibaba OSS, Backblaze, etc.** You need to give PutObjectAcl on S3 bucket. Else you won't be able to upload images to S3 bucket. Here is link to stackoverflow on how to do it: `https://stackoverflow.com/questions/36272286/getting-access-denied-when-calling-the-putobject-operation-with-bucket-level-per` ## Request Send a `POST` request to below endpoint. You have to pass the below listed request body parameters to update the S3 details. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/update_s3' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key", "deploy_type": "text_to_image", "public_url": "https://cdn2.stablediffusionapi.com/generations/", "region_name": "us-east-1", "endpoint_url": "https://stable-diffusion-api.s3.amazonaws.com", "aws_access_key_id": "access-key", "aws_secret_access_key": "secret-key", "image_directory": "generations" } ``` ## Google Cloud Example ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key", "deploy_type": "text_to_image", "public_url": "https://cdn2.stablediffusionapi.com/generations/", "region_name": "US-CENTRAL1", "endpoint_url": "https://storage.googleapis.com", "aws_access_key_id": "access-key", "aws_secret_access_key": "secret-key", "image_directory": "generations" } ``` ## Body Attributes Your enterprise API Key of the particular server deploy type you want to add S3 details for. This is the server type you want to add the S3 details for. Options: `text_to_image`, `image_editing`, `voice_cloning`, `text_to_3d`, `video`, `face_gen`, `deepfake`, `realtime`, `super_resolution`, `flux`, `flux_headshot`, `interior`, `qwen`, `qwen_tts`, `flux_kontext_dev`, `image_to_video_ultra`, `z_image_turbo`. Default: `text_to_image`. A public URL on which images can be accessed. Ensure your bucket is publicly accessible. S3 region name. S3 endpoint URL. S3 bucket access key. S3 bucket secret key. Directory inside the S3 bucket to store images (e.g., `generations`). Ensure it is publicly accessible to access images via direct links. # Clear Cache Source: https://docs.modelslab.com/enterprise-api/image-editing/clear-cache POST /enterprise/image_editing/clear_cache This endpoint is used to clear the API's cache. ## Request Send a `POST` request to below endpoint to clear the API's cache. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/image_editing/clear_cache' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Clear Queue Source: https://docs.modelslab.com/enterprise-api/image-editing/clear-queue POST /enterprise/image_editing/clear_queue This endpoint is used to clear the API's queue. ## Request Send a `POST` request to below endpoint to clear the API's queue. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/image_editing/clear_queue' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Face Generator Source: https://docs.modelslab.com/enterprise-api/image-editing/face-gen This endpoint allows you to generate image with the face image provided. Face gen endpoint result Make sure you add your [s3 details](/enterprise-api/general/update-s3-details) for `image_editing` server, so you can receive image generated in your bucket. Images generated without s3 details being added will be delete after **24hours** ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body to the endpoint. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/image_editing/face_gen' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key", "prompt": "pretty woman", "negative_prompt": "anime, cartoon, drawing, big nose, long nose, fat, ugly, big lips, big mouth, face proportion mismatch, unrealistic, monochrome, lowres, bad anatomy, worst quality, low quality, blurry", "face_image":"https://media.allure.com/photos/647f876463cd1ef47aab9c88/3:2/w_2465,h_1643,c_limit/angelina%20jolie%20blonde%20hair%20chloe.jpg", "width": "512", "height": "512", "samples": "1", "num_inference_steps": "21", "safety_checker": false, "base64": false, "seed": null, "guidance_scale": 7.5, "webhook": null, "track_id": null } ``` ## Body Attributes Your API Key used for request authorization Text prompt with description of the things you want in the image to be generated. Link or valid base64 data which follows `data:image/jpeg;base64,{your_base64_string}` to the image of the face you want your generations to resemble. Width of your generated image. Max dimension: 512 x 768 Height of your generated image. Max dimension: 512 x 768 Number of denoising steps. Value accepted are 21, 31, or 41 Scale for classifier-free guidance. This is required to generate output image in particular style. Default value is `realistic`. Options: `comic`, `chibi`, `3d`, `anime`, `realistic` Adjust the weight of the face structure \[float] \[0.0 to 2.0] \[default 1.0]. The number of images to be returned in response. The maximum value is 2. **Note:** For resolutions such as 512x768, one sample will be generated. Whether to run the safety checker to prevent NSFW image generation. One of `true` or `false`. Must be one of `black`, `blur`, `sensitive_content_text`, `pixelate` If provided face\_image is in base64 format or if you want your generated images as a base64 string, must be set to `true`. Default: `false`. Set an URL to get a POST API call once the image generation is complete. This ID is returned in the response to the webhook API call. This will be used to identify the webhook request. # Fashion Source: https://docs.modelslab.com/enterprise-api/image-editing/fashion This endpoint allows you to wear a cloth image sample on an existing model body. Fashion endpoint result Make sure you add your [s3 details](/enterprise-api/general/update-s3-details) for `image_editing` server, so you can receive image generated in your bucket. Images generated without s3 details being added will be delete after **24hours** ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body to the endpoint. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/image_editing/fashion' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key", "prompt": ":A realistic photo of a model wearing a beautiful t-shirt", "negative_prompt": "Low quality, unrealistic, bad cloth, warped cloth", "init_image": "https://assets.modelslab.ai/generations/3227c6c5-14f6-4755-8be5-4f96c0fe988c.jpg", "cloth_image": "https://assets.modelslab.ai/generations/e202dba8-d3da-4bf6-9849-dc0535563e57.jpg", "cloth_type": "upper_body", "guidance_scale": 7.5, "num_inference_steps": 21, "seed": null, "webhook": null, "track_id": null } ``` ## Body Attributes Your API Key used for request authorization Image URL of the model to try the dress on Cloth/Dress URL for the garment to try-on One of `upper_body`, `lower_body` or `dresses` based on where the garment is to be worn Text prompt with description of the things you want in the image to be generated Items you don't want in the image Number of denoising steps. Value accepted are 21, 31 or 41 Scale for classifier-free guidance (minimum: 1; maximum: 20) Random seed for reproducible results Set an URL to get a POST API call once the image generation is complete This ID is returned in the response to the webhook API call. This will be used to identify the webhook request # Fetch Image Source: https://docs.modelslab.com/enterprise-api/image-editing/fetchimage POST /enterprise/image_editing/fetch/{id} This endpoint is used to fetch an image. ## Request Send a `POST` request to below endpoint to fetch an image. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/image_editing/fetch/{id}' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Head Shot Source: https://docs.modelslab.com/enterprise-api/image-editing/head-shot This endpoint allows you to generate professional headshots from a face image. Head Shot endpoint result Make sure you add your [s3 details](/enterprise-api/general/update-s3-details) for `image_editing` server, so you can receive image generated in your bucket. Images generated without s3 details being added will be delete after **24hours** ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body to the endpoint. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/image_editing/head_shot' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key", "face_image": "https://example.com/face-image.jpg", "prompt": "professional headshot, business attire, studio lighting", "negative_prompt": "blurry, low quality, distorted", "num_inference_steps": "21", "guidance_scale": 7.5, "seed": null, "webhook": null, "track_id": null } ``` ## Body Attributes Your API Key used for request authorization Link or valid base64 data of the face image for headshot generation Text prompt describing the desired headshot style and appearance Items you don't want in the generated headshot Number of denoising steps. Value accepted are 21, 31, or 41 Scale for classifier-free guidance Random seed for reproducible results Set an URL to get a POST API call once the image generation is complete This ID is returned in the response to the webhook API call. This will be used to identify the webhook request # Magic Mix Source: https://docs.modelslab.com/enterprise-api/image-editing/magic-mix This endpoint allows you to magic mix image and prompt to produce an catching images. Magic-Mix endpoint result Make sure you add your [s3 details](/enterprise-api/general/update-s3-details) for `image_editing` server, so you can receive image generated in your bucket. Images generated without s3 details being added will be delete after **24hours** ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body to the endpoint. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/image_editing/magic_mix' \ ``` ## Body Attributes Your API Key used for request authorization Text prompt with description of the things you want in the image to be generated Items you don't want in the image URL of the image you want magic mix Max Width. Default: `768` Max Height. Default: `768` Optional. Minimum k value. Default: `0.3` Optional. Maximum k value. Default: `0.5` Optional. Mix factor for the task. Default: `0.5` Number of denoising steps (minimum: 1; maximum: 50). Default: `20` Number of images to be returned in response. The maximum value is 1. Seed is used to reproduce results. Same seed will give you same image again. Pass `null` for random seed. Set an URL to get a POST API call once the image generation is complete. This ID is returned in the response to the webhook API call. This will be used to identify the webhook request. ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key":"", "prompt":"Bed", "height":768, "width":768, "image":"https://user-images.githubusercontent.com/59410571/209578593-141467c7-d831-4792-8b9a-b17dc5e47816.jpg", "kmax":0.5, "kmin":0.3, "mix_factor":0.5, "samples":1, "negative_prompt":"low quality", "seed":1829183163, "steps":20, "webhook": null, "track_id": null } ``` # Mask Creator Source: https://docs.modelslab.com/enterprise-api/image-editing/mask_creator This endpoint helps to mask an object on a given image. ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body to the endpoint. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/image_editing/mask_creator' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key", "init_image": "https://i.ibb.co/kMRK2mg/image2.jpg", "specific_object": "the ball", "track_id":null, "webhook":null } ``` ## Body Attributes Your API Key used for request authorization Link to the actual image `true` or `false` Set an URL to get a POST API call once the image generation is complete. This ID is returned in the response to the webhook API call. This will be used to identify the webhook request. # Object Removal Source: https://docs.modelslab.com/enterprise-api/image-editing/object-removal This endpoint helps to remove object from an existing image. ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body to the endpoint. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/image_editing/object_removal' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key", "init_image": "https://i.ibb.co/kMRK2mg/image2.jpg", "mask_image": "https://i.ibb.co/tH0Z8HY/mask2.jpg", "track_id":null, "webhook":null } ``` ## Body Attributes Your API Key used for request authorization Link to the actual image Link to the mask area you want to remove Set an URL to get a POST API call once the image generation is complete. This ID is returned in the response to the webhook API call. This will be used to identify the webhook request. # Outpainting Source: https://docs.modelslab.com/enterprise-api/image-editing/outpainting This endpoint helps to outpaint by expanding the giving image. Outpainting endpoint result Make sure you add your [s3 details](/enterprise-api/general/update-s3-details) for `image_editing` server, so you can receive image generated in your bucket. Images generated without s3 details being added will be delete after **24hours** ## Request\[​ Make a `POST` request to below endpoint and pass the required parameters as a request body to the endpoint. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/image_editing/outpaint' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key", "seed": 12345, "width": 512, "height": 512, "prompt": "a majestic cat house, lush greenery, filled with plants, high quality, cartoonish, realistic, 4k", "image": "https://i.ibb.co/wp0w7nt/1-d212fe65-f95c-4bbe-b275-99f0dedd901a.png", "negative_prompt": "dull background, text, characters, symbols, unrealistic, repetitive background, boring background, bad, low quality, black background", "overlap_width": 32, "num_inference_steps": 15, "guidance_scale": 8.0, "temp": true, "base64": false, "webhook": null, "track_id": null } ``` ## Body Attributes Your API Key used for request authorization The text prompt to guide image generation. Aspects to avoid in the generated image. URL of the initial image to outpaint Width of the output image. Max: 1440 Height of the output image. Max: 1440 Width of the mask overlap area. Max: 42 Number of denoising steps. Max: 30 How closely to follow the prompt Seed for reproducible results (-1 or 0 for random) Whether to save output temporarily Whether the `image` is base64 encoded Set a URL to get a POST API call once the image generation is complete This ID is returned in the response to the webhook API call. This will be used to identify the webhook request # Enterprise Image Editing API Source: https://docs.modelslab.com/enterprise-api/image-editing/overview Enterprise AI image editing on dedicated GPU servers. Face gen, fashion, headshots, object removal, inpainting, and outpainting. ### Endpoints Remove backgrounds and create masks for image editing Generate images with provided face references Generate professional headshot images Create custom masks for image editing workflows Try on clothing items on existing model bodies Generate eye-catching image blends with text prompts Remove unwanted objects from images Extend images beyond their original boundaries with AI-powered outpainting Fetch queued image generation results Clear the server cache Clear the server queue Restart your dedicated server Get information about your server Update your dedicated server # Background Removal & Create mask Source: https://docs.modelslab.com/enterprise-api/image-editing/removebg-createmask This endpoint removes background from image and create mask. removebg-createmask endpoint result Make sure you add your [s3 details](/enterprise-api/general/update-s3-details) for `image_editing` server, so you can receive image generated in your bucket. Images generated without s3 details being added will be delete after **24hours** ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body to the endpoint. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/image_editing/removebg_mask' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key":"", "seed":12345, "image":"https://huggingface.co/datasets/diffusers/test-arrays/resolve/main/stable_diffusion_inpaint/boy.png", "post_process_mask": false, "only_mask": false, "alpha_matting":false, "webhook": null, "track_id": null } ``` ## Body Attributes Your API Key used for request authorization URL of the image you want to remove and create its mask Whether to perform alpha matting. Accepts `true` or `false` To post process the mask image. Accepts `true` or `false` Whether to return only mask image or not. Accepts `true` or `false` Seed is used to reproduce results. Same seed will give same image. Pass `null` for a random number Threshold for alpha matting foreground Threshold for alpha matting background Erode size for alpha matting Set a URL to get a POST API call once the image generation is complete This ID is returned in the response to the webhook API call. This will be used to identify the webhook request # Restart Server Source: https://docs.modelslab.com/enterprise-api/image-editing/restart-server POST /enterprise/image_editing/restart_server This endpoint is used to restart your dedicated server. ## Request Send a `POST` request to below endpoint to restart your dedicated server. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/image_editing/restart_server' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # System Details Source: https://docs.modelslab.com/enterprise-api/image-editing/system-details POST /enterprise/image_editing/system_details This endpoint returns information about your server. ## Request Send a `POST` request to below endpoint to get system details. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/image_editing/system_details' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Update Server Source: https://docs.modelslab.com/enterprise-api/image-editing/update-server POST /enterprise/image_editing/update_server This endpoint is used to update your dedicated server. ## Request Send a `POST` request to below endpoint to update your dedicated server. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/image_editing/update_server' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Clear Cache Source: https://docs.modelslab.com/enterprise-api/image-to-video-ultra/clear-cache POST /image_to_video_ultra/clear_cache This endpoint is used to clear the API's cache. ## Request Send a `POST` request to below endpoint to clear the API's cache. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/image_to_video_ultra/clear_cache' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Clear Queue Source: https://docs.modelslab.com/enterprise-api/image-to-video-ultra/clear-queue POST /image_to_video_ultra/clear_queue This endpoint is used to clear the API's queue. ## Request Send a `POST` request to below endpoint to clear the API's cache. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/image_to_video_ultra/clear_queue' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Fetch Video Source: https://docs.modelslab.com/enterprise-api/image-to-video-ultra/fetchvideo POST /image_to_video_ultra/fetch/{id} Fetch Queued Video API fetches queued video. ## Request Send a `POST` request to below endpoint to return the corresponding queued videos. Where `{id}` is the ID returned together with the image URL in the response upon its generation. This endpoint does not generate new video, it returns already generated/queued videos. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/image_to_video_ultra/fetch/{id}' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "" } ``` # Image to Video Ultra Source: https://docs.modelslab.com/enterprise-api/image-to-video-ultra/imagetovideo Generate high-definition videos from images using the Image to Video Ultra API. ## Request Make a `POST` request to below endpoint and pass the required parameters in the request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/image_to_video_ultra/img2video' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key":"", "init_image":"https://assets.modelslab.ai/generations/91c519f4-20fe-4834-ac47-fe5c39c44b34", "prompt":"moving character", "negative_prompt":"low quality", "resolution":320, "num_frames":92, "num_inference_steps":8, "guidance_scale":1.0, "webhook": null, "track_id":null } ``` ## Body Attributes Your API Key used for request authorization. Text prompt with a description of the things you want in the video to be generated. Link equivalent of a valid PNG, JPEG, or other image format file to use as initial image conditioning. Items you don't want in the video. Seed is used to reproduce results. The same seed will give you the same output again. Pass null for random. Resolution of the generated output. Maximum is 480. The number of frames in the generated video. Default is 92. Number of denoising steps. Required range: `x <= 8` Scale for classifier-free guidance. Min is 1.0, Max is 2.0. Frames per second of the generated video. Should be less than num\_frames. Maximum is 18. Indicates whether the output should be in portrait mode. Accepts true or false. Default is false. Controls the sampling shift in the generation process. Default is 3. If true, stores the video in temporary storage (cleaned every 24 hours). Default is false. A URL to receive a POST API call once the video generation is complete. A unique ID used in the webhook response to identify the request. # Enterprise Image to Video Ultra API Source: https://docs.modelslab.com/enterprise-api/image-to-video-ultra/overview Convert images to high-quality videos on dedicated enterprise GPU servers. Ultra image-to-video with private infrastructure. ## Endpoints Convert static images into dynamic videos with AI Retrieve queued and processing video requests Clear the API's cache for fresh processing Restart your dedicated video processing server Get information about your server status Update your dedicated server to the latest version Clear the API's queue for fresh processing # Restart Server Source: https://docs.modelslab.com/enterprise-api/image-to-video-ultra/restart-server POST /image_to_video_ultra/restart_server This endpoint is used to restart your dedicated server. ## Overview[​](#overview "Direct link to Overview") This endpoint is used to restart your dedicated server. As a response you will receive information about the result of the restart command. ## Request[​](#request "Direct link to Request") ``` --request POST 'https://modelslab.com/api/v1/enterprise/image_to_video_ultra/restart_server' \ ``` Send a `POST` request to [https://modelslab.com/api/v1/enterprise/image\_to\_video\_ultra/restart\_server](https://modelslab.com/api/v1/enterprise/image_to_video_ultra/restart_server) endpoint to restart your dedicated server. ## Attributes[​](#attributes "Direct link to Attributes") | Parameter | Description | | :-------- | :------------------------------------------------------ | | **key** | Your enterprise API Key used for request authorization. | ## Example[​](#example "Direct link to Example") ### Body[​](#body "Direct link to Body") Body Raw ``` { "key": "enterprise_api_key"} ``` ### Request[​](#request-1 "Direct link to Request") * JS * PHP * NODE * PYTHON * JAVA ``` var myHeaders = new Headers();myHeaders.append("Content-Type", "application/json");var raw = JSON.stringify({ "key": ""});var requestOptions = { method: 'POST', headers: myHeaders, body: raw, redirect: 'follow'};fetch("https://modelslab.com/api/v1/enterprise/image_to_video_ultra/restart_server", requestOptions) .then(response => response.text()) .then(result => console.log(result)) .catch(error => console.log('error', error)); ``` ``` ""];$curl = curl_init();curl_setopt_array($curl, array( CURLOPT_URL => 'https://modelslab.com/api/v1/enterprise/image_to_video_ultra/restart_server', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => json_encode($payload), CURLOPT_HTTPHEADER => array( 'Content-Type: application/json' ),));$response = curl_exec($curl);curl_close($curl);echo $response; ``` ``` var request = require('request');var options = { 'method': 'POST', 'url': 'https://modelslab.com/api/v1/enterprise/image_to_video_ultra/restart_server', 'headers': { 'Content-Type': 'application/json' }, body: JSON.stringify({ "key": "" })};request(options, function (error, response) { if (error) throw new Error(error); console.log(response.body);}); ``` ``` import requestsimport jsonurl = "https://modelslab.com/api/v1/enterprise/image_to_video_ultra/restart_server"payload = json.dumps({ "key": ""})headers = { 'Content-Type': 'application/json'}response = requests.request("POST", url, headers=headers, data=payload)print(response.text) ``` ``` OkHttpClient client = new OkHttpClient().newBuilder() .build();MediaType mediaType = MediaType.parse("application/json");RequestBody body = RequestBody.create(mediaType, "{\n \"key\": \"\"\n}");Request request = new Request.Builder() .url("https://modelslab.com/api/v1/enterprise/image_to_video_ultra/restart_server") .method("POST", body) .addHeader("Content-Type", "application/json") .build();Response response = client.newCall(request).execute(); ``` ### Response[​](#response "Direct link to Response") ``` { "message": "server restarting", "status": "success"} ``` # System Details Source: https://docs.modelslab.com/enterprise-api/image-to-video-ultra/system-details POST /image_to_video_ultra/system_details This endpoint returns information about your server. ## Overview[​](#overview "Direct link to Overview") This endpoint returns information about your server. ## Request[​](#request "Direct link to Request") ``` --request POST 'https://modelslab.com/api/v1/enterprise/image_to_video_ultra/system_details' \ ``` Send a `POST` request to [https://modelslab.com/api/v1/enterprise/image\_to\_video\_ultra/system\_details](https://modelslab.com/api/v1/enterprise/image_to_video_ultra/system_details) endpoint to get information about your server. ## Attributes[​](#attributes "Direct link to Attributes") | Parameter | Description | | :-------- | :------------------------------------------------------ | | **key** | Your enterprise API Key used for request authorization. | ## Example[​](#example "Direct link to Example") ### Body[​](#body "Direct link to Body") Body Raw ``` { "key": "enterprise_api_key"} ``` ### Request[​](#request-1 "Direct link to Request") * JS * PHP * NODE * PYTHON * JAVA ``` var myHeaders = new Headers();myHeaders.append("Content-Type", "application/json");var raw = JSON.stringify({ "key": ""});var requestOptions = { method: 'POST', headers: myHeaders, body: raw, redirect: 'follow'};fetch("https://modelslab.com/api/v1/enterprise/image_to_video_ultra/system_details", requestOptions) .then(response => response.text()) .then(result => console.log(result)) .catch(error => console.log('error', error)); ``` ``` ""];$curl = curl_init();curl_setopt_array($curl, array( CURLOPT_URL => 'https://modelslab.com/api/v1/enterprise/image_to_video_ultra/system_details', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => json_encode($payload), CURLOPT_HTTPHEADER => array( 'Content-Type: application/json' ),));$response = curl_exec($curl);curl_close($curl);echo $response; ``` ``` var request = require('request');var options = { 'method': 'POST', 'url': 'https://modelslab.com/api/v1/enterprise/image_to_video_ultra/system_details', 'headers': { 'Content-Type': 'application/json' }, body: JSON.stringify({ "key": "" })};request(options, function (error, response) { if (error) throw new Error(error); console.log(response.body);}); ``` ``` import requestsimport jsonurl = "https://modelslab.com/api/v1/enterprise/image_to_video_ultra/system_details"payload = json.dumps({ "key": ""})headers = { 'Content-Type': 'application/json'}response = requests.request("POST", url, headers=headers, data=payload)print(response.text) ``` ``` OkHttpClient client = new OkHttpClient().newBuilder() .build();MediaType mediaType = MediaType.parse("application/json");RequestBody body = RequestBody.create(mediaType, "{\n \"key\": \"\"\n}");Request request = new Request.Builder() .url("https://modelslab.com/api/v1/enterprise/image_to_video_ultra/system_details") .method("POST", body) .addHeader("Content-Type", "application/json") .build();Response response = client.newCall(request).execute(); ``` ### Response[​](#response "Direct link to Response") The example below shows that there are no queued images for processing at the moment of the request. ``` { "model_count": 0, "queue_time": 0, "status": "ok"} ``` # Update Server Source: https://docs.modelslab.com/enterprise-api/image-to-video-ultra/update-server POST /image_to_video_ultra/update_server This endpoint is used to update your dedicated server. ## Overview[​](#overview "Direct link to Overview") This endpoint is used to update your dedicated server. As a response you will receive information about the result of the update command. ## Request[​](#request "Direct link to Request") ``` --request POST 'https://modelslab.com/api/v1/enterprise/image_to_video_ultra/update_server' \ ``` Send a `POST` request to [https://modelslab.com/api/v1/enterprise/image\_to\_video\_ultra/update\_server](https://modelslab.com/api/v1/enterprise/image_to_video_ultra/update_server) endpoint to update your dedicated server. ## Attributes[​](#attributes "Direct link to Attributes") | Parameter | Description | | :-------- | :------------------------------------------------------ | | **key** | Your enterprise API Key used for request authorization. | ## Example[​](#example "Direct link to Example") ### Body[​](#body "Direct link to Body") Body Raw ``` { "key": "enterprise_api_key"} ``` ### Request[​](#request-1 "Direct link to Request") * JS * PHP * NODE * PYTHON * JAVA ``` var myHeaders = new Headers();myHeaders.append("Content-Type", "application/json");var raw = JSON.stringify({ "key": ""});var requestOptions = { method: 'POST', headers: myHeaders, body: raw, redirect: 'follow'};fetch("https://modelslab.com/api/v1/enterprise/image_to_video_ultra/update_server", requestOptions) .then(response => response.text()) .then(result => console.log(result)) .catch(error => console.log('error', error)); ``` ``` ""];$curl = curl_init();curl_setopt_array($curl, array( CURLOPT_URL => 'https://modelslab.com/api/v1/enterprise/image_to_video_ultra/update_server', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => json_encode($payload), CURLOPT_HTTPHEADER => array( 'Content-Type: application/json' ),));$response = curl_exec($curl);curl_close($curl);echo $response; ``` ``` var request = require('request');var options = { 'method': 'POST', 'url': 'https://modelslab.com/api/v1/enterprise/image_to_video_ultra/update_server', 'headers': { 'Content-Type': 'application/json' }, body: JSON.stringify({ "key": "" })};request(options, function (error, response) { if (error) throw new Error(error); console.log(response.body);}); ``` ``` import requestsimport jsonurl = "https://modelslab.com/api/v1/enterprise/image_to_video_ultra/update_server"payload = json.dumps({ "key": ""})headers = { 'Content-Type': 'application/json'}response = requests.request("POST", url, headers=headers, data=payload)print(response.text) ``` ``` OkHttpClient client = new OkHttpClient().newBuilder() .build();MediaType mediaType = MediaType.parse("application/json");RequestBody body = RequestBody.create(mediaType, "{\n \"key\": \"\"\n}");Request request = new Request.Builder() .url("https://modelslab.com/api/v1/enterprise/image_to_video_ultra/update_server") .method("POST", body) .addHeader("Content-Type", "application/json") .build();Response response = client.newCall(request).execute(); ``` ### Response[​](#response "Direct link to Response") ``` { "message": "server updating", "status": "success"} ``` # Clear Cache Source: https://docs.modelslab.com/enterprise-api/interior/clear-cache POST /interior/clear_cache This endpoint is used to clear the API's cache. ## Request Send a `POST` request to below endpoint to clear the API's cache. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/interior/clear_cache' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Clear Queue Source: https://docs.modelslab.com/enterprise-api/interior/clear-queue POST /interior/clear_queue This endpoint is used to clear the API's queue. ## Request Send a `POST` request to below endpoint to clear the API's cache. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/interior/clear_queue' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Exterior Restorer Source: https://docs.modelslab.com/enterprise-api/interior/exterior-restorer Refresh worn building exteriors into polished designs guided by your prompt. ## Request Make a `POST` request to below endpoint and pass the required parameters in the request body. ``` --request POST 'https://modelslab.com/api/v1/enterprise/interior/exterior_restorer' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key":"enterprise_api_key", "init_image": "https://i.pinimg.com/736x/b2/94/76/b29476a69497bbc870d48a531e0008db.jpg", "prompt": "make beautiful pink and golden color exterior", "seed": 0, "guidance_scale": 8, "strength": 0.99, "num_inference_steps": 51, "base64": false, "temp": false, "specific_object": null, "webhook": null, "track_id": null } ``` ## Body Attributes Your API Key used for authenticating your request. A text prompt describing the exterior style, colors, and mood you want applied to the restored facade. A URL to the exterior photo you want to enhance. Descriptions of elements you don't want in the image (e.g., poor quality, distortion, NSFW content). Degree to which the prompt influences the initial image. 1.0 corresponds to full destruction of original details. Return the image as a base64 string. Default is false. The number of denoising steps to perform. Accepted values: 21, 31, or 41. Scale for classifier-free guidance. Minimum is 1, maximum is 20. If true, stores image in temporary storage valid for 24 hours. Seed for reproducibility. Same seed yields same image. Use null for randomness. URL to receive a POST request once the image generation completes. ID returned in API response to identify the webhook request. # Fetch Image Source: https://docs.modelslab.com/enterprise-api/interior/fetch POST /interior/fetch/{id} Fetch Queued Request API fetches queued request. ## Request Send a `POST` request to below endpoint to return the corresponding queued images. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/interior/fetch/{id}' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Specific Floor Planning Source: https://docs.modelslab.com/enterprise-api/interior/floor-planning This endpoint allows you to generate floor plan from a room image. ## Request Make a `POST` request to below endpoint and pass the required parameters in the request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/interior/floor_planning' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key":"enterprise_api_key", "init_image": "https://i.pinimg.com/564x/f6/73/9d/f6739dc3fec02fa4019d1045fdad4d47.jpg", "prompt": "rendering floor plan of the apartment layout,top view,white background,masterpiece, kitchen, living room, sofa, chair,bedroom,car best quality, extremely detailed,best illustration, best shadow", "seed": 0, "guidance_scale": 8, "strength": 0.99, "num_inference_steps": 51, "base64": false, "temp": false, "specific_object": null, "webhook": null, "track_id": null } ``` ## Body Attributes Your API Key used for request authorization. The text prompt describing the content you want in the generated image. Link to the Initial Image of the room. Descriptions of elements to avoid in the image (e.g., NSFW content, extra limbs, poor quality). Prompt strength when using init\_image. 1.0 corresponds to full destruction of information in the init image. Return the image as a base64 string. Default is false. The number of denoising steps. Acceptable values are 21, 31, or 41. Scale for classifier-free guidance. The minimum is 1 and the maximum is 20. Create a temporary image link valid for 24 hours. Seed for reproducibility. Same seed returns the same image. Pass null for a random number. A URL to receive a POST API call once the image generation is complete. ID returned in the webhook callback to identify the request. # Interior Source: https://docs.modelslab.com/enterprise-api/interior/make-interior This endpoint allows you to generate interior design from an image. ## Request Send a `POST` request to below endpoint and pass the required parameters in the request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/interior/make' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key":"enterprise_api_key", "init_image": "https://imagedelivery.net/PP4qZJxMlvGLHJQBm3ErNg/50bc1662-8d41-468e-55d0-9575ad096000/768", "prompt": "Luxury bedroom with an elegant wooden floor, a stylish table, and a plush red carpet, creating a warm and sophisticated ambiance.", "negative_prompt": "bad quality", "seed": 0, "guidance_scale": 8, "strength": 0.99, "num_inference_steps": 51, "base64": false, "temp": false, "scale_down": 6, "webhook":null, "track_id":null } ``` ## Body Attributes Your API Key used for request authorization. The text prompt describing the content you want in the generated image. Link to the Initial Image of the room. Descriptions of things you don't want in the image. Examples include NSFW content, extra limbs, distorted faces, or poor quality. Prompt strength when using init\_image. A value of 1.0 corresponds to full destruction of information in the init image. Get the response as a base64 string. Options: `true` or `false`. Default is `false`. The number of denoising steps. Acceptable values are 21, 31, or 41. Scale for classifier-free guidance. Minimum is 1, maximum is 20. Create a temporary image link. The link is valid for 24 hours. Seed used to reproduce results. Same seed returns the same image. Pass `null` for a random seed. Provide a URL to receive a POST API call once the image generation is complete. This ID is returned in the response and used to identify the webhook request. # Object Removal Source: https://docs.modelslab.com/enterprise-api/interior/object-removal This endpoint helps to remove objects from an image. ## Request Make a `POST` request to below endpoint and pass the required parameters in the request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/interior/object_removal' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key":"enterprise_api_key", "init_image": "https://assets.modelslab.ai/generations/b7a83e73-ba52-44f5-940b-be6535cba2d8.jpg", "object_name": "table", "base64": false, "webhook":null, "track_id": null } ``` ## Body Attributes Your API Key used for request authorization. Describe the object you want to remove from the image. Link to the Initial Image of the room. Get response as a base64 string. Options: `true` or `false`. Provide a URL to receive a POST API call once the image generation is complete. This ID is returned in the response to the webhook API call and will be used to identify the webhook request. # Enterprise Interior Design API Source: https://docs.modelslab.com/enterprise-api/interior/overview Enterprise AI interior design on dedicated GPU servers. Room decoration, floor planning, and rendering with private infrastructure. ## Endpoints Generate stunning interior designs with AI-powered creativity Create detailed floor plans and layouts for any space Transform and decorate rooms with various design styles Restore and enhance building exteriors with AI Change room scenarios and ambiance instantly Convert sketches into photorealistic interior renders Retrieve queued and processing interior design requests Clear the API's cache for fresh processing Clear the processing queue for new requests Restart your dedicated interior design server Get information about your server status and performance Update your dedicated server to the latest version # Restart Server Source: https://docs.modelslab.com/enterprise-api/interior/restart-server POST /interior/restart_server This endpoint is used to restart your dedicated server. ## Request Send a `POST` request to below endpoint to restart your dedicated server. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/interior/restart_server' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Decorator Source: https://docs.modelslab.com/enterprise-api/interior/room-decorator This endpoint helps to decorate a room according to prompt passed. ## Request Make a `POST` request to below endpoint and pass the required parameters in the request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/interior/room_decorator' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key":"enterprise_api_key", "init_image": "https://assets.modelslab.ai/generations/05550b6f-032a-408e-83ae-8100f2c481e5", "prompt": "luxury badroom, table, red carpet, wodden floor", "negative_prompt": "bad quality", "seed": 0, "guidance_scale": 8, "strength": 0.99, "num_inference_steps": 51, "base64": false, "temp": false, "specific_object": "mid-century coffee table", "webhook":null, "track_id": null } ``` ## Body Attributes Your API Key used for request authorization. The text prompt describing the content you want in the generated image. Link to the Initial Image of the room. Negative prompts are descriptions of things we don't want in our image. Examples include NSFW content, extra limbs, distorted faces, poor quality, or anything else to avoid. Prompt strength when using init\_image. 1.0 corresponds to full destruction of information in the init image. Get response as a base64 string. Options: `true` or `false`. The number of denoising steps. Acceptable values are 21, 31, or 41. The scale for classifier-free guidance. Minimum is 1 and maximum is 20. Create temp image link. This link is valid for 24 hours. Name a specific furniture or decor element that must appear in the redesigned room. Seed is used to reproduce results. Same seed will give you same image in return again. Pass `null` for a random number. Provide a URL to receive a POST API call once the image generation is complete. This ID is returned in the response to the webhook API call and will be used to identify the webhook request. # Scenario Changer Source: https://docs.modelslab.com/enterprise-api/interior/scenario-changer Swap the surroundings of a space to preview how the home looks in different scenarios. ## Request Make a `POST` request to below endpoint and pass the required parameters in the request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/interior/scenario_changer' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key":"enterprise_api_key", "init_image": "https://assets.modelslab.ai/generations/076185f5-4e80-4300-b7b7-bcf79f53149d", "seed": 0, "scenario": "beach", "prompt": "A beautiful house in the snow", "guidance_scale": 8, "strength": 0.99, "num_inference_steps": 51, "base64": false, "temp": false, "specific_object": null, "webhook": null, "track_id": null } ``` ## Body Attributes Your API Key used for authenticating your request. A URL to the photo whose surroundings you want to transform. The scenario to apply. Options: `beach`, `desert`, `plain`, `taiga`. A text description of the desired scenario or surroundings for the image. Negative prompts are descriptions of things we don't want in our image (e.g., NSFW content, distorted faces, poor quality). The degree to which the prompt influences the initial image. `1.0` corresponds to full destruction of the initial image details. Specifies whether the response should be returned as a base64 string. Options: `true` or `false`. The number of denoising steps. Acceptable values: 21, 31, or 41. The scale for classifier-free guidance. Minimum is 1 and maximum is 20. Indicates if temporary links should be used. Valid for 24 hours. Seed is used to reproduce results. Same seed will give you the same image in return again. Pass `null` for a random number. A URL to receive a POST API call once the image generation is complete. An ID returned in the API response, used to identify the webhook request. # Sketch Rendering Source: https://docs.modelslab.com/enterprise-api/interior/sketch-rendering This endpoint allows you to convert exterior house sketch into real world photo as per prompt. ## Request Make a `POST` request to below endpoint and pass the required parameters in the request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/interior/sketch_rendering' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key":"enterprise_api_key", "init_image": "https://assets.modelslab.ai/generations/aa795482-98ca-4b22-9184-90f0a7121a38", "prompt": "turn this pencil sketch of a modern home into a photorealistic render with warm evening lighting", "seed": 0, "guidance_scale": 8, "strength": 0.99, "num_inference_steps": 51, "base64": false, "temp": false, "specific_object": null, "webhook": null, "track_id": null } ``` ## Body Attributes Your API Key used for authenticating your request. Describe the materials, colors, and atmosphere you want applied when rendering the sketch. A URL to the sketch or line art that should be rendered realistically. Negative prompts are descriptions of things we don't want in our image (e.g., NSFW content, extra limbs, distorted faces, poor quality). The degree to which the prompt influences the initial image. `1.0` corresponds to full destruction of the initial image details. Specifies whether the response should be returned as a base64 string. Options: `true` or `false`. The number of denoising steps. Acceptable values are `21`, `31`, or `41`. The scale for classifier-free guidance. Minimum is `1`, and maximum is `20`. Indicates if temporary links should be used. Valid for 24 hours. Seed is used to reproduce results. Same seed will give you same image in return again. Pass `null` for a random number. A URL to receive a POST API call once the image generation is complete. An ID returned in the API response, used to identify the webhook request. # System Details Source: https://docs.modelslab.com/enterprise-api/interior/system-details POST /interior/system_details This endpoint returns information about your server. ## Request Send a `POST` request to below endpoint to get information about your server. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/interior/system_details' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Update Server Source: https://docs.modelslab.com/enterprise-api/interior/update-server POST /interior/update_server This endpoint is used to update your dedicated server. ## Request Send a `POST` request to below endpoint to update your dedicated server. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/interior/update_server' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Clear Cache Source: https://docs.modelslab.com/enterprise-api/krea-2-turbo/clear-cache POST /krea_2_turbo/clear_cache This endpoint is used to clear the API's cache. ## Request Send a `POST` request to below endpoint to clear the API's cache. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/krea_2_turbo/clear_cache' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Clear Queue Source: https://docs.modelslab.com/enterprise-api/krea-2-turbo/clear-queue POST /krea_2_turbo/clear_queue This endpoint is used to clear the API's queue. ## Request Send a `POST` request to below endpoint to clear the API's queue. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/krea_2_turbo/clear_queue' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Fetch Image Source: https://docs.modelslab.com/enterprise-api/krea-2-turbo/fetch POST /krea_2_turbo/fetch Fetch Queued Images API fetches queued images for Krea 2 Turbo. ## Request Send a `POST` request to below endpoint to return the corresponding queued images. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/krea_2_turbo/fetch/{id}' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Enterprise Krea 2 Turbo API Source: https://docs.modelslab.com/enterprise-api/krea-2-turbo/overview Run Krea 2 Turbo models on dedicated enterprise GPU servers. Advanced text-to-image generation with full server control. Not on Enterprise yet? Get your enterprise plan at [ModelsLab](https://modelslab.com/enterprise) ## Available Endpoints This endpoint generates and returns an image from a text prompt using the Krea 2 Turbo model. This endpoint fetches already generated or queued images by ID. This endpoint clears the server cache. This endpoint clears the server queue. This endpoint restarts the server. This endpoint retrieves system and server details. This endpoint updates the server to the latest version. # Restart Server Source: https://docs.modelslab.com/enterprise-api/krea-2-turbo/restart-server POST /krea_2_turbo/restart_server This endpoint is used to restart your dedicated server. ## Request Send a `POST` request to below endpoint to restart your dedicated server. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/krea_2_turbo/restart_server' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # System Details Source: https://docs.modelslab.com/enterprise-api/krea-2-turbo/system-details POST /krea_2_turbo/system_details This endpoint returns information about your server. ## Request Send a `POST` request to below endpoint to get information about your server. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/krea_2_turbo/system_details' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Text to Image Source: https://docs.modelslab.com/enterprise-api/krea-2-turbo/text2img This endpoint generates an image from a text prompt using Krea 2 Turbo model. Make sure you add your [s3 details](/enterprise-api/general/update-s3-details.mdx) for `krea_2_turbo` server, so you can receive image generated in your bucket. Images generated without s3 details being added will be delete after **24hours** ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/krea_2_turbo/text2img' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key" : "enterprise_api_key", "prompt": "ultra realistic close up portrait ((beautiful pale cyberpunk female with heavy black eyeliner))", "negative_prompt": "bad quality", "width": "512", "height": "512", "safety_checker": false, "seed": null, "samples":1, "base64":false, "webhook": null, "track_id": null } ``` ## Body Attributes Your API Key used for request authorization. Text prompt with description of the things you want in the image to be generated. Items you don't want in the image. Max Height: Width: 1024x1024. Max Height: Width: 1024x1024. Number of images to be returned in response. The maximum value is 4. A checker for NSFW images. If such an image is detected, it will be replaced by a blank image. Seed is used to reproduce results. Same seed will give you the same image again. Pass null for a random number. Queue response instantly before processing finishes instead of waiting a minimum amount of time. default: false, options: true or false. Get response as base64 string. default: false, options: true or false. Set a URL to get a POST API call once the image generation is complete. This ID is returned in the response to the webhook API call. This will be used to identify the webhook request. # Update Server Source: https://docs.modelslab.com/enterprise-api/krea-2-turbo/update-server POST /krea_2_turbo/update_server This endpoint is used to update your dedicated server. ## Request Send a `POST` request to below endpoint to update your dedicated server. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/krea_2_turbo/update_server' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Clear Cache Source: https://docs.modelslab.com/enterprise-api/nano-banana/clear-cache POST /nano_banana/clear_cache This endpoint is used to clear the API's cache. ## Request Send a `POST` request to below endpoint to clear the API's cache. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/nano_banana/clear_cache' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Clear Queue Source: https://docs.modelslab.com/enterprise-api/nano-banana/clear-queue POST /nano_banana/clear_queue This endpoint is used to clear the API's queue. ## Request Send a `POST` request to below endpoint to clear the API's queue. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/nano_banana/clear_queue' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Fetch Image Source: https://docs.modelslab.com/enterprise-api/nano-banana/fetch POST /nano_banana/fetch/{id} Fetch Queued Image. ## Request Send a `POST` request to below endpoint to fetch a queued image. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/nano_banana/fetch/{id}' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Image to Image Source: https://docs.modelslab.com/enterprise-api/nano-banana/img-to-img Generate high-definition image from text and reference image using nano banana model. Make sure you add your [s3 details](/enterprise-api/general/update-s3-details) for `nano_banana` server, so you can receive image generated in your bucket. Images generated without s3 details being added will be delete after **24hours** ## Request Make a `POST` request to below endpoint and pass the required parameters in the request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/nano_banana/img2img' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key", "prompt": "Ultra-realistic cinematic lifestyle photo of a young woman sitting on the roof of a vintage turquoise van in a vast flower field, captured from a close low-angle perspective. She wears a pastel summer dress and white sneakers, holding a small bouquet of wildflowers, legs hanging off the van. Soft smile, looking up at the sky, hair and dress gently blowing in the wind. Pastel blue balloons float beside her.Cute hand-drawn doodles surround the scene: flowers, stars, hearts, sparkles, butterflies, smiley faces, and clouds. Handwritten white sketch text in the sky reads \"my happy place,\" \"bloom,\" and \"sunny day.\" Large soft blue sky with ample negative space creates an airy, peaceful composition,Bright natural daylight, dreamy glow, soft bloom, pastel film tones, low contrast, smooth highlights. Color palette: turquoise, sky blue, soft white, pastel pink, pastel yellow, warm cream. Korean indie aesthetic, nostalgic youth diary vibe, Kodak Portra 160 film look, soft grain, ultra-detailed dreamy realism, 8K, aspect ratio 3:4.", "ref_image": "https://assets.modelslab.ai/generations/5e265b64-17e7-461b-8fdd-273393ef4e93.jpg", "width": 2048, "height": 2048, "samples": 1, "seed": 42, "negative_prompt": "blurry, low quality, distorted", "noise_scale_start": 7.5, "noise_scale_end": 7.5, "noise_clip_std": 2.5, "keep_original_aspect": "no", "watermark": "no", "temp": "no", "base64": "no", "track_id": null, "webhook": null } ``` ## Body Attributes Your API Key used for request authorization. Text prompt describing the image you want to generate. Image URL (or array of URLs) to use as reference images for the generation. Items you don't want in the image. Width of the generated image. Must be between 1024 and 2048 and divisible by 32. Defaults to reference image size. Height of the generated image. Must be between 1024 and 2048 and divisible by 32. Defaults to reference image size. Seed for reproducible generation. 0 triggers a random seed. Number of images to return. Maximum: 4. Starting noise scale for the generation process. Ending noise scale for the generation process. Noise clip standard deviation. Keep the original aspect ratio of the reference image. Only applies when using a single reference image. Values: "yes" or "no". Whether to add a watermark to the generated image. Values: "yes" or "no". Store in temporary directory. Values: "yes" or "no". Return image as base64 encoded text. Values: "yes" or "no". A URL to receive a POST API call once the image generation is complete. A unique ID used in the webhook response to identify the request. # Multi Reference Source: https://docs.modelslab.com/enterprise-api/nano-banana/multi-ref Generate images from text with multiple reference images using nano banana model. Make sure you add your [s3 details](/enterprise-api/general/update-s3-details) for `nano_banana` server, so you can receive image generated in your bucket. Images generated without s3 details being added will be delete after **24hours** ## Request Make a `POST` request to below endpoint and pass the required parameters in the request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/nano_banana/multi_ref' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key", "prompt": "Replace the outfit of the girl in Image 1 with the dress shown in Image 2 while maintaining her pose, facial features, hairstyle, and the overall background naturally", "ref_image": [ "https://assets.modelslab.ai/generations/5866dedb-2347-40e7-a6e0-6743271d6242.jpg", "https://assets.modelslab.ai/generations/02cfa5f9-58e0-4c2d-b50b-6944cf1f7e74.png" ], "samples": 1, "seed": 42, "width": 2048, "height": 2048, "negative_prompt": "blurry, low quality, distorted", "noise_scale_start": 7.5, "noise_scale_end": 7.5, "noise_clip_std": 2.5, "watermark": "no", "temp": "no", "base64": "no", "track_id": null, "webhook": null } ``` ## Body Attributes Your API Key used for request authorization. Text prompt describing the image you want to generate. Array of image URLs to use as reference images for multi-reference composition. Items you don't want in the image. Width of the generated image. Must be between 1024 and 2048 and divisible by 32. Height of the generated image. Must be between 1024 and 2048 and divisible by 32. Seed for reproducible generation. 0 triggers a random seed. Number of images to return. Maximum: 4. Starting noise scale for the generation process. Ending noise scale for the generation process. Noise clip standard deviation. Whether to add a watermark to the generated image. Values: "yes" or "no". Store in temporary directory. Values: "yes" or "no". Return image as base64 encoded text. Values: "yes" or "no". A URL to receive a POST API call once the image generation is complete. A unique ID used in the webhook response to identify the request. # Enterprise Nano Banana API Source: https://docs.modelslab.com/enterprise-api/nano-banana/overview Run Nano Banana image generation models on dedicated enterprise servers. Text-to-image, image-to-image, and multi-reference composition with full server control. Not on Enterprise yet? Get your enterprise plan at [ModelsLab](https://modelslab.com/enterprise) ## Available Endpoints Generate images from text using the Nano Banana model. Generate images from text and reference image. Generate images from text with multiple reference images. Retrieve queued and processing image requests. Clear the API's cache for fresh processing. Clear the API's queue for fresh processing. Restart your dedicated server. Get information about your server status. Update your dedicated server to the latest version. # Restart Server Source: https://docs.modelslab.com/enterprise-api/nano-banana/restart-server POST /nano_banana/restart_server This endpoint is used to restart your dedicated server. ## Request Send a `POST` request to below endpoint to restart your dedicated server. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/nano_banana/restart_server' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # System Details Source: https://docs.modelslab.com/enterprise-api/nano-banana/system-details POST /nano_banana/system_details This endpoint returns information about your server. ## Request Send a `POST` request to below endpoint to get system details. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/nano_banana/system_details' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Text to Image Source: https://docs.modelslab.com/enterprise-api/nano-banana/text-to-img Generate high-definition image from text using nano banana model. Make sure you add your [s3 details](/enterprise-api/general/update-s3-details) for `nano_banana` server, so you can receive image generated in your bucket. Images generated without s3 details being added will be delete after **24hours** ## Request Make a `POST` request to below endpoint and pass the required parameters in the request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/nano_banana/text2img' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key", "prompt": "A cinematic portrait of a cyberpunk samurai standing on a neon-lit rooftop, rain-slicked streets below, volumetric lighting, highly detailed", "width": 2048, "height": 2048, "samples": 1, "seed": 42, "negative_prompt": "blurry, low quality, distorted, ugly", "noise_scale_start": 7.5, "noise_scale_end": 7.5, "noise_clip_std": 2.5, "watermark": "no", "temp": "no", "base64": "no", "track_id": null, "webhook": null } ``` ## Body Attributes Your API Key used for request authorization. Text prompt describing the image you want to generate. Items you don't want in the image. Width of the generated image. Must be between 1024 and 2048 and divisible by 32. Height of the generated image. Must be between 1024 and 2048 and divisible by 32. Seed for reproducible generation. 0 triggers a random seed. Number of images to return. Maximum: 4. Starting noise scale for the generation process. Ending noise scale for the generation process. Noise clip standard deviation. Whether to add a watermark to the generated image. Values: "yes" or "no". Store in temporary directory. Values: "yes" or "no". Return image as base64 encoded text. Values: "yes" or "no". A URL to receive a POST API call once the image generation is complete. A unique ID used in the webhook response to identify the request. # Update Server Source: https://docs.modelslab.com/enterprise-api/nano-banana/update-server POST /nano_banana/update_server This endpoint is used to update your dedicated server. ## Request Send a `POST` request to below endpoint to update your dedicated server. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/nano_banana/update_server' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Enterprise API Documentation Source: https://docs.modelslab.com/enterprise-api/overview Deploy and manage dedicated AI infrastructure with ModelsLab Enterprise API. Private GPU servers, custom models, and full server control. You can buy a Enterprise Subscription [HERE](https://modelslab.com/enterprise). ## Categories These are endpoints that are general to all server types. Dedicated Pony model server with full enterprise control. This endpoint is used to create an image from a text prompt based on trained or public models. The image editing suite offers exclusive API endpoints with essential features. Generate images in just a few seconds. Create audio experiences with versatile voice synthesis and audio processing. Create video from a text prompt based on trained or public models. Generate 3D objects from text and image. Generate faces in the fastest time. Generate stunning interior designs from an image. Generate Images from Image. Generate faces with real-time performance. Generate speech from texts. Generate images with very high resolution. Generate high-resolution face images. Create ultra-realistic videos from an image prompt. Generate ultra high-quality video from text or image input. # Clear Cache Source: https://docs.modelslab.com/enterprise-api/pony-model/clear-cache POST /enterprise/pony/clear_cache This endpoint is used to clear the API's cache. ## Request Send a `POST` request to below endpoint to clear the API's cache. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/pony/clear_cache' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Clear Queue Source: https://docs.modelslab.com/enterprise-api/pony-model/clear-queue POST /enterprise/pony/clear_queue This endpoint is used to clear the API's queue. ## Request Send a `POST` request to below endpoint to clear the API's queue. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/pony/clear_queue' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Controlnet Source: https://docs.modelslab.com/enterprise-api/pony-model/controlnet-ep This endpoint is used to generate ControlNet images. ## Request Send a `POST` request to below endpoint. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/pony/controlnet' \ ``` To use the **load balancer**, you need to have **more than 1 server**. Pass the first server's API key, and it will handle the load balancing with the other servers. You can also use multi ControlNet. Just make sure to pass comma saparated controlnet models to the `controlnet_model` as "canny,depth" and `init_image` in the request body. You can also use this endpoint to inpaint images with ControlNet. Just make sure to pass the link to the `mask_image` in the request body. and use controlnet\_model as `inpaint`. ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key", "controlnet_model": "canny", "controlnet_type" :"canny", "model_id": "midjourney", "auto_hint": "yes", "guess_mode" : "no", "prompt": "a model doing photoshoot, ultra high resolution, 4K image", "negative_prompt": null, "init_image": "https://huggingface.co/datasets/diffusers/test-arrays/resolve/main/stable_diffusion_imgvar/input_image_vermeer.png", "mask_image": null, "width": "512", "height": "512", "samples": "1", "scheduler": "UniPCMultistepScheduler", "num_inference_steps": "30", "safety_checker": "no", "enhance_prompt": "yes", "guidance_scale": 7.5, "strength": 0.55, "seed": null, "webhook": null, "track_id": null } ``` ## ControlNet Models ControlNet API using Controlnet 1.1 as default: Suported controlnet\_model: * canny * depth * hed * mlsd * normal * openpose * scribble * segmentation * inpaint * softedge * lineart * shuffle * tile * face\_detector * qrcode ### Schedulers This endpoint also supports schedulers. Use the `scheduler` parameter in the request body to pass a specific scheduler from the list below: * EulerDiscreteScheduler * EulerAncestralDiscreteScheduler * LMSDiscreteScheduler * HeunDiscreteScheduler * KDPM2DiscreteScheduler * KDPM2AncestralDiscreteScheduler * DPMSolverMultistepScheduler * DPMSolverSinglestepScheduler * DDIMScheduler * DDPMScheduler * PNDMScheduler * UniPCMultistepScheduler * DEISMultistepScheduler * LCMScheduler * IPNDMScheduler ## Body Attributes Your enterprise API Key used for request authorization. The ID of the model to be used. It can be a public model or your trained model. ControlNet model ID. It can be from the models list or user trained. ControlNet model type. It can be from the models list. Auto hint image. Options: yes/no. If set to yes and no prompt is passed, the model will attempt to guess what's in the init\_image and create variations. Options: yes/no. Text prompt describing required image modifications. Make it detailed for best results. Items you don't want in the image. Link to the initial image. Link to the ControlNet image. Link to the mask image for inpainting. Width of the image. Maximum: 1024. Height of the image. Maximum: 1024. Number of images to return in the response. Maximum: 4. The scheduler to use. See Schedulers. Enable ToMeSD for faster results. Default: yes. Use Karras sigmas for improved results. Default: yes. Used in DPMSolverMultistepScheduler. Default: none. Custom VAE to use. Default: null. Strength values for LoRa models (comma-separated). Range: 0.1-1. LoRa models to use (comma-separated). Example: contrast-fix,yae-miko-genshin Number of denoising steps. Allowed values: 21 or 31. NSFW checker. If detected, replaces image with blank. Default: yes. Enhance prompts for better results. Default: yes. Enable multilingual input. Default: yes. Scale for classifier-free guidance. Scale for ControlNet guidance. Prompt strength when using init\_image. 1.0 fully overrides the init image. Seed for reproducibility. Pass null for random generation. URL to receive a POST callback when image generation is complete. ID returned in webhook callback to identify the request. Set to yes to upscale the generated image 2x. Clip skip value. Range: 1-8. Return response as base64. You can also pass init\_image, mask\_image, and control\_image as base64. Default: no. Generate a temporary image link valid for 24 hours. Default: no. # Delete Model Source: https://docs.modelslab.com/enterprise-api/pony-model/delete-model This endpoint is used to delete a model from your dedicated server. ## Request Send a `POST` request to below endpoint. Specify the ID(name) of the model to be deleted by using the `model_id` parameter in the request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/pony/delete_model' \ ``` ## Body Attributes Your enterprise API Key used for request authorization. The ID of the model to be deleted. ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key", "model_id": "ckpt-model" } ``` # Fetch Image Source: https://docs.modelslab.com/enterprise-api/pony-model/fetch-queue-image POST /enterprise/pony/fetch This endpoint is used to fetch images from the processing queue. Complex image generation requests are queued, and results can be retrieved later with an estimated processing time provided by the eta parameter. ## Request Send a `POST` request to below endpoint to return the corresponding queued images, specified by the `request_id` parameter in the request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/pony/fetch' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key", "request_id": "your_request_id" } ``` # Get All Models Source: https://docs.modelslab.com/enterprise-api/pony-model/get-all-models This endpoint retrieves all available models. This endpoint returns models' IDs and the date/time they have been loaded on your server. ## Request Send a `POST` request to below endpoint to obtain a list with the available public models and their IDs. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/pony/get_all_models' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` ## Body Attributes Your enterprise API Key used for request authorization. # Image to Image Source: https://docs.modelslab.com/enterprise-api/pony-model/img2img This endpoint generates an image from an image using trained or public models. ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/pony/img2img' \ ``` To use the **load balancer**, you need to have **more than 1 server**. Pass the first server's API key, and it will handle the load balancing with the other servers. ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key", "model_id": "realistic-vision-51", "prompt": "women playing tennis", "negative_prompt": null, "init_image": "https://i.pinimg.com/736x/20/ab/3d/20ab3df5c180e1cae812020bcfeb3093.jpg", "samples": "1", "num_inference_steps": "31", "safety_checker": "yes", "enhance_prompt": "yes", "guidance_scale": 7.5, "strength": 0.7, "scheduler": "UniPCMultistepScheduler", "seed": null, "lora_model": null, "tomesd": "yes", "use_karras_sigmas": "yes", "vae": null, "lora_strength": null, "webhook": null, "track_id": null } ``` ## Schedulers This endpoint also supports schedulers. Use the "scheduler" parameter in the request body to pass a specific scheduler from the list below: * EulerDiscreteScheduler * EulerAncestralDiscreteScheduler * LMSDiscreteScheduler * HeunDiscreteScheduler * KDPM2DiscreteScheduler * KDPM2AncestralDiscreteScheduler * DPMSolverMultistepScheduler * DPMSolverSinglestepScheduler * DDIMScheduler * DDPMScheduler * PNDMScheduler * UniPCMultistepScheduler * DEISMultistepScheduler * LCMScheduler * IPNDMScheduler ## Body Attributes Your enterprise API Key used for request authorization. The ID of the model to be used. It can be public or your trained model. Text prompt with description of the things you want in the image to be generated. Items you don't want in the image. Link to the initial image. Width of the image. Maximum: 1024. Height of the image. Maximum: 1024. Number of images to return. Maximum: 4. Number of denoising steps. Allowed values: 21, 31, or 41. NSFW image checker. If detected, replaces the image with blank. Options: yes/no. Action to apply if NSFW content is detected. Options: blur, sensitive\_content\_text, pixelate, black. Scale for classifier-free guidance (range: 1-20). Prompt strength when using init\_image. 1.0 fully overrides the init image. Clip Skip value. Range: 1-8. Seed for reproducibility. Pass null for random generation. URL to receive a POST callback once the image generation is complete. ID returned in webhook callback to identify the request. # Inpainting Source: https://docs.modelslab.com/enterprise-api/pony-model/inpainting This endpoint is used to inpaint some part of an image according to specific requirements, based on trained or on public models. ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/pony/inpaint' \ ``` To use the **load balancer**, you need to have **more than 1 server**. Pass the first server's API key, and it will handle the load balancing with the other servers. ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key", "model_id": "your_model_id", "prompt": "a cat sitting on a bench", "negative_prompt": null, "init_image": "https://raw.githubusercontent.com/CompVis/stable-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo.png", "mask_image": "https://raw.githubusercontent.com/CompVis/stable-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo_mask.png", "width": "512", "height": "512", "samples": "1", "num_inference_steps": "30", "safety_checker": "no", "guidance_scale": 7.5, "strength": 0.7, "scheduler": "PNDMScheduler", "seed": null, "lora_model": null, "tomesd": "yes", "use_karras_sigmas": "yes", "vae": null, "lora_strength": null, "webhook": null, "track_id": null } ``` ## Schedulers This endpoint also supports schedulers. Use the "scheduler" parameter in the request body to pass a specific scheduler from the list below: * EulerDiscreteScheduler * EulerAncestralDiscreteScheduler * LMSDiscreteScheduler * HeunDiscreteScheduler * KDPM2DiscreteScheduler * KDPM2AncestralDiscreteScheduler * DPMSolverMultistepScheduler * DPMSolverSinglestepScheduler * DDIMScheduler * DDPMScheduler * PNDMScheduler * UniPCMultistepScheduler * DEISMultistepScheduler * LCMScheduler * IPNDMScheduler ## Body Attributes | Parameter | Description | | :------------------------ | :-------------------------------------------------------------------------------------------------------------------------------------------------------- | | **key** | Your enterprise API Key used for request authorization | | **model\_id** | The ID of the model to be used. It can be public or your trained model. | | **prompt** | Text prompt with description of the things you want in the image to be generated | | **negative\_prompt** | Items you don't want in the image | | **init\_image** | Link to the Initial Image | | **mask\_image** | Link to the mask image for inpainting | | **width** | Max Height: Width: 1024x1024 | | **height** | Max Height: Width: 1024x1024 | | **samples** | Number of images to be returned in response. The maximum value is 4. | | **num\_inference\_steps** | Number of denoising steps, The value accepts 21,31,41. | | **safety\_checker** | A checker for NSFW images. If such an image is detected, it will be replaced by a blank image; default: yes, options: yes/no | | **safety\_checker\_type** | Modify image if NSFW images are found; **default**: sensitive\_content\_text, **options**: blur/sensitive\_content\_text/pixelate/black | | **enhance\_prompt** | Enhance prompts for better results; **default**: yes, **options**: yes/no | | **guidance\_scale** | Scale for classifier-free guidance (minimum: 1; maximum: 20) | | **strength** | Prompt strength when using **init** image. 1.0 corresponds to full destruction of information in the init image. | | **tomesd** | Enable tomesd to generate images: gives really fast results, **default**: yes, **options**: yes/no | | **use\_karras\_sigmas** | Use keras sigmas to generate images. gives nice results, **default**: yes, **options**: yes/no | | **algorithm\_type** | Used in DPMSolverMultistepScheduler scheduler, **default**: none, **options**: dpmsolver+++ | | **vae** | Use custom vae in generating images **default**: null | | **lora\_strength** | Specify the strength of the LoRa model you're using. If using multiple LoRa, provide each value as a comma-separated range from minimum 0.1 to maximum 1. | | **lora\_model** | Multi lora is supported, pass comma saparated values . Example contrast-fix,yae-miko-genshin | | **scheduler** | Use it to set a [scheduler](#schedulers). | | **seed** | Seed is used to reproduce results, same seed will give you same image in return again. Pass *null* for a random number. | | **webhook** | Set an URL to get a POST API call once the image generation is complete. | | **track\_id** | This ID is returned in the response to the webhook API call. This will be used to identify the webhook request. | | **clip\_skip** | Clip Skip (minimum: 1; maximum: 8) | | **base64** | Get response as base64 string, pass init\_image, mask\_image as base64 string, to get base64 response. **default**: "no", **options**: yes/no | | **temp** | Create temp image link. This link is valid for 24 hours. **temp**: yes, **options**: yes/no | # List Schedulers Source: https://docs.modelslab.com/enterprise-api/pony-model/list-schedulers This endpoint is used to get a list of all the available schedulers. ## Request Send a `POST` request to below endpoint to clear the API's cache. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/pony/schedulers_list' \ ``` ## Body Attributes Your enterprise API Key used for request authorization. ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Load Model Source: https://docs.modelslab.com/enterprise-api/pony-model/load-model This endpoint is used to load a model to your dedicated server. ## Request Send a `POST` request to below endpoint. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/pony/load_model' \ The model selected for loading has to be a **diffusers** model. ``` ### ControlNet Model url and model\_id table[​](#controlnet-model-url-and-model_id-table "Direct link to ControlNet Model url and model_id table") | url | model\_id | | :---------------------------------------- | :-------- | | lllyasviel/control\_v11p\_sd15\_inpaint | inpaint | | lllyasviel/control\_v11e\_sd15\_ip2p | ip2p | | lllyasviel/control\_v11f1e\_sd15\_tile | tile | | lllyasviel/control\_v11e\_sd15\_shuffle | shuffle | | lllyasviel/control\_v11p\_sd15\_softedge | softedge | | lllyasviel/control\_v11p\_sd15\_scribble | scribble | | lllyasviel/control\_v11p\_sd15\_lineart | lineart | | lllyasviel/control\_v11p\_sd15\_normalbae | normalbae | | lllyasviel/control\_v11f1p\_sd15\_depth | depth | | lllyasviel/control\_v11p\_sd15\_mlsd | mlsd | | lllyasviel/control\_v11p\_sd15\_canny | canny | ## Load a .ckpt or .safetensors Model from Civitai ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key", "url": "https://civitai.com/api/download/models/94640", "model_id": "majicmix-realistic", "model_category": "stable_diffusion", "model_format": "safetensors", "webhook": "https://modelslab.com" } ``` ## Load a Huggingface Model ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key", "url": "wavymulder/Analog-Diffusion", "model_id": "analog-diffusion", "model_category": "stable_diffusion", "model_format": "diffusers", "webhook": "https://modelslab.com" } ``` ## Load a ControlNet Model ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key", "url": "lllyasviel/control_v11p_sd15_canny", "model_id": "canny", "model_category": "controlnet", "model_format": "diffusers", "webhook": "https://modelslab.com" } ``` ## Attributes Your enterprise API Key used for request authorization. The URL of the Hugging Face model, a .ckpt download link, or a trained model from our Dreambooth API. Unique name (ID) for your model. The model will be saved under this ID and can be referenced later when generating images. The category of the model to load. Options: lora, embeddings, stable\_diffusion, stable\_diffusion\_xl, controlnet. The format of the model to load. Options: ckpt, safetensors, pt, diffusers. A webhook URL to receive a POST callback when the model load event completes. # Load Model V2 Source: https://docs.modelslab.com/enterprise-api/pony-model/load-model-v2 This endpoint is updated V2 version of the load_model endpoint allows you to load models from Huggingface, Civitai, and custom trained models. ## Request Send a `POST` request to below endpoint. ``` --request POST 'https://modelslab.com/api/v1/enterprise/pony/load_model_v2' \ ``` ## ControlNet Model url and model\_id table | url | model\_id | | :---------------------------------------- | :-------- | | lllyasviel/control\_v11p\_sd15\_inpaint | inpaint | | lllyasviel/control\_v11e\_sd15\_ip2p | ip2p | | lllyasviel/control\_v11f1e\_sd15\_tile | tile | | lllyasviel/control\_v11e\_sd15\_shuffle | shuffle | | lllyasviel/control\_v11p\_sd15\_softedge | softedge | | lllyasviel/control\_v11p\_sd15\_scribble | scribble | | lllyasviel/control\_v11p\_sd15\_lineart | lineart | | lllyasviel/control\_v11p\_sd15\_normalbae | normalbae | | lllyasviel/control\_v11f1p\_sd15\_depth | depth | | lllyasviel/control\_v11p\_sd15\_mlsd | mlsd | | lllyasviel/control\_v11p\_sd15\_canny | canny | ## Load a .ckpt or .safetensors Model from Civitai ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key", "url": "https://civitai.com/api/download/models/94640", "model_id": "majicmix-realistic", "model_category": "stable_diffusion", "model_format": "safetensors", "webhook": "https://modelslab.com", "revision": "fp16" } ``` ## Load a Huggingface Model ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key", "url": "wavymulder/Analog-Diffusion", "model_id": "analog-diffusion", "model_type": "huggingface", "from_safetensors": "no", "webhook": "https://modelslab.com", "revision": "fp32", "upcast_attention": "no" } ``` ## Load a ControlNet Model ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key", "url": "lllyasviel/control_v11p_sd15_canny", "model_id": "canny", "model_type": "controlnet", "webhook": "https://modelslab.com", "revision": "fp32", "upcast_attention": "no" } ``` ## BodyAttributes Your enterprise API Key used for request authorization. The URL of the Hugging Face model, a .ckpt download link, or a trained model from our Dreambooth API. Unique name (ID) for your model. The model will be saved under this ID and can be referenced later when generating images. The category of the model. Options: lora, stable\_diffusion, stable\_diffusion\_xl, controlnet. The format of the model. Options: ckpt, safetensors, pt, diffusers. Precision revision of the model. Options: fp16 or fp32. Default: fp32. A webhook URL to receive a POST callback when the model load event completes. # Load Vae Source: https://docs.modelslab.com/enterprise-api/pony-model/load-vae This endpoint is used to load a VAE model to your dedicated server. ## Request Send a `POST` request to below endpoint to load vae ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/pony/load_vae' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key", "webhook": "http://webhook-url.com", "vae_id": "vae-kl-f8-anime2", "vae_url": "bullhug/kl-f8-anime2", "vae_type": "diffusers" } ``` ## Body Attributes Your enterprise API Key used for request authorization. A webhook URL to receive a POST callback once the VAE load event completes. The ID to assign to the VAE. The URL of the VAE file. The type of the VAE file. Options: diffusers, safetensors, pt. # Enterprise Pony Model API Source: https://docs.modelslab.com/enterprise-api/pony-model/overview Enterprise Pony model on dedicated GPU servers. Load custom Pony models, ControlNet, inpainting, and full server management. ## Endpoints Get detailed information about your dedicated server Restart your dedicated server Update your dedicated server to the latest version Clear the API's cache for fresh processing Retrieve a list of all available schedulers Load a model onto your server Load a model using the v2 loader for enhanced control Check if a specific model exists on your server List all models available on your server Delete a model from your server Generate ControlNet-based images Generate an image from a text prompt Transform an existing image with prompts Modify specific parts of an image using inpainting Upscale images with super resolution Upload an image to your S3 bucket Sync models between multiple servers Load a VAE onto your server Retrieve queued or processing image generation requests # Restart Server Source: https://docs.modelslab.com/enterprise-api/pony-model/restart-server POST /enterprise/pony/restart_server This endpoint is used to restart your dedicated server. ## Request Send a `POST` request to below endpoint to restart your dedicated server. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/pony/restart_server' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Super Resolution Source: https://docs.modelslab.com/enterprise-api/pony-model/super-resolution This endpoint returns a super resolution version of an image. ## Request Send a `POST` request to below endpoint to return an upscaled version of the initial image. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/pony/super_resolution' \ ``` Want more upscale models? Request a custom model by contacting us at our [Discord](https://discord.gg/RjVZfAnhsq) server. The following upscale models are supported: | Model ID | Description | | :-------------------------------- | :-------------------------- | | **RealESRGAN\_x4plus** | 4x upscaling model | | **RealESRNet\_x4plus** | 4x upscaling model | | **RealESRGAN\_x4plus\_anime\_6B** | 4x Anime upscaling model | | **RealESRGAN\_x2plus** | 2x upscaling model | | **realesr-general-x4v3** | 4x upscaling general model | | **ultra\_resolution** | 4K+ upscaling general model | ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key", "url": "https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/f5a706c6-b640-4b6d-8a03-fc8421ec1428/width=96/Stable_Yogi.jpeg", "scale": 3, "webhook": null, "face_enhance": true } ``` ## Body Attributes Your API Key used for request authorization. The URL of the image you want to upscale to super resolution. The scale factor for upscaling. Must be between 1 and 4. The upscale model to use. Default: realesr-general-x4v3. A webhook URL to receive a POST callback once the image generation is complete. Enable face enhancement in the upscaled image. Default: false. # Sync Model Source: https://docs.modelslab.com/enterprise-api/pony-model/sync-model This endpoint allows users to sync models between two enterprise servers. ## Request Send a `POST` request to below endpoint to sync models of one enterprise server with another server ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/pony/sync_models' \ ``` ## Body Attributes Your enterprise API Key used for request authorization. The enterprise API Key of the second server you want to sync with. ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key", "sync_key": "enterprise_api_key" } ``` # System Details Source: https://docs.modelslab.com/enterprise-api/pony-model/system-details POST /enterprise/pony/system_details This endpoint is used to retrieve system details. ## Request Send a `POST` request to below endpoint to get information about your server. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/pony/system_details' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Text to Image Source: https://docs.modelslab.com/enterprise-api/pony-model/text2img This endpoint allows users to generate images from text prompts. ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/pony/txt2img' \ ``` To use the **load balancer**, you need to have **more than 1 server**. Pass the first server's API key, and it will handle the load balancing with the other servers. You can find a list of the public models available and their IDs **[here](https://modelslab.com/models)**. ## Schedulers This endpoint also supports schedulers. Use the "scheduler" parameter in the request body to pass a specific scheduler from the list below: * EulerDiscreteScheduler * EulerAncestralDiscreteScheduler * LMSDiscreteScheduler * HeunDiscreteScheduler * KDPM2DiscreteScheduler * KDPM2AncestralDiscreteScheduler * DPMSolverMultistepScheduler * DPMSolverSinglestepScheduler * DDIMScheduler * DDPMScheduler * PNDMScheduler * UniPCMultistepScheduler * DEISMultistepScheduler * LCMScheduler * IPNDMScheduler ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key", "model_id": "model_id", "prompt": "ultra realistic close up portrait ((beautiful pale cyberpunk female with heavy black eyeliner)), blue eyes, shaved side haircut, hyper detail, cinematic lighting, magic neon, dark red city, Canon EOS R3, nikon, f/1.4, ISO 200, 1/160s, 8K, RAW, unedited, symmetrical balance, in-frame, 8K", "negative_prompt": "painting, extra fingers, mutated hands, poorly drawn hands, poorly drawn face, deformed, ugly, blurry, bad anatomy, bad proportions, extra limbs, cloned face, skinny, glitchy, double torso, extra arms, extra hands, mangled fingers, missing lips, ugly face, distorted face, extra legs, anime", "width": "512", "height": "512", "samples": "1", "num_inference_steps": "20", "safety_checker": "no", "enhance_prompt": "yes", "seed": null, "guidance_scale": 7.5, "panorama": "no", "self_attention": "no", "upscale": "no", "lora_model": null, "clip_skip": "2", "tomesd": "yes", "use_karras_sigmas": "yes", "vae": null, "lora_strength": null, "scheduler": "UniPCMultistepScheduler", "webhook": null, "track_id": null } ``` ## Body Attributes Your enterprise API Key used for request authorization. The ID of the model to be used. It can be public or your trained model. Text prompt describing the image you want to generate. Items you don't want in the image. Width of the generated image. Maximum: 1024. Height of the generated image. Maximum: 1024. Number of images to return. Maximum: 4. Number of denoising steps. Allowed values: 21, 31, or 41. NSFW checker. If detected, replaces the image with blank. Default: yes. Action if NSFW content is detected. Default: sensitive\_content\_text. Enhance prompts for better results. Default: yes. Seed for reproducibility. Pass null for random generation. Scale for classifier-free guidance. Generate a panorama image. Default: no. Enable self-attention for higher quality images (slower). Default: no. Upscale generated images 2x. Default: no. Enable ToMeSD for faster generation. Default: yes. Use Karras sigmas for improved results. Default: yes. Algorithm type used in DPMSolverMultistepScheduler. Default: none. Custom VAE to use. Default: null. LoRa strength(s). Multiple values supported, comma-separated. Range: 0.1-1. LoRa model(s) to use. Multiple supported, comma-separated. Example: contrast-fix,yae-miko-genshin. Scheduler to use. See Schedulers. URL to receive a POST callback once image generation is complete. ID returned in webhook callback to identify the request. Clip Skip value. Range: 1-8. Return response as base64 string. Default: no. Apply high-resolution fix for generated images. Default: no. Generate a temporary image link valid for 24 hours. Default: no. # Update Server Source: https://docs.modelslab.com/enterprise-api/pony-model/update-server POST /enterprise/pony/update_server This endpoint is used to update your dedicated server. ## Request Send a `POST` request to below endpoint to update your dedicated server. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/pony/update_server' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Upload Image Source: https://docs.modelslab.com/enterprise-api/pony-model/upload-image This endpoint allows users to upload images to their S3 bucket. You should have your own S3 bucket to use this endpoint. Make sure you are passing the image in `base64` format. ## Request Send a `POST` request to below endpoint. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/pony/upload_image' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key", "base64_image": "iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAACXBIWXMAAA7DAAAOwwHHb6hkAAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAABe1JREFUaIHdms9PVFcUxz/zA2YhFRAUQVjVH1EXVBFIEBxNq2n/BKMB2RgDahCCCxOX/gG17YYfUVmYxh9VlCC1QcFGg4mKdmGi/ZGgLkQYQKogkJnbxZkH782bx7z3wDBtT3Iyc+fec+75zrv33HPOfS4SQx5gO7An/LkJWA9kRIz7APwBvAAeA33AEyCYIDvipjLge2AUUHHyaFhH6TLbDsA3wK92DM3OFrYzFrgH7FsOABuBX6IZUVSEqqlBtbejBgZQ4+MopYw8NiZ9bW2o6mrUunWWgHqADckA4AKagE/6CX0+VG0t6t49VChkNjwWh0Kovj7UoUOo9HQTmE9AQ3juhFAmcEM/ideLOnoU9eaNc+Ot+PVrVH296I4AdB1YuVQQa4FBveLyctSzZ4kDEMlPn6JKS01gHgN5SwHxu6bM5UI1N6NmZ5MHQuPZWVRjo8ypA/MyHjArEf+uAOXxyCZONoBI7uhApaUZwPwGZNkF4QJuasJpaajOzuUHofG1a6Z9cx2bDqAJ3XLq6EgdCI3PnTMtsxOxQGxA52JPnkw9CI0bG02uedNiQOYPu/Ly5dnYdnl21uTNfrYC8bU2yOtNrouNlwcHxfHowEQNZ+Zjp2PHUm+0FdfVGYD0R4Io0zp9Pmcn9rt3Anz3btSJE6hAILZMICBj/X7U8eOiw+58r16ZwpkdeiA/aB21tfaVTk2hNm82nsLbti2+t2ZmUMXFRpktW1DT0/bnrakxyJ/VQHjQ5RP9/fYVdnWJTE6OhOqZmdLu7bWW6e2VMVlZIrNqlbS7uuzPe+eOAcgw4HYjGV0OQGEhVFVZ+QIzffwon+npMD4OPp+0p6acy2i/2yG/H/Lz55trgC8AThJGV1PjbOONjKByc43LJD8fNTFhLTMxIWP0MqtXo0ZHnc198KBBR5P2RADYtcv+vwKQmwu3bkFFBaxYIfI9PZCZaS2TmSkyVVUis3MndHdDTo6zuf1+Q7ME4ClhZAMDiXeXyeL7941hvgv4m3C1Y2wMsrOd/TOpokBAVkSYJl1ACHB5PDA3B66EJZbJJaXA64VQSJpuwiFxRsZ/BwSIrRkLVTOXO4W2JJT+V0vrA0AwCBMTqTTNGQUC8yAAJt3AX1rr5Uv7ivr6oLISTp1amkGhEOzfDwUFcPmyfbkIW/8E+JGwP3ZSYPD7F/x4d3f858HFiwt6Kivty7W0GM6Ri26kZgRAvym6t6aSkoXvDQ0wOWlfVqOREWhuXmjv3WtfNsLWxyDxvAJUYaH90ufw8EK0C6iqquj1Xit++xa1ffuCfF4e6v17e7LBoCle2wYSxo9oPzoJ469cMVY3iopQly7JRFYyc3Oo8+fFcE3O7Ubdvm1/Xi0VCPNbYP4Y+U7rcJJYKYU6e9ZUqlFFRVLHbW9H3byJunFD1vThw+bI1+NxXnKqrjbo+Fa/xkq1Dp9PCspOFHd2otassbwisOTCwsWTsGg8NGRKdUuIoH6ts77eufcJBFCnT0tuEQtAQQHqzBnU5KTzeY4cMei6qxmvP8f3Ea4Veb3w6BEUF0dijU3BoHiUhw/h+XPJAt1uiaq3bpXcpaIinJs6pMFBKC2VOcL0FdAbbWwPYbSlpf+uAt3MDGrHDsPT6F4M9HpgWhvc1JR6ABo3NJhKphtjPcEGTcDlkgJyqkG0tZk84/FYIED2zXVNyOuV0n6qQFy9arpWuIqDe8XPkGN/3te3ti4/iAsXTCAeYX4JISblIddd88usqWl5HMDMjOyJiOX0AqlhxUV5+icDqLIyqYonC8STJybvpD2JuEFotBLdniG8b+rqnEcAi/HQkBx2EdcGCviJOJaTFbmQ6y7DCwPp6VKdvHt38...", "image_type": "png" } ``` ## Body Attributes Your enterprise API Key used for request authorization. The base64-encoded string of the image to be uploaded. The extension or type of the image. Options: png, jpeg, jpg. # Verify Model Source: https://docs.modelslab.com/enterprise-api/pony-model/verify-model This endpoint allows users to verify if a specific model exists. ## Request Send a `POST` request to below endpoint to verify if a certain model exists on your dedicated server. Specify the model by using the **model\_id** parameter in the request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/pony/verify_model' \ ``` ## Body Attributes Your enterprise API Key used for request authorization. The ID of the model to be verified. ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key", "model_id": "ckpt-model" } ``` # Clear Cache Source: https://docs.modelslab.com/enterprise-api/qwen-edit/clear-cache POST /enterprise/image_editing/clear_cache This endpoint is used to clear the API's cache. ## Request Send a `POST` request to below endpoint to clear the API's cache. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/image_editing/clear_cache' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Clear Queue Source: https://docs.modelslab.com/enterprise-api/qwen-edit/clear-queue POST /enterprise/image_editing/clear_queue This endpoint is used to clear the API's queue. ## Request Send a `POST` request to below endpoint to clear the API's queue. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/image_editing/clear_queue' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Fashion Source: https://docs.modelslab.com/enterprise-api/qwen-edit/fashion This endpoint allows you to wear a cloth image sample on an existing model body. Fashion endpoint result Make sure you add your [s3 details](/enterprise-api/general/update-s3-details) for `image_editing` server, so you can receive image generated in your bucket. Images generated without s3 details being added will be delete after **24hours** ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body to the endpoint. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/image_editing/fashion' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key", "prompt": ":A realistic photo of a model wearing a beautiful t-shirt", "negative_prompt": "Low quality, unrealistic, bad cloth, warped cloth", "init_image": "https://assets.modelslab.ai/generations/3227c6c5-14f6-4755-8be5-4f96c0fe988c.jpg", "cloth_image": "https://assets.modelslab.ai/generations/e202dba8-d3da-4bf6-9849-dc0535563e57.jpg", "cloth_type": "upper_body", "guidance_scale": 7.5, "num_inference_steps": 21, "seed": null, "webhook": null, "track_id": null } ``` ## Body Attributes Your API Key used for request authorization Image URL of the model to try the dress on Cloth/Dress URL for the garment to try-on One of `upper_body`, `lower_body` or `dresses` based on where the garment is to be worn Text prompt with description of the things you want in the image to be generated Items you don't want in the image Number of denoising steps. Value accepted are 21, 31 or 41 Scale for classifier-free guidance (minimum: 1; maximum: 20) Random seed for reproducible results Set an URL to get a POST API call once the image generation is complete This ID is returned in the response to the webhook API call. This will be used to identify the webhook request # Fetch Image Source: https://docs.modelslab.com/enterprise-api/qwen-edit/fetchimage POST /enterprise/image_editing/fetch/{id} This endpoint is used to fetch an image. ## Request Send a `POST` request to below endpoint to fetch an image. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/image_editing/fetch/{id}' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Outpainting Source: https://docs.modelslab.com/enterprise-api/qwen-edit/outpainting This endpoint helps to outpaint by expanding the giving image. Outpainting endpoint result Make sure you add your [s3 details](/enterprise-api/general/update-s3-details) for `image_editing` server, so you can receive image generated in your bucket. Images generated without s3 details being added will be delete after **24hours** ## Request\[​ Make a `POST` request to below endpoint and pass the required parameters as a request body to the endpoint. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/image_editing/outpaint' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key", "seed": 12345, "width": 512, "height": 512, "prompt": "a majestic cat house, lush greenery, filled with plants, high quality, cartoonish, realistic, 4k", "image": "https://i.ibb.co/wp0w7nt/1-d212fe65-f95c-4bbe-b275-99f0dedd901a.png", "negative_prompt": "dull background, text, characters, symbols, unrealistic, repetitive background, boring background, bad, low quality, black background", "overlap_width": 32, "num_inference_steps": 15, "guidance_scale": 8.0, "temp": true, "base64": false, "webhook": null, "track_id": null } ``` ## Body Attributes Your API Key used for request authorization The text prompt to guide image generation. Aspects to avoid in the generated image. URL of the initial image to outpaint Width of the output image. Max: 1440 Height of the output image. Max: 1440 Width of the mask overlap area. Max: 42 Number of denoising steps. Max: 30 How closely to follow the prompt Seed for reproducible results (-1 or 0 for random) Whether to save output temporarily Whether the `image` is base64 encoded Set a URL to get a POST API call once the image generation is complete This ID is returned in the response to the webhook API call. This will be used to identify the webhook request # Enterprise Qwen Edit API Source: https://docs.modelslab.com/enterprise-api/qwen-edit/overview Enterprise AI image editing powered by the Qwen model on dedicated GPU servers. Edit, transform, and enhance images with fashion try-on, outpainting, object removal, and more. Make sure you add your [s3 details](/enterprise-api/general/update-s3-details) for `image_editing` server, so you can receive images generated in your bucket. Images generated without s3 details being added will be deleted after **24 hours**. ### Endpoints Edit images using the powerful Qwen AI model Try on clothing items on existing model bodies Extend images beyond their original boundaries Fetch queued image generation results Clear the server cache Clear the server queue Restart your dedicated server Get information about your server Update your dedicated server # Qwen Edit Source: https://docs.modelslab.com/enterprise-api/qwen-edit/qwen-edit This endpoint allows you to edit images using Qwen model. ![Qwen Edit endpoint result](https://assets.modelslab.ai/generations/cc18442d-6dc0-4eb2-9c40-27fa7c59dce4.jpg) Make sure you add your [s3 details](/enterprise-api/general/update-s3-details) for `image_editing` server, so you can receive image generated in your bucket. Images generated without s3 details being added will be delete after **24hours** ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body to the endpoint. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/image_editing/qwen_edit' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key", "prompt": "the woman wearing the dress", "init_image": [ "https://assets.modelslab.ai/characters/68e7a7f153307.png", "https://i.pinimg.com/736x/6e/ab/48/6eab481a1ee8fcfaec32a316d2768a61.jpg" ], "base64": false, "webhook": null, "track_id": null } ``` ## Body Attributes Your API Key used for request authorization Text prompt with description of the things you want in the image to be generated. Links to the image want your generations to edit and manipulate. If provided init\_image is in base64 format or if you want your generated images as a base64 string, must be set to `true`. Default: `false`. Set an URL to get a POST API call once the image generation is complete. This ID is returned in the response to the webhook API call. This will be used to identify the webhook request. # Restart Server Source: https://docs.modelslab.com/enterprise-api/qwen-edit/restart-server POST /enterprise/image_editing/restart_server This endpoint is used to restart your dedicated server. ## Request Send a `POST` request to below endpoint to restart your dedicated server. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/image_editing/restart_server' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # System Details Source: https://docs.modelslab.com/enterprise-api/qwen-edit/system-details POST /enterprise/image_editing/system_details This endpoint returns information about your server. ## Request Send a `POST` request to below endpoint to get system details. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/image_editing/system_details' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Update Server Source: https://docs.modelslab.com/enterprise-api/qwen-edit/update-server POST /enterprise/image_editing/update_server This endpoint is used to update your dedicated server. ## Request Send a `POST` request to below endpoint to update your dedicated server. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/image_editing/update_server' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Clear Cache Source: https://docs.modelslab.com/enterprise-api/qwen/clear-cache POST /qwen/clear_cache This endpoint is used to clear the API's cache. ## Request Send a `POST` request to below endpoint to clear the API's cache. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/qwen/clear_cache' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Clear Queue Source: https://docs.modelslab.com/enterprise-api/qwen/clear-queue POST /qwen/clear_queue This endpoint is used to clear the API's queue. ## Request Send a `POST` request to below endpoint to clear the API's cache. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/qwen/clear_queue' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Fetch Image Source: https://docs.modelslab.com/enterprise-api/qwen/fetch POST /qwen/fetch/{id} Fetch Queued Image. ## Request Send a `POST` request to below endpoint to return the corresponding queued videos. Where `{id}` is the ID returned together with the image URL in the response upon its generation. This endpoint does not generate new video, it returns already generated/queued videos. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/qwen/fetch/{id}' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Image to Image Source: https://docs.modelslab.com/enterprise-api/qwen/img-to-img Generate high-definition image from text using qwen model. ## Request Make a `POST` request to below endpoint and pass the required parameters in the request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/qwen/img2img' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key":"enterprise_api_key", "prompt": " photorealistic style, Victoria Orlova, a 24-year-old woman with long wavy dark chestnut hair, plump scarlet lips, deep brown eyes, almond-shaped eyes, fair skin, a slender curvaceous figure, an elegant posture, wearing cherry-colored lace lingerie, a delicate gold chain on her collarbone, a silk slip, strappy high heels, a subtle smoky eye, lounging on a velvet chaise lounge, watching a movie, lazily tracing a finger along her lips, glancing from under her lashes with a smirking expression, soft ambient lighting, photorealistic style", "init_image": "https://assets.modelslab.ai/generations/a56df09f-4c7f-4172-8390-29a22b17877a.avif", "width": 1024, "height": 1024, "samples": 1, "track_id":null, "webhook":null } ``` ## Body Attributes Your API Key used for request authorization. Text prompt describing the image you want to generate. Image URL to use as the initial image for the image generation. Items you don’t want in the image. Number of images to return. Maximum: 2. Width of the generated image. Maximum: 1024. Height of the generated image. Maximum: 1024. A URL to receive a POST API call once the video generation is complete. A unique ID used in the webhook response to identify the request. # Inpaint Source: https://docs.modelslab.com/enterprise-api/qwen/inpaint Generate high-definition image from init image and mask image using qwen model. ## Request Make a `POST` request to below endpoint and pass the required parameters in the request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/qwen/inpaint' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key":"enterprise_api_key", "prompt": " photorealistic style, Victoria Orlova, a 24-year-old woman with long wavy dark chestnut hair, plump scarlet lips, deep brown eyes, almond-shaped eyes, fair skin, a slender curvaceous figure, an elegant posture, wearing cherry-colored lace lingerie, a delicate gold chain on her collarbone, a silk slip, strappy high heels, a subtle smoky eye, lounging on a velvet chaise lounge, watching a movie, lazily tracing a finger along her lips, glancing from under her lashes with a smirking expression, soft ambient lighting, photorealistic style", "init_image": "https://assets.modelslab.ai/generations/9a509904-125d-424b-8d0d-53b0bd0901f9.png", "mask_image": "https://assets.modelslab.ai/generations/9a509904-125d-424b-8d0d-53b0bd0901f9.png", "width": 1024, "height": 1024, "samples": 1, "track_id":null, "webhook":null } ``` ## Body Attributes Your API Key used for request authorization. Text prompt describing the image you want to generate. Image URL to use as the initial image for the image generation. Mask image URL to use as the mask for the image generation. Items you don’t want in the image. Number of images to return. Maximum: 2. Width of the generated image. Maximum: 1024. Height of the generated image. Maximum: 1024. A URL to receive a POST API call once the video generation is complete. A unique ID used in the webhook response to identify the request. # Enterprise Qwen API Source: https://docs.modelslab.com/enterprise-api/qwen/overview Run Qwen image generation models on dedicated enterprise servers. Text-to-image, image-to-image, and inpainting with full server control. ## Endpoints
Generate images from text with qwen model NEW
Retrieve queued and processing image requests Clear the API's cache for fresh processing Restart your dedicated server Get information about your server status Update your dedicated server to the latest version Clear the API's queue for fresh processing
# Restart Server Source: https://docs.modelslab.com/enterprise-api/qwen/restart-server POST /qwen/restart_server This endpoint is used to restart your dedicated server. ## Request Send a `POST` request to below endpoint to restart your dedicated server. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/qwen/restart_server' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # System Details Source: https://docs.modelslab.com/enterprise-api/qwen/system-details POST /qwen/system_details This endpoint returns information about your server. ## Request Send a `POST` request to below endpoint to get information about your server. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/qwen/system_details' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Text to Image Source: https://docs.modelslab.com/enterprise-api/qwen/text-to-img Generate high-definition image from text using qwen model. ## Request Make a `POST` request to below endpoint and pass the required parameters in the request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/qwen/text2img' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key":"enterprise_api_key", "prompt": " photorealistic style, Victoria Orlova, a 24-year-old woman with long wavy dark chestnut hair, plump scarlet lips, deep brown eyes, almond-shaped eyes, fair skin, a slender curvaceous figure, an elegant posture, wearing cherry-colored lace lingerie, a delicate gold chain on her collarbone, a silk slip, strappy high heels, a subtle smoky eye, lounging on a velvet chaise lounge, watching a movie, lazily tracing a finger along her lips, glancing from under her lashes with a smirking expression, soft ambient lighting, photorealistic style", "width": 1024, "height": 1024, "samples": 1, "track_id":null, "webhook":null } ``` ## Body Attributes Your API Key used for request authorization. Text prompt describing the image you want to generate. Items you don’t want in the image. Number of images to return. Maximum: 2. Width of the generated image. Maximum: 1024. Height of the generated image. Maximum: 1024. A URL to receive a POST API call once the video generation is complete. A unique ID used in the webhook response to identify the request. # Update Server Source: https://docs.modelslab.com/enterprise-api/qwen/update-server POST /qwen/update_server This endpoint is used to update your dedicated server. ## Request Send a `POST` request to below endpoint to update your dedicated server. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/qwen/update_server' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Clear Cache Source: https://docs.modelslab.com/enterprise-api/realtime/clear-cache POST /realtime/clear_cache This endpoint is used to clear the API's cache. ## Request Send a `POST` request to below endpoint to clear the API's cache. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/realtime/clear_cache' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Clear Queue Source: https://docs.modelslab.com/enterprise-api/realtime/clear-queue POST /realtime/clear_queue This endpoint is used to clear the API's queue. ## Request Send a `POST` request to below endpoint to clear the API's cache. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/realtime/clear_queue' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Fetch Image Source: https://docs.modelslab.com/enterprise-api/realtime/fetchimage POST /realtime/fetch/{id} This endpoint is used to fetch queued images. ## Request Send a `POST` request to below endpoint to return the corresponding queued images. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/realtime/fetch/{id}' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Image to Image Source: https://docs.modelslab.com/enterprise-api/realtime/img2img This endpoint generates and returns an image from an image passed with its URL in the request. Make sure you add your [s3 details](/enterprise-api/general/update-s3-details) for `realtime` server, so you can receive image generated in your bucket. Images generated without s3 details being added will be delete after **24hours** Image to image endpoint result ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/realtime/img2img' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key", "prompt": "a cat sitting on a bench", "negative_prompt": "bad quality", "init_image": "https://raw.githubusercontent.com/CompVis/stable-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo.png", "width": "512", "height": "512", "samples": "1", "temp": false, "safety_checker": false, "strength":0.7, "seed": null, "webhook": null, "track_id": null } ``` ## Body Attributes Your API Key used for request authorization. Text prompt with description of the things you want in the image to be generated. Items you don't want in the image. Link to the Initial Image. Width of the image. Maximum allowed: 1024. Height of the image. Maximum allowed: 1024. Number of images to be returned in response. Maximum: 4. A checker for NSFW images. If such an image is detected, it will be replaced by a blank image. Get response as base64 string. Options: `true` or `false`. Prompt strength when using init image. 1.0 corresponds to full destruction of information in the init image. Queue response instantly before processing finishes instead of waiting. Options: `true` or `false`. Seed is used to reproduce results. Pass `null` for a random number. Enhance prompts for better results. Options: `true` or `false`. Set a URL to get a POST API call once the image generation is complete. This ID is returned in the response to the webhook API call. This will be used to identify the webhook request. # Inpainting Source: https://docs.modelslab.com/enterprise-api/realtime/inpaint This endpoint generates and returns an image from an image and a mask passed with their URLs in the request. Make sure you add your [s3 details](/enterprise-api/general/update-s3-details) for `realtime` server, so you can receive image generated in your bucket. Images generated without s3 details being added will be delete after **24hours** Inpainting endpoint result ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/realtime/inpaint' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_key_here", "prompt": "a cat sitting on a bench", "negative_prompt": "bad quality", "init_image": "https://raw.githubusercontent.com/CompVis/stable-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo.png", "mask_image": "https://raw.githubusercontent.com/CompVis/stable-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo_mask.png", "width": "512", "height": "512", "samples": 1, "safety_checker": false, "strength": 0.7, "base64": false, "seed": null, "webhook": null, "track_id": null } ``` ## Body Attributes Your API Key used for request authorization. Text prompt with description of the things you want in the image to be generated. Items you don't want in the image. Link to the Initial Image. Link to the mask image for inpainting. Width of the image (max 1024). Height of the image (max 1024). Number of images to be returned in response. Maximum is 4. A checker for NSFW images. If such an image is detected, it will be replaced by a blank image. Enhance prompts for better results. Options: true/false. Prompt strength when using init image. 1.0 corresponds to full destruction of information in the init image. Queue response instantly before processing finishes. Options: true/false. Get response as base64 string. Options: true/false. Seed is used to reproduce results. Same seed will give you the same image again. Pass null for a random number. Set a URL to get a POST API call once the image generation is complete. This ID is returned in the response to the webhook API call. It will be used to identify the webhook request. # Enterprise Realtime API Source: https://docs.modelslab.com/enterprise-api/realtime/overview Real-time image generation on dedicated enterprise GPU servers. Ultra-fast text-to-image, image-to-image, and inpainting endpoints. ## Endpoints Generate and return an image directly from a text description Transform an existing image using prompts for creative modifications Replace or modify specific parts of an image using a mask Retrieve queued or processing image generation requests Clear the API’s server cache for fresh processing Clear the processing queue for new requests Restart your dedicated realtime image generation server Get information about your server status and performance Update your dedicated server to the latest version # Restart Server Source: https://docs.modelslab.com/enterprise-api/realtime/restart-server POST /realtime/restart_server This endpoint is used to restart your dedicated server. ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/realtime/restart_server' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # System Details Source: https://docs.modelslab.com/enterprise-api/realtime/system-details POST /realtime/system_details This endpoint is used to retrieve information about your server. ## Request\` Make a `POST` request to below endpoint and pass the required parameters as a request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/realtime/system_details' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Text to Image Source: https://docs.modelslab.com/enterprise-api/realtime/text2img This endpoint is used to generate an image from a text prompt. Make sure you add your [s3 details](/enterprise-api/general/update-s3-details) for `realtime` server, so you can receive image generated in your bucket. Images generated without s3 details being added will be delete after **24hours** Text to image endpoint result ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/realtime/text2img' \ ``` ## Body ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key" : "", "prompt": "ultra realistic close up portrait ((beautiful pale cyberpunk female with heavy black eyeliner))", "negative_prompt": "bad quality", "width": "512", "height": "512", "safety_checker": false, "seed": null, "samples":1, "base64":false, "webhook": null, "track_id": null } ``` ## Body Attributes Your API Key used for request authorization. Text prompt with description of the things you want in the image to be generated. Items you don't want in the image. Width of the image (max 1024). Height of the image (max 1024). Number of images to be returned in response. Maximum is 4. A checker for NSFW images. If such an image is detected, it will be replaced by a blank image. Seed is used to reproduce results. Same seed will give you the same image again. Pass null for a random number. Queue response instantly before processing finishes. Options: true/false. Get response as base64 string. Options: true/false. Set a URL to get a POST API call once the image generation is complete. This ID is returned in the response to the webhook API call. It will be used to identify the webhook request. Enhance prompts for better results. Options: true/false. # Update Server Source: https://docs.modelslab.com/enterprise-api/realtime/update-server POST /realtime/update_server This endpoint is used to update your dedicated open server. ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/realtime/update_server' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Clear Cache Source: https://docs.modelslab.com/enterprise-api/speech-to-text/clear-cache POST /enterprise/speech_to_text/clear_cache This endpoint is used to clear the API's cache. ## Request Send a `POST` request to below endpoint to clear the API's cache. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/speech_to_text/clear_cache' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` ## Body Attributes API key for authentication. # Clear Queue Source: https://docs.modelslab.com/enterprise-api/speech-to-text/clear-queue POST /enterprise/speech_to_text/clear_queue This endpoint is used to clear the API's queue. ## Request Send a `POST` request to below endpoint to clear the API's queue. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/speech_to_text/clear_queue' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` ## Body Attributes API key for authentication. # Fetch Source: https://docs.modelslab.com/enterprise-api/speech-to-text/fetch-audio POST /enterprise/speech_to_text/fetch/{id} This endpoint is used to fetch a queued audio. ## Request Send a `POST` request to below endpoint to return the corresponding queued audio. Where `{id}` is the ID returned together with the audio URL in the response upon its generation. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/speech_to_text/fetch/{id}' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` ## Body Attributes API key for authentication. # Enterprise Speech to Text API Source: https://docs.modelslab.com/enterprise-api/speech-to-text/overview Enterprise speech-to-text transcription on dedicated GPU servers. Accurate audio transcription with private infrastructure. Not on Enterprise yet? Get your enterprise plan at [ModelsLab](https://modelslab.com/enterprise) ## Available Endpoints This endpoint generates and returns text from audio. This endpoint fetches already generated or queued audio by ID. This endpoint clears the server cache. This endpoint clears the server queue. This endpoint restarts the server. This endpoint retrieves system and server details. This endpoint updates the server to the latest version. # Restart Server Source: https://docs.modelslab.com/enterprise-api/speech-to-text/restart-server POST /enterprise/speech_to_text/restart_server This endpoint is used to restart your dedicated server. ## Request Send a `POST` request to below endpoint to restart your dedicated server. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/speech_to_text/restart_server' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` ## Body Attributes API key for authentication. # Speech To Text Source: https://docs.modelslab.com/enterprise-api/speech-to-text/speech-to-text POST /enterprise/speech_to_text/transcribe Speech-to-Text allow to convert audio into written transcription in multiple languages. ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/speech_to_text/transcribe' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key", "init_audio": "https://assets.modelslab.ai/generations/9ab0c784-65ec-41b3-a646-99dfe16b053b.mp3", "language": "en", "timestamp_level": null, "webhook": null, "track_id": null } ``` ## Body Attributes API key for authentication. The audio file to transcribe. Language for the voice.\ Allowed values: `af`, `ar`, `be`, `bn`, `bg`, `zh`, `cs`, `da`, `nl`, `en`, `fi`, `fr`, `de`, `el`, `he`, `hi`, `hu`, `id`, `it`, `ja`, `kn`, `ko`, `ml`, `mr`, `ne`, `pa`, `fa`, `pl`, `pt`, `ro`, `ru`, `sr`, `es`, `sv`, `tl`, `ta`, `te`, `th`, `tr`, `uk`, `ur`, `vi`, `cy` Timestamp level for the transcription.\ Allowed values: `null`, `word`, `sentence` URL to receive POST notification upon completion. ID for webhook identification. **Timestamp Level Accuracy:** Sentence-level timestamps work well and provide reliable results. However, word-level timestamps may not be accurate and may provide less reliable results. Whisper supports several languages, but performance may vary due to factors like limited training data, script complexity, and regional dialects, potentially affecting transcription accuracy. ### Languages Supported ``` "Afrikaans": "af", "Arabic": "ar", "Belarusian": "be", "Bengali": "bn", "Bulgarian": "bg", "Chinese": "zh", "Czech": "cs", "Danish": "da", "Dutch": "nl", "English": "en", "Finnish": "fi", "French": "fr", "German": "de", "Greek": "el", "Hebrew": "he", "Hindi": "hi", "Hungarian": "hu", "Indonesian": "id", "Italian": "it", "Japanese": "ja", "Kannada": "kn", "Korean": "ko", "Malayalam": "ml", "Marathi": "mr", "Nepali": "ne", "Panjabi": "pa", "Persian": "fa", "Polish": "pl", "Portuguese": "pt", "Romanian": "ro", "Russian": "ru", "Serbian": "sr", "Spanish": "es", "Swedish": "sv", "Tagalog": "tl", "Tamil": "ta", "Telugu": "te", "Thai": "th", "Turkish": "tr", "Ukrainian": "uk", "Urdu": "ur", "Vietnamese": "vi", "Welsh": "cy" ``` # System Details Source: https://docs.modelslab.com/enterprise-api/speech-to-text/system-details POST /enterprise/speech_to_text/system_details This endpoint is used to get information about your server. ## Request Send a `POST` request to below endpoint to get information about your server. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/speech_to_text/system_details' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` ## Body Attributes API key for authentication. # Update Server Source: https://docs.modelslab.com/enterprise-api/speech-to-text/update-server POST /enterprise/speech_to_text/update_server This endpoint is used to update your dedicated server. ## Request Send a `POST` request to below endpoint to update your dedicated server. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/speech_to_text/update_server' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` ## Body Attributes API key for authentication. # Clear Cache Source: https://docs.modelslab.com/enterprise-api/super-resolution/clear-cache POST /super-resolution/clear_cache This endpoint is used to clear the API's cache. ## Request Send a `POST` request to below endpoint to clear the API's cache. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/super_resolution/clear_cache' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Clear Queue Source: https://docs.modelslab.com/enterprise-api/super-resolution/clear-queue POST /super-resolution/clear_queue This endpoint is used to clear the API's queue. ## Request Send a `POST` request to below endpoint to clear the API's cache. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/super_resolution/clear_queue' \ ``` ## Body ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Fetch Image Source: https://docs.modelslab.com/enterprise-api/super-resolution/fetchimage POST /super-resolution/fetch/{id} This endpoint is used to fetch images that are queued for super resolution. ## Request Send a `POST` request to below endpoint to return the corresponding queued images. Where `{id}` is the ID returned together with the image URL in the response upon its generation. This endpoint does not generate new images, it returns already generated/queued images. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/super_resolution/fetch/{id}' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Super Resolution Source: https://docs.modelslab.com/enterprise-api/super-resolution/make This endpoint is used to return a super resolution version of an image. Super Resolution endpoint result ## Request Send a `POST` request to below [https://modelslab.com/api/v1/enterprise/super\_resolution/make](https://modelslab.com/api/v1/enterprise/super_resolution/make) endpoint to return the corresponding super resolution image of the image passed. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/super_resolution/make' \ ``` ### Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key", "init_image": "https://i.pinimg.com/564x/fc/8e/6a/fc8e6a075f341284b0f44bf1592f9f3c.jpg", "face_enhance": false, "scale": 3, "webhook": null, "track_id": null } ``` ## Body Attributes Your API Key used for request authorization. The URL of the image that you want to upscale. A number for scaling the image. Common values: 2, 4, or 8. Enable or disable the face enhancement feature. Options: true/false. Provide a URL to receive a POST API call once the image generation is complete. This ID is returned in the response to the webhook API call and will be used to identify the webhook request. # Enterprise Super Resolution API Source: https://docs.modelslab.com/enterprise-api/super-resolution/overview AI image upscaling on dedicated enterprise GPU servers. Enhance image resolution with full server management and cache control. ## Endpoints Generate a super-resolution version of an image with optional scaling and face enhancement Retrieve queued or processing super-resolution requests Clear the API’s server cache for fresh processing Restart your dedicated super-resolution server Get information about your server status and performance Update your dedicated server to the latest version # Restart Server Source: https://docs.modelslab.com/enterprise-api/super-resolution/restart-server POST /enterprise/super-resolution/restart_server This endpoint is used to restart your dedicated server. ## Request Send a `POST` request to below endpoint to restart your dedicated server. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/super_resolution/restart_server' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # System Details Source: https://docs.modelslab.com/enterprise-api/super-resolution/system-details POST /enterprise/super-resolution/system_details This endpoint is used to retrieve information about your server. ## Request Send a `POST` request to below endpoint to get information about your server. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/super_resolution/system_details' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Update Server Source: https://docs.modelslab.com/enterprise-api/super-resolution/update-server POST /enterprise/super-resolution/update_server This endpoint is used to update your dedicated server. ## Request Send a `POST` request to below endpoint to update your dedicated server. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/super_resolution/update_server' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Clear Cache Source: https://docs.modelslab.com/enterprise-api/text-to-image/clear-cache POST /enterprise/clear_cache This endpoint is used to clear the API's cache. ## Request Send a `POST` request to below endpoint to clear the API's cache. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/clear_cache' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Clear Queue Source: https://docs.modelslab.com/enterprise-api/text-to-image/clear-queue POST /enterprise/clear_queue This endpoint is used to clear the API's queue. ## Request Send a `POST` request to below endpoint to clear the API's queue. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/clear_queue' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Controlnet Source: https://docs.modelslab.com/enterprise-api/text-to-image/controlnet-ep This endpoint is used to generate ControlNet images. ## Request Send a `POST` request to below endpoint. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/controlnet' \ ``` To use the **load balancer**, you need to have **more than 1 server**. Pass the first server's API key, and it will handle the load balancing with the other servers. You can also use multi ControlNet. Just make sure to pass comma saparated controlnet models to the `controlnet_model` as "canny,depth" and `init_image` in the request body. You can also use multi Lora. Just make sure to pass comma saparated lora model ids to the `lora_model` as `"more_details,animie"` in the request body. You can also use this endpoint to inpaint images with ControlNet. Just make sure to pass the link to the `mask_image` in the request body. and use controlnet\_model as `inpaint`. ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key", "controlnet_model": "canny", "controlnet_type" :"canny", "model_id": "midjourney", "auto_hint": "yes", "guess_mode" : "no", "prompt": "a model doing photoshoot, ultra high resolution, 4K image", "negative_prompt": null, "init_image": "https://huggingface.co/datasets/diffusers/test-arrays/resolve/main/stable_diffusion_imgvar/input_image_vermeer.png", "mask_image": null, "width": "512", "height": "512", "samples": "1", "scheduler": "UniPCMultistepScheduler", "num_inference_steps": "30", "safety_checker": "no", "enhance_prompt": "yes", "guidance_scale": 7.5, "strength": 0.55, "seed": null, "webhook": null, "track_id": null } ``` ## ControlNet Models ControlNet API using Controlnet 1.1 as default: Suported controlnet\_model: * canny * depth * hed * mlsd * normal * openpose * scribble * segmentation * inpaint * softedge * lineart * shuffle * tile * face\_detector * qrcode ### Schedulers This endpoint also supports schedulers. Use the `scheduler` parameter in the request body to pass a specific scheduler from the list below: * DDPMScheduler * DDIMScheduler * PNDMScheduler * LMSDiscreteScheduler * EulerDiscreteScheduler * EulerAncestralDiscreteScheduler * DPMSolverMultistepScheduler * HeunDiscreteScheduler * KDPM2DiscreteScheduler * DPMSolverSinglestepScheduler * KDPM2AncestralDiscreteScheduler * UniPCMultistepScheduler * DDIMInverseScheduler * DEISMultistepScheduler * IPNDMScheduler * KarrasVeScheduler * ScoreSdeVeScheduler * LCMScheduler ## Body Attributes Your enterprise API Key used for request authorization. The ID of the model to be used. It can be a public model or your trained model. ControlNet model ID. It can be from the models list or user trained. ControlNet model type. It can be from the models list. Auto hint image. Options: yes/no. If set to yes and no prompt is passed, the model will attempt to guess what's in the init\_image and create variations. Options: yes/no. Text prompt describing required image modifications. Make it detailed for best results. Items you don’t want in the image. Link to the initial image. Link to the ControlNet image. Link to the mask image for inpainting. Width of the image. Maximum: 1024. Height of the image. Maximum: 1024. Number of images to return in the response. Maximum: 4. The scheduler to use. See Schedulers. Enable ToMeSD for faster results. Default: yes. Use Karras sigmas for improved results. Default: yes. Used in DPMSolverMultistepScheduler. Default: none. Custom VAE to use. Default: null. Strength values for LoRa models (comma-separated). Range: 0.1–1. LoRa models to use (comma-separated). Example: contrast-fix,yae-miko-genshin Number of denoising steps. Allowed values: 21 or 31. NSFW checker. If detected, replaces image with blank. Default: yes. Enhance prompts for better results. Default: yes. Enable multilingual input. Default: yes. Scale for classifier-free guidance. Scale for ControlNet guidance. Prompt strength when using init\_image. 1.0 fully overrides the init image. Seed for reproducibility. Pass null for random generation. URL to receive a POST callback when image generation is complete. ID returned in webhook callback to identify the request. Set to yes to upscale the generated image 2x. Clip skip value. Range: 1–8. Return response as base64. You can also pass init\_image, mask\_image, and control\_image as base64. Default: no. Generate a temporary image link valid for 24 hours. Default: no. # Delete Model Source: https://docs.modelslab.com/enterprise-api/text-to-image/delete-model This endpoint is used to delete a model from your dedicated server. ## Request Send a `POST` request to below endpoint. Specify the ID(name) of the model to be deleted by using the `model_id` parameter in the request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/delete_model' \ ``` ## Body Attributes Your enterprise API Key used for request authorization. The ID of the model to be deleted. ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key", "model_id": "ckpt-model" } ``` # Fetch Image Source: https://docs.modelslab.com/enterprise-api/text-to-image/fetch-queue-image POST /enterprise/fetch This endpoint is used to fetch images from the processing queue. Complex image generation requests are queued, and results can be retrieved later with an estimated processing time provided by the eta parameter. ## Request Send a `POST` request to below endpoint to return the corresponding queued images, specified by the `request_id` parameter in the request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/fetch' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key", "request_id": "your_request_id" } ``` # Get All Models Source: https://docs.modelslab.com/enterprise-api/text-to-image/get-all-models This endpoint retrieves all available models. This endpoint returns models' IDs and the date/time they have been loaded on your server. ## Request Send a `POST` request to below endpoint to obtain a list with the available public models and their IDs. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/get_all_models' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` ## Body Attributes Your enterprise API Key used for request authorization. # Image to Image Source: https://docs.modelslab.com/enterprise-api/text-to-image/img2img This endpoint generates an image from an image using trained or public models. ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/img2img' \ ``` To use the **load balancer**, you need to have **more than 1 server**. Pass the first server's API key, and it will handle the load balancing with the other servers. ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key", "model_id": "realistic-vision-51", "prompt": "women playing tennis", "negative_prompt": null, "init_image": "https://i.pinimg.com/736x/20/ab/3d/20ab3df5c180e1cae812020bcfeb3093.jpg", "samples": "1", "num_inference_steps": "31", "safety_checker": "yes", "enhance_prompt": "yes", "guidance_scale": 7.5, "strength": 0.7, "scheduler": "UniPCMultistepScheduler", "seed": null, "lora_model": null, "tomesd": "yes", "use_karras_sigmas": "yes", "vae": null, "lora_strength": null, "webhook": null, "track_id": null } ``` ## Schedulers This endpoint also supports schedulers. Use the "scheduler" parameter in the request body to pass a specific scheduler from the list below: * DDPMScheduler * DDIMScheduler * PNDMScheduler * LMSDiscreteScheduler * EulerDiscreteScheduler * EulerAncestralDiscreteScheduler * DPMSolverMultistepScheduler * HeunDiscreteScheduler * KDPM2DiscreteScheduler * DPMSolverSinglestepScheduler * KDPM2AncestralDiscreteScheduler * UniPCMultistepScheduler * DDIMInverseScheduler * DEISMultistepScheduler * IPNDMScheduler * KarrasVeScheduler * ScoreSdeVeScheduler * LCMScheduler ## Body Attributes Your enterprise API Key used for request authorization. The ID of the model to be used. It can be public or your trained model. Text prompt with description of the things you want in the image to be generated. Items you don't want in the image. Link to the initial image. Width of the image. Maximum: 1024. Height of the image. Maximum: 1024. Number of images to return. Maximum: 4. Number of denoising steps. Allowed values: 21, 31, or 41. NSFW image checker. If detected, replaces the image with blank. Options: yes/no. Action to apply if NSFW content is detected. Options: blur, sensitive\_content\_text, pixelate, black. Scale for classifier-free guidance (range: 1–20). Prompt strength when using init\_image. 1.0 fully overrides the init image. Clip Skip value. Range: 1–8. Seed for reproducibility. Pass null for random generation. URL to receive a POST callback once the image generation is complete. ID returned in webhook callback to identify the request. # Inpainting Source: https://docs.modelslab.com/enterprise-api/text-to-image/inpainting This endpoint is used to inpaint some part of an image according to specific requirements, based on trained or on public models. ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/inpaint' \ ``` To use the **load balancer**, you need to have **more than 1 server**. Pass the first server's API key, and it will handle the load balancing with the other servers. ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key", "model_id": "your_model_id", "prompt": "a cat sitting on a bench", "negative_prompt": null, "init_image": "https://raw.githubusercontent.com/CompVis/stable-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo.png", "mask_image": "https://raw.githubusercontent.com/CompVis/stable-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo_mask.png", "width": "512", "height": "512", "samples": "1", "num_inference_steps": "30", "safety_checker": "no", "guidance_scale": 7.5, "strength": 0.7, "scheduler": "PNDMScheduler", "seed": null, "lora_model": null, "tomesd": "yes", "use_karras_sigmas": "yes", "vae": null, "lora_strength": null, "webhook": null, "track_id": null } ``` ## Schedulers This endpoint also supports schedulers. Use the "scheduler" parameter in the request body to pass a specific scheduler from the list below: * DDPMScheduler * DDIMScheduler * PNDMScheduler * LMSDiscreteScheduler * EulerDiscreteScheduler * EulerAncestralDiscreteScheduler * DPMSolverMultistepScheduler * HeunDiscreteScheduler * KDPM2DiscreteScheduler * DPMSolverSinglestepScheduler * KDPM2AncestralDiscreteScheduler * UniPCMultistepScheduler * DDIMInverseScheduler * DEISMultistepScheduler * IPNDMScheduler * KarrasVeScheduler * ScoreSdeVeScheduler * LCMScheduler ## Body Attributes | Parameter | Description | | :------------------------ | :-------------------------------------------------------------------------------------------------------------------------------------------------------- | | **key** | Your enterprise API Key used for request authorization | | **model\_id** | The ID of the model to be used. It can be public or your trained model. | | **prompt** | Text prompt with description of the things you want in the image to be generated | | **negative\_prompt** | Items you don't want in the image | | **init\_image** | Link to the Initial Image | | **mask\_image** | Link to the mask image for inpainting | | **width** | Max Height: Width: 1024x1024 | | **height** | Max Height: Width: 1024x1024 | | **samples** | Number of images to be returned in response. The maximum value is 4. | | **num\_inference\_steps** | Number of denoising steps, The value accepts 21,31,41. | | **safety\_checker** | A checker for NSFW images. If such an image is detected, it will be replaced by a blank image; default: yes, options: yes/no | | **safety\_checker\_type** | Modify image if NSFW images are found; **default**: sensitive\_content\_text, **options**: blur/sensitive\_content\_text/pixelate/black | | **enhance\_prompt** | Enhance prompts for better results; **default**: yes, **options**: yes/no | | **guidance\_scale** | Scale for classifier-free guidance (minimum: 1; maximum: 20) | | **strength** | Prompt strength when using **init** image. 1.0 corresponds to full destruction of information in the init image. | | **tomesd** | Enable tomesd to generate images: gives really fast results, **default**: yes, **options**: yes/no | | **use\_karras\_sigmas** | Use keras sigmas to generate images. gives nice results, **default**: yes, **options**: yes/no | | **algorithm\_type** | Used in DPMSolverMultistepScheduler scheduler, **default**: none, **options**: dpmsolver+++ | | **vae** | Use custom vae in generating images **default**: null | | **lora\_strength** | Specify the strength of the LoRa model you're using. If using multiple LoRa, provide each value as a comma-separated range from minimum 0.1 to maximum 1. | | **lora\_model** | Multi lora is supported, pass comma saparated values . Example contrast-fix,yae-miko-genshin | | **scheduler** | Use it to set a [scheduler](#schedulers). | | **seed** | Seed is used to reproduce results, same seed will give you same image in return again. Pass *null* for a random number. | | **webhook** | Set an URL to get a POST API call once the image generation is complete. | | **track\_id** | This ID is returned in the response to the webhook API call. This will be used to identify the webhook request. | | **clip\_skip** | Clip Skip (minimum: 1; maximum: 8) | | **base64** | Get response as base64 string, pass init\_image, mask\_image as base64 string, to get base64 response. **default**: "no", **options**: yes/no | | **temp** | Create temp image link. This link is valid for 24 hours. **temp**: yes, **options**: yes/no | # List Schedulers Source: https://docs.modelslab.com/enterprise-api/text-to-image/list-schedulers This endpoint is used to get a list of all the available schedulers. ## Request Send a `POST` request to below endpoint to clear the API's cache. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/schedulers_list' \ ``` ## Body Attributes Your enterprise API Key used for request authorization. ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Load Model Source: https://docs.modelslab.com/enterprise-api/text-to-image/load-model This endpoint is used to load a model to your dedicated server. ## Request Send a `POST` request to below endpoint. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/load_model' \ The model selected for loading has to be a **diffusers** model. ``` ### ControlNet Model url and model\_id table[​](#controlnet-model-url-and-model_id-table "Direct link to ControlNet Model url and model_id table") | url | model\_id | | :---------------------------------------- | :-------- | | lllyasviel/control\_v11p\_sd15\_inpaint | inpaint | | lllyasviel/control\_v11e\_sd15\_ip2p | ip2p | | lllyasviel/control\_v11f1e\_sd15\_tile | tile | | lllyasviel/control\_v11e\_sd15\_shuffle | shuffle | | lllyasviel/control\_v11p\_sd15\_softedge | softedge | | lllyasviel/control\_v11p\_sd15\_scribble | scribble | | lllyasviel/control\_v11p\_sd15\_lineart | lineart | | lllyasviel/control\_v11p\_sd15\_normalbae | normalbae | | lllyasviel/control\_v11f1p\_sd15\_depth | depth | | lllyasviel/control\_v11p\_sd15\_mlsd | mlsd | | lllyasviel/control\_v11p\_sd15\_canny | canny | ## Load a .ckpt or .safetensors Model from Civitai ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key", "url": "https://civitai.com/api/download/models/94640", "model_id": "majicmix-realistic", "model_type": "custom_ckpt", "from_safetensors": "yes", "webhook": "https://modelslab.com", "revision": "fp32", "upcast_attention": "no" } ``` ## Load a Huggingface Model ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key", "url": "wavymulder/Analog-Diffusion", "model_id": "analog-diffusion", "model_type": "huggingface", "from_safetensors": "no", "webhook": "https://modelslab.com", "revision": "fp32", "upcast_attention": "no" } ``` ## Load a ControlNet Model ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key", "url": "lllyasviel/control_v11p_sd15_canny", "model_id": "canny", "model_type": "controlnet", "webhook": "https://modelslab.com", "revision": "fp32", "upcast_attention": "no" } ``` ## Attributes Your enterprise API Key used for request authorization. The URL of the Hugging Face model, a .ckpt download link, or a trained model from our Dreambooth API. Unique name (ID) for your model. The model will be saved under this ID and can be referenced later when generating images. Set this to "yes" if loading a .safetensors file; otherwise use "no". Default: no. The type of model to load. Options: huggingface, api\_trained, custom\_ckpt, lora, controlnet. Precision revision of the model. Options: fp16 or fp32. Default: fp32. A webhook URL to receive a POST callback when the model load event completes. Set to "yes" only when loading a Stable Diffusion 2.1 model; otherwise leave as "no". Default: no. # Load Model V2 Source: https://docs.modelslab.com/enterprise-api/text-to-image/load-model-v2 This endpoint is updated V2 version of the load_model endpoint allows you to load models from Huggingface, Civitai, and custom trained models. ## Request Send a `POST` request to below endpoint. ``` --request POST 'https://modelslab.com/api/v1/enterprise/load_model_v2' \ ``` ## ControlNet Model url and model\_id table | url | model\_id | | :---------------------------------------- | :-------- | | lllyasviel/control\_v11p\_sd15\_inpaint | inpaint | | lllyasviel/control\_v11e\_sd15\_ip2p | ip2p | | lllyasviel/control\_v11f1e\_sd15\_tile | tile | | lllyasviel/control\_v11e\_sd15\_shuffle | shuffle | | lllyasviel/control\_v11p\_sd15\_softedge | softedge | | lllyasviel/control\_v11p\_sd15\_scribble | scribble | | lllyasviel/control\_v11p\_sd15\_lineart | lineart | | lllyasviel/control\_v11p\_sd15\_normalbae | normalbae | | lllyasviel/control\_v11f1p\_sd15\_depth | depth | | lllyasviel/control\_v11p\_sd15\_mlsd | mlsd | | lllyasviel/control\_v11p\_sd15\_canny | canny | ## Load a .ckpt or .safetensors Model from Civitai ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key", "url": "https://civitai.com/api/download/models/94640", "model_id": "majicmix-realistic", "model_category": "stable_diffusion", "model_format": "safetensors", "webhook": "https://modelslab.com", "revision": "fp16" } ``` ## Load a Huggingface Model ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key", "url": "wavymulder/Analog-Diffusion", "model_id": "analog-diffusion", "model_type": "huggingface", "from_safetensors": "no", "webhook": "https://modelslab.com", "revision": "fp32", "upcast_attention": "no" } ``` ## Load a ControlNet Model ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key", "url": "lllyasviel/control_v11p_sd15_canny", "model_id": "canny", "model_type": "controlnet", "webhook": "https://modelslab.com", "revision": "fp32", "upcast_attention": "no" } ``` ## BodyAttributes Your enterprise API Key used for request authorization. The URL of the Hugging Face model, a .ckpt download link, or a trained model from our Dreambooth API. Unique name (ID) for your model. The model will be saved under this ID and can be referenced later when generating images. The category of the model. Options: lora, stable\_diffusion, stable\_diffusion\_xl, controlnet. The format of the model. Options: ckpt, safetensors, pt, diffusers. Precision revision of the model. Options: fp16 or fp32. Default: fp32. A webhook URL to receive a POST callback when the model load event completes. # Load Vae Source: https://docs.modelslab.com/enterprise-api/text-to-image/load-vae This endpoint is used to load a VAE model to your dedicated server. ## Request Send a `POST` request to below endpoint to load vae ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/load_vae' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key", "webhook": "http://webhook-url.com", "vae_id": "vae-kl-f8-anime2", "vae_url": "bullhug/kl-f8-anime2", "vae_type": "diffusers" } ``` ## Body Attributes Your enterprise API Key used for request authorization. A webhook URL to receive a POST callback once the VAE load event completes. The ID to assign to the VAE. The URL of the VAE file. The type of the VAE file. Options: diffusers, safetensors, pt. # Enterprise Text to Image API Source: https://docs.modelslab.com/enterprise-api/text-to-image/overview Enterprise Stable Diffusion text-to-image on dedicated GPU servers. Load custom models, ControlNet, inpainting, and full server management. ## Endpoints Get detailed information about your dedicated server Restart your dedicated server Update your dedicated server to the latest version Clear the API’s cache for fresh processing Retrieve a list of all available schedulers Load a model onto your server Load a model using the v2 loader for enhanced control Check if a specific model exists on your server List all models available on your server Delete a model from your server Generate ControlNet-based images Generate an image from a text prompt Transform an existing image with prompts Modify specific parts of an image using inpainting Upscale images with super resolution Upload an image to your S3 bucket Sync models between multiple servers Load a VAE onto your server Retrieve queued or processing image generation requests # Restart Server Source: https://docs.modelslab.com/enterprise-api/text-to-image/restart-server POST /enterprise/restart_server This endpoint is used to restart your dedicated server. ## Request Send a `POST` request to below endpoint to restart your dedicated server. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/restart_server' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Super Resolution Source: https://docs.modelslab.com/enterprise-api/text-to-image/super-resolution This endpoint returns a super resolution version of an image. ## Request Send a `POST` request to below endpoint to return an upscaled version of the initial image. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/super_resolution' \ ``` Want more upscale models? Request a custom model by contacting us at our [Discord](https://discord.gg/RjVZfAnhsq) server. The following upscale models are supported: | Model ID | Description | | :-------------------------------- | :-------------------------- | | **RealESRGAN\_x4plus** | 4x upscaling model | | **RealESRNet\_x4plus** | 4x upscaling model | | **RealESRGAN\_x4plus\_anime\_6B** | 4x Anime upscaling model | | **RealESRGAN\_x2plus** | 2x upscaling model | | **realesr-general-x4v3** | 4x upscaling general model | | **ultra\_resolution** | 4K+ upscaling general model | ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key", "url": "https://assets.modelslab.ai/generations/dbb83c34-72b7-4965-886b-52b8dbbb1f4b", "scale": 3, "webhook": null, "face_enhance": true } ``` ## Body Attributes Your API Key used for request authorization. The URL of the image you want to upscale to super resolution. The scale factor for upscaling. Must be between 1 and 4. The upscale model to use. Default: realesr-general-x4v3. A webhook URL to receive a POST callback once the image generation is complete. Enable face enhancement in the upscaled image. Default: false. # Sync Model Source: https://docs.modelslab.com/enterprise-api/text-to-image/sync-model This endpoint allows users to sync models between two enterprise servers. ## Request Send a `POST` request to below endpoint to sync models of one enterprise server with another server ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/sync_models' \ ``` ## Body Attributes Your enterprise API Key used for request authorization. The enterprise API Key of the second server you want to sync with. ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key", "sync_key": "enterprise_api_key" } ``` # System Details Source: https://docs.modelslab.com/enterprise-api/text-to-image/system-details POST /enterprise/system_details This endpoint is used to retrieve system details. ## Request Send a `POST` request to below endpoint to get information about your server. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/system_details' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Text to Image Source: https://docs.modelslab.com/enterprise-api/text-to-image/text2img This endpoint allows users to generate images from text prompts. ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/text2img' \ ``` To use the **load balancer**, you need to have **more than 1 server**. Pass the first server's API key, and it will handle the load balancing with the other servers. You can also use multi Lora. Just make sure to pass comma saparated lora model ids to the `lora_model` as `"more_details,animie"` in the request body. You can find a list of the public models available and their IDs **[here](https://modelslab.com/models)**. ## Schedulers This endpoint also supports schedulers. Use the "scheduler" parameter in the request body to pass a specific scheduler from the list below: * DDPMScheduler * DDIMScheduler * PNDMScheduler * LMSDiscreteScheduler * EulerDiscreteScheduler * EulerAncestralDiscreteScheduler * DPMSolverMultistepScheduler * HeunDiscreteScheduler * KDPM2DiscreteScheduler * DPMSolverSinglestepScheduler * KDPM2AncestralDiscreteScheduler * UniPCMultistepScheduler * DDIMInverseScheduler * DEISMultistepScheduler * IPNDMScheduler * KarrasVeScheduler * ScoreSdeVeScheduler * LCMScheduler ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key", "model_id": "model_id", "prompt": "ultra realistic close up portrait ((beautiful pale cyberpunk female with heavy black eyeliner)), blue eyes, shaved side haircut, hyper detail, cinematic lighting, magic neon, dark red city, Canon EOS R3, nikon, f/1.4, ISO 200, 1/160s, 8K, RAW, unedited, symmetrical balance, in-frame, 8K", "negative_prompt": "painting, extra fingers, mutated hands, poorly drawn hands, poorly drawn face, deformed, ugly, blurry, bad anatomy, bad proportions, extra limbs, cloned face, skinny, glitchy, double torso, extra arms, extra hands, mangled fingers, missing lips, ugly face, distorted face, extra legs, anime", "width": "512", "height": "512", "samples": "1", "num_inference_steps": "20", "safety_checker": "no", "enhance_prompt": "yes", "seed": null, "guidance_scale": 7.5, "panorama": "no", "self_attention": "no", "upscale": "no", "lora_model": null, "clip_skip": "2", "tomesd": "yes", "use_karras_sigmas": "yes", "vae": null, "lora_strength": null, "scheduler": "UniPCMultistepScheduler", "webhook": null, "track_id": null } ``` ## Body Attributes Your enterprise API Key used for request authorization. The ID of the model to be used. It can be public or your trained model. Text prompt describing the image you want to generate. Items you don’t want in the image. Width of the generated image. Maximum: 1024. Height of the generated image. Maximum: 1024. Number of images to return. Maximum: 4. Number of denoising steps. Allowed values: 21, 31, or 41. NSFW checker. If detected, replaces the image with blank. Default: yes. Action if NSFW content is detected. Default: sensitive\_content\_text. Enhance prompts for better results. Default: yes. Seed for reproducibility. Pass null for random generation. Scale for classifier-free guidance. Generate a panorama image. Default: no. Enable self-attention for higher quality images (slower). Default: no. Upscale generated images 2×. Default: no. Enable ToMeSD for faster generation. Default: yes. Use Karras sigmas for improved results. Default: yes. Algorithm type used in DPMSolverMultistepScheduler. Default: none. Custom VAE to use. Default: null. LoRa strength(s). Multiple values supported, comma-separated. Range: 0.1–1. LoRa model(s) to use. Multiple supported, comma-separated. Example: contrast-fix,yae-miko-genshin. Scheduler to use. See Schedulers. URL to receive a POST callback once image generation is complete. ID returned in webhook callback to identify the request. Clip Skip value. Range: 1–8. Return response as base64 string. Default: no. Apply high-resolution fix for generated images. Default: no. Generate a temporary image link valid for 24 hours. Default: no. # Update Server Source: https://docs.modelslab.com/enterprise-api/text-to-image/update-server POST /enterprise/update_server This endpoint is used to update your dedicated server. ## Request Send a `POST` request to below endpoint to update your dedicated server. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/update_server' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Upload Image Source: https://docs.modelslab.com/enterprise-api/text-to-image/upload-image This endpoint allows users to upload images to their S3 bucket. You should have your own S3 bucket to use this endpoint. Make sure you are passing the image in `base64` format. ## Request Send a `POST` request to below endpoint. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/upload_image' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key", "base64_image": "iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAACXBIWXMAAA7DAAAOwwHHb6hkAAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAABe1JREFUaIHdms9PVFcUxz/zA2YhFRAUQVjVH1EXVBFIEBxNq2n/BKMB2RgDahCCCxOX/gG17YYfUVmYxh9VlCC1QcFGg4mKdmGi/ZGgLkQYQKogkJnbxZkH782bx7w3zDBtT3Iyc+fec+75zrv33HPOfS4SQx5gO7An/LkJWA9kRIz7APwBvAAeA33AEyCYIDvipjLge2AUUHHyaFhH6TLbDsA3wK92DM3OFrYzFrgH7FsOABuBX6IZUVSEqqlBtbejBgZQ4+MopYw8NiZ9bW2o6mrUunWWgHqADckA4AKagE/6CX0+VG0t6t49VChkNjwWh0Kovj7UoUOo9HQTmE9AQ3juhFAmcEM/ideLOnoU9eaNc+Ot+PVrVH296I4AdB1YuVQQa4FBveLyctSzZ4kDEMlPn6JKS01gHgN5SwHxu6bM5UI1N6NmZ5MHQuPZWVRjo8ypA/MyHjArEf+uAOXxyCZONoBI7uhApaUZwPwGZNkF4QJuasJpaajOzuUHofG1a6Z9cx2bDqAJ3XLq6EgdCI3PnTMtsxOxQGxA52JPnkw9CI0bG02uedNiQOYPu/Ly5dnYdnl21uTNfrYC8bU2yOtNrouNlwcHxfHowEQNZ+Zjp2PHUm+0FdfVGYD0R4Io0zp9Pmcn9rt3Anz3btSJE6hAILZMICBj/X7U8eOiw+58r16ZwpkdeiA/aB21tfaVTk2hNm82nsLbti2+t2ZmUMXFRpktW1DT0/bnrakxyJ/VQHjQ5RP9/fYVdnWJTE6OhOqZmdLu7bWW6e2VMVlZIrNqlbS7uuzPe+eOAcgw4HYjGV0OQGEhVFVZ+QIzffwon+npMD4OPp+0p6acy2i/2yG/H/Lz55trgC8AThJGV1PjbOONjKByc43LJD8fNTFhLTMxIWP0MqtXo0ZHnc198KBBR5P2RADYtcv+vwKQmwu3bkFFBaxYIfI9PZCZaS2TmSkyVVUis3MndHdDTo6zuf1+Q7ME4ClhZAMDiXeXyeL7941hvgv4m3C1Y2wMsrOd/TOpokBAVkSYJl1ACHB5PDA3B66EJZbJJaXA64VQSJpuwiFxRsZ/BwSIrRkLVTOXO4W2JJT+V0vrA0AwCBMTqTTNGQUC8yAAJt3AX1rr5Uv7ivr6oLISTp1amkGhEOzfDwUFcPmyfbkIW/8E+JGwP3ZSYPD7F/x4d3f858HFiwt6Kivty7W0GM6Ri26kZgRAvym6t6aSkoXvDQ0wOWlfVqOREWhuXmjv3WtfNsLWxyDxvAJUYaH90ufw8EK0C6iqquj1Xit++xa1ffuCfF4e6v17e7LBoCle2wYSxo9oPzoJ469cMVY3iopQly7JRFYyc3Oo8+fFcE3O7Ubdvm1/Xi0VCPNbYP4Y+U7rcJJYKYU6e9ZUqlFFRVLHbW9H3byJunFD1vThw+bI1+NxXnKqrjbo+Fa/xkq1Dp9PCspOFHd2otassbwisOTCwsWTsGg8NGRKdUuIoH6ts77eufcJBFCnT0tuEQtAQQHqzBnU5KTzeY4cMei6qxmvP8f3Ea4Veb3w6BEUF0dijU3BoHiUhw/h+XPJAt1uiaq3bpXcpaIinJs6pMFBKC2VOcL0FdAbbWwPYbSlpf+uAt3MDGrHDsPT6F4M9HpgWhvc1JR6ABo3NJhKphtjPcEGTcDlkgJyqkG0tZk84/FYIED2zXVNyOuV0n6qQFy9arpWuIqDe8XPkGN/3te3ti4/iAsXTCAeYX4JISblIddd88usqWl5HMDMjOyJiOX0AqlhxUV5+icDqLIyqYonC8STJybvpD2JuEFotBLdniG8b+rqnEcAi/HQkBx2EdcGCviJOJaTFbmQ6y7DCwPp6VKdvHt38UDRioNBCVGqq6O+MDCNeKekJN8b0B2aes7PlzJmayvqwYPoJdDRUelraUEdOIBau9YyjOlGzrSk017kFaWYcVVWlrCdsUjs9OVyAIikEiSMHrZpaDQeDuswRbFOKFHrz42U9vcgGedG4HPkPRY9vUcKBdqLZ3eAZ0hJakn0DwRcaPWWv+9kAAAAAElFTkSuQmCC", "image_type": "png" } ``` ## Body Attributes Your enterprise API Key used for request authorization. The base64-encoded string of the image to be uploaded. The extension or type of the image. Options: png, jpeg, jpg. # Verify Model Source: https://docs.modelslab.com/enterprise-api/text-to-image/verify-model This endpoint allows users to verify if a specific model exists. ## Request Send a `POST` request to below endpoint to verify if a certain model exists on your dedicated server. Specify the model by using the **model\_id** parameter in the request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/verify_model' \ ``` ## Body Attributes Your enterprise API Key used for request authorization. The ID of the model to be verified. ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key", "model_id": "ckpt-model" } ``` # Clear Cache Source: https://docs.modelslab.com/enterprise-api/text-to-speech/clear-cache POST /enterprise/text_to_speech/clear_cache This endpoint is used to clear the API's cache. ## Request Send a `POST` request to below endpoint to clear the API's cache. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/text_to_speech/clear_cache' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Clear Queue Source: https://docs.modelslab.com/enterprise-api/text-to-speech/clear-queue POST /enterprise/text_to_speech/clear_queue This endpoint is used to clear the API's queue. ## Request Send a `POST` request to below endpoint to clear the API's cache. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/text_to_speech/clear_queue' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Fetch Audio Source: https://docs.modelslab.com/enterprise-api/text-to-speech/fetch-audio POST /enterprise/text_to_speech/fetch/{id} This endpoint is used to fetch a queued audio. ## Request Send a `POST` request to below endpoint to return the corresponding queued audio. Where `{id}` is the ID returned together with the audio URL in the response upon its generation. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/text_to_speech/fetch/{id}' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Enterprise Text to Speech API Source: https://docs.modelslab.com/enterprise-api/text-to-speech/overview Enterprise text-to-speech on dedicated GPU servers. High-quality voice synthesis with private infrastructure and full server management. Not on Enterprise yet? Get your enterprise plan at [ModelsLab](https://modelslab.com/enterprise) ## Available Endpoints This endpoint generates and returns an audio file from a text prompt using the Text to Speech model. This endpoint fetches already generated or queued audio by ID. This endpoint clears the server cache. This endpoint clears the server queue. This endpoint restarts the server. This endpoint retrieves system and server details. This endpoint updates the server to the latest version. # Restart Server Source: https://docs.modelslab.com/enterprise-api/text-to-speech/restart-server POST /enterprise/text_to_speech/restart_server This endpoint is used to restart your dedicated server. ## Request Send a `POST` request to below endpoint to restart your dedicated server. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/text_to_speech/restart_server' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # System Details Source: https://docs.modelslab.com/enterprise-api/text-to-speech/system-details POST /enterprise/text_to_speech/system_details This endpoint is used to get information about your server. ## Request Send a `POST` request to below endpoint to get information about your server. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/text_to_speech/system_details' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Text to Speech Source: https://docs.modelslab.com/enterprise-api/text-to-speech/text-to-speech Generate Speech by providing a text input along with a pre trained voice. ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/text_to_speech/make' \ ``` ## Emotion Support Emotion support is currently only available in English (`en`) language. When emotion is enabled, you can use special tags in your text prompt to add expressive elements to the generated speech. ### Available Emotion-Supported Voices #### Female Voices * Tara * Leah * Jess * Mia * Zoe #### Male Voices * Leo * Dan * Zac #### Supported Emotion Tags The following emotion tags can be added to speech prompts to enhance expressiveness: | Tag | Description | | ----------- | ---------------------------------------------------- | | `` | Adds a laughing effect | | `` | A soft chuckle for a subtle humorous tone | | `` | Expresses disappointment, relief, or tiredness | | `` | Simulates a short cough | | `` | Mimics a sniffle, indicating sadness or a cold | | `` | Adds a groaning effect for frustration or discomfort | | `` | Simulates yawning to express boredom or tiredness | | `` | Expresses shock or surprise | ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key", "prompt":"Build next-generation AI products without worrying about GPUs", "language":"american english", "voice_id":"madison", "speed":1, "emotion":false } ``` ## Body Attributes API key for authentication. Text prompt describing audio to be generate Max len `2500` chars. ID of trained voice [Find Pretrained Voices Here](https://modelslab.com/trained-voice-lists). Language for the voice.\ Allowed values: `american english`, `british english`, `spanish`, `japanese`, `mandarin chinese`, `french`, `brazilian portuguese`, `hindi`, `italian`. Playback speed of generated audio. Enable emotion support (English only). Use temporary links valid for 24 hours. URL to receive POST notification upon completion. ID for webhook identification. # Update Server Source: https://docs.modelslab.com/enterprise-api/text-to-speech/update-server POST /enterprise/text_to_speech/update_server This endpoint is used to update your dedicated server. ## Request Send a `POST` request to below endpoint to update your dedicated server. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/text_to_speech/update_server' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Clear Cache Source: https://docs.modelslab.com/enterprise-api/text-to-video-ultra/clear-cache POST /text-to-video-ultra/clear_cache This endpoint is used to clear the API's cache. ## Request Send a `POST` request to below endpoint to clear the API's cache. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/ultra_video/clear_cache' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Clear Queue Source: https://docs.modelslab.com/enterprise-api/text-to-video-ultra/clear-queue POST /text-to-video-ultra/clear_queue This endpoint is used to clear the API's queue. ## Request Send a `POST` request to below endpoint to clear the API's cache. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/ultra_video/clear_queue' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Fetch Video Source: https://docs.modelslab.com/enterprise-api/text-to-video-ultra/fetch-video POST /text-to-video-ultra/fetch/{id} This endpoint is used to fetch a queued video. ## Request Send a `POST` request to below endpoint to return the corresponding queued videos. Where `{id}` is the ID returned together with the image URL in the response upon its generation. This endpoint does not generate new video, it returns already generated/queued videos. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/ultra_video/fetch/{id}' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Enterprise Text to Video Ultra API Source: https://docs.modelslab.com/enterprise-api/text-to-video-ultra/overview High-quality text-to-video generation on dedicated enterprise GPU servers. Ultra model video generation with full server management. ## Endpoints Generate ultra-high quality video from a text prompt Retrieve queued or processing video generation requests Clear the API's server cache for fresh processing Restart your dedicated video generation server Get information about your server status and performance Update your dedicated server to the latest version # Restart Server Source: https://docs.modelslab.com/enterprise-api/text-to-video-ultra/restart-server POST /text-to-video-ultra/restart_server This endpoint is used to restart your dedicated server. ## Request Send a `POST` request to below endpoint to restart your dedicated server. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/ultra_video/restart_server' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # System Details Source: https://docs.modelslab.com/enterprise-api/text-to-video-ultra/system-details POST /text-to-video-ultra/system_details This endpoint is used to retrieve system details. ## Request Send a `POST` request to below endpoint to get information about your server. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/ultra_video/system_details' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Text to Video Ultra Source: https://docs.modelslab.com/enterprise-api/text-to-video-ultra/text-to-video-ultra This endpoint is used to generate HD video from a given text prompt. ![Text to Video Ultra Example](https://assets.modelslab.ai/generations/cfb0211d-cc6f-4835-ab2a-41acc498bb8a.png) ## Request Make a `POST` request to below endpoint and pass the required parameters in the request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/ultra_video/text2video' \ ``` ## Body When the model\_id is `Wan2.2`, the request json looks like so, ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key":"enterprise_api_key", "prompt":"Space Station in space", "negative_prompt":"low quality", "resolution":480, "num_frames":92, "num_inference_steps":8, "guidance_scale": 1.0, "shift_sample":3, "fps":18, "webhook": null, "track_id":null } ``` ## Body Attributes Your API Key used for request authorization. Text prompt with a description of the things you want in the video to be generated. Items you don't want in the video. Seed is used to reproduce results. The same seed will give you the same video again. Pass null for a random number. The resolution of the generated output. Maximum is 480. The number of frames in the generated video. Default is 92. Number of denoising steps. Default is 8. Maximum is 8. Scale for classifier-free guidance. Minimum is 1.0, maximum is 2.0. Frames per second rate of the generated video. Must be less than num\_frames. Maximum is 18. Indicates whether the output should be in portrait mode. Options: true/false. Controls the sampling shift in the generation process. Default is 3. If true, stores the video in temporary storage (cleaned every 24 hours). Default is false. A URL to receive a POST API call once the video generation is complete. A unique ID used in the webhook response to identify the request. # Update Server Source: https://docs.modelslab.com/enterprise-api/text-to-video-ultra/update-server POST /text-to-video-ultra/update_server This endpoint is used to update your dedicated server. ## Request Send a `POST` request to below endpoint to update your dedicated server. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/ultra_video/update_server' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Clear Cache Source: https://docs.modelslab.com/enterprise-api/video/clear-cache POST /enterprise/video/clear_cache This endpoint is used to clear the API's cache. ## Request Send a `POST` request to below endpoint to clear the API's cache. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/video/clear_cache' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Clear Queue Source: https://docs.modelslab.com/enterprise-api/video/clear-queue POST /enterprise/video/clear_queue This endpoint is used to clear the API's queue. ## Request Send a `POST` request to below endpoint to clear the API's cache. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/video/clear_queue' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Fetch Video Source: https://docs.modelslab.com/enterprise-api/video/fetch-video POST /enterprise/video/fetch/{id} This endpoint is used to fetch a queued video. ## Request Send a `POST` request to below endpoint to return the corresponding queued videos. Where `{id}` is the ID returned together with the image URL in the response upon its generation. This endpoint does not generate new video, it returns already generated/queued videos. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/video/fetch/{id}' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Image to Video Source: https://docs.modelslab.com/enterprise-api/video/img-to-video This endpoint is used to convert images into videos. Make sure you add your [s3 details](/enterprise-api/general/update-s3-details) for `video` server, so you can receive image generated in your bucket. Images generated without s3 details being added will be delete after **24 hours** Text to video endpoint result ## Request Make a `POST` request to below endpoint and pass the required parameters in the request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/video/img2video' \ ``` ## Body Attributes Your unique API key used for authorization. The ID of the model to use. Allowed values: svd. Items you do not want in the video. Enhance prompts for better results. Options: yes/no. A link or base64 equivalent of a valid PNG, JPEG, or other image format file to use as initial image conditioning. The height of the video in pixels. Maximum: 512. The width of the video in pixels. Maximum: 512. The number of frames in the generated video. Default: 16, Maximum: 25. The number of denoising steps. Default: 20, Maximum: 50. The start value of the guidance scale for video generation when using svd as the model. The end value of the guidance scale for video generation when using svd as the model. Higher values lead to more motion in generated videos. Default: 127. The strength for noise initialization when using svd as the model. Frames per second rate of the generated video. Maximum: 16. The output type of the video. Options: mp4, gif, base64. The interpolation method for generating the video. Default: lerp. The number of CLIP layers to skip. Default: null. Maximum: 2. If true, returns an instant response with future links for queued requests instead of waiting for processing. If true, stores generations in temporary storage. Temporary files are cleaned every 24 hours. Provide a URL to receive a POST API call once the video generation is complete. This ID is returned in the response to the webhook API call and will be used to identify the webhook request. ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key":"enterprise_api_key", "model_id":"svd", "init_image": "https://imagedelivery.net/PP4qZJxMlvGLHJQBm3ErNg/e2f9cb8e-cb87-4143-dd81-a9e77e3bb800/768", "height":512, "width":512, "num_frames":16, "num_inference_steps":20, "min_guidance_scale":1, "max_guidance_scale":3, "motion_bucket_id":20, "noise_aug_strength":0.02, "base64":false, "webhook":null, "track_id":null} ``` # Enterprise Video API Source: https://docs.modelslab.com/enterprise-api/video/overview Enterprise video generation on dedicated GPU servers. Text-to-video and image-to-video with private infrastructure and full server control. ## Endpoints Generate a video from a text prompt using trained or public models Generate a video from an image input Retrieve queued or processing video generation requests Clear the API’s server cache for fresh processing Restart your dedicated video generation server Get information about your server status and performance Update your dedicated server to the latest version # Restart Server Source: https://docs.modelslab.com/enterprise-api/video/restart-server POST /enterprise/video/restart_server This endpoint is used to restart your dedicated server. ## Request Send a `POST` request to below endpoint to restart your dedicated server. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/video/restart_server' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # System Details Source: https://docs.modelslab.com/enterprise-api/video/system-details POST /enterprise/video/system_details This endpoint is used to get information about your server. ## Request Send a `POST` request to below endpoint to get information about your server. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/video/system_details' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Text to Video Source: https://docs.modelslab.com/enterprise-api/video/text-to-video This endpoint is used to generate a video from a text description. Make sure you add your [s3 details](/enterprise-api/general/update-s3-details) for `video` server, so you can receive video generated in your bucket. videos generated without s3 details being added will be delete after **24 hours** ## Request ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/video/text2video' \ ``` ## Body Attributes ## Attributes Your unique API key used for authorization. The ID of the model to use. Allowed values: cogvideox. The text prompt describing the content you want in the generated video. Items you do not want in the video. The seed used to reproduce results. Pass null for a random number. The height of the video. Maximum: 512 pixels. The width of the video. Maximum: 512 pixels. The number of frames in the generated video. Default: 16, Maximum: 25. The number of denoising steps. Default: 20, Maximum: 50. The scale for classifier-free guidance. Range: 0–8. The number of CLIP layers to skip. A value of 2 leads to more aesthetic results. Default: null. The height to upscale the video to when using the zeroscope model. Default: 1024. The width to upscale the video to when using the zeroscope model. Default: 1024. The strength for upscaling. Higher strength can lead to more differences between the generated and upscaled video. The guidance scale for upscaling the video when using the zeroscope model. The number of denoising steps for upscaling the video when using the zeroscope model. Default: 20. Whether to use an improved sampling technique. Leads to better results with higher temporal consistency at the cost of slower performance. The seed for consistent video generation when using the improved sampling technique. The frames per second rate of the generated video. Maximum: 16. The output type of the video. Options: mp4 or gif. If true, returns an instant response with future links for queued requests instead of waiting for processing. If true, stores generations in temporary storage. Temporary files are cleaned every 24 hours. Provide a URL to receive a POST API call once the video generation is complete. ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key":"enterprise_api_key", "model_id":"cogvideox", "prompt":"Space Station in space.", "negative_prompt":"low quality", "height":512, "width":512, "num_frames":16, "num_inference_steps":20, "guidance_scale":7, "upscale_height":1024, "upscale_width":1024, "upscale_strength":0.6, "upscale_guidance_scale":8, "upscale_num_inference_steps":20, "output_type":"gif", "webhook":null, "track_id":null } ``` # Update Server Source: https://docs.modelslab.com/enterprise-api/video/update-server POST /enterprise/video/update_server This endpoint is used to update your dedicated server. ## Request Send a `POST` request to below endpoint to update your dedicated server. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/video/update_server' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Clear Cache Source: https://docs.modelslab.com/enterprise-api/voice-cloning/clear-cache POST /voice-cloning/clear_cache This endpoint is used to clear the API's cache. ## Request Send a `POST` request to below endpoint to clear the API's cache. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/voice/clear_cache' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Clear Queue Source: https://docs.modelslab.com/enterprise-api/voice-cloning/clear-queue POST /voice-cloning/clear_queue This endpoint is used to clear the API's queue. ## Request Send a `POST` request to below endpoint to clear the API's cache. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/voice/clear_queue' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Fetch Voice Source: https://docs.modelslab.com/enterprise-api/voice-cloning/fetch POST /voice-cloning/fetch/{id} This endpoint is used to fetch queued voice. ## Request Send a `POST` request to below endpoint to return the corresponding queued images. Where `{id}` is the ID returned together with the image URL in the response upon its generation. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/voice/fetch/{id}' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # MusicGen Source: https://docs.modelslab.com/enterprise-api/voice-cloning/music-gen This endpoint is used to generate music based on textual prompts. Make sure you add your [s3 details](/enterprise-api/general/update-s3-details) for `voice_cloning` server, so you can receive image generated in your bucket. Images generated without s3 details being added will be delete after **24 hours** ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/voice/music_gen' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key":"enterprise_api_key", "prompt":"rock music from the 90s", "init_audio":"https://youtu.be/7Nm6uTHbB-Y?si=ORk1LOQ8J34Z0Lpm", "sampling_rate":32000, "base64":false, "temp": false, "webhook":null, "track_id":null } ``` ## Body Attributes Your API Key used for request authorization. The input text for audio generation. The conditioning melody for audio generation. The sampling rate of the generated audio. Lower bound: 10000, Default: 32000. No strict upper bound. The maximum number of new tokens for audio generation. Range: 256–1024. Whether the input sound clip is in base64 format. Default: false. Whether you want temporary links (useful if your country blocks access to storage sites). Default: false. Allows you to specify the output format of the generated audio. Options: wav, mp3, flac. Default: wav. The bitrate of the generated audio file. Higher bitrates improve quality but increase file size. Default: 128k. Provide a URL to receive a POST API call once the audio generation is complete. This ID is returned in the response to the webhook API call and will be used to identify the webhook request. # Enterprise Voice Cloning API Source: https://docs.modelslab.com/enterprise-api/voice-cloning/overview Enterprise voice cloning and audio generation on dedicated GPU servers. TTS, voice-to-voice, music gen, and SFX with private infrastructure. ## Endpoints Generate audio from text using a cloned voice or a selected voice model Clone a voice from a target audio file Generate music based on text prompts or conditioning melodies Generate sound effects (SFX) from text prompts Transform a song or audio file into a different voice using a provided model Upload a voice recording to use in cloning or synthesis Convert speech from audio into text Retrieve queued or processing voice cloning requests Clear the API’s server cache for fresh processing Restart your dedicated voice cloning server Get information about your server status and performance Update your dedicated server to the latest version # Restart Server Source: https://docs.modelslab.com/enterprise-api/voice-cloning/restart-server POST /voice-cloning/restart_server This endpoint allows you to restart your dedicated voice server. ## Request Send a `POST` request to below endpoint to restart your dedicated server. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/voice/restart_server' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Sound Effects (SFX) Source: https://docs.modelslab.com/enterprise-api/voice-cloning/sfx This endpoint allows you to generate sound effects (SFX) from text prompts. Make sure you add your [s3 details](/enterprise-api/general/update-s3-details) for `voice_cloning` server, so you can receive image generated in your bucket. Images generated without s3 details being added will be delete after **24 hours** ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/voice/sfx' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key":"enterprise_api_key", "prompt":"Thunderstorm with rain", "output_format": "wav", "bitrate": "128k", "temp": false, "webhook": null, "track_id": null } ``` ## Body Attributes The API key required to authorize the request. A descriptive input that specifies the type of sound effect to generate. The length of the generated sound effect in seconds. Defaults to 10. Range: 3–15 seconds. Whether to generate temporary links (useful for regions blocking storage site access). Default: false. The output format of the generated sound effect. Options: wav, mp3, flac. Default: wav. The bitrate of the generated sound effect. Higher bitrates improve quality but increase file size. Default: 128k. # Speech To Text Source: https://docs.modelslab.com/enterprise-api/voice-cloning/speech-to-text This endpoint allows you to convert speech in audio files to text. ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/voice/speech_to_text' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key", "init_audio": "https://assets.modelslab.ai/generations/5c3eef10-0eb4-4db8-8b12-fc4eedbf30b9.mp3", "language": "en", "timestamp_level": null, "webhook": null, "track_id": null } ``` ## Body Attributes The API key required to authorize the request. The URL of the audio file to be transcribed.\ Supported formats: WAV, MP3, FLAC, OPUS.\ Duration limits: minimum 5 seconds, maximum 1 hour. The language code of the audio content in ISO 639-1 format. Examples: en (English), es (Spanish), fr (French). The level of detail for timestamps in the transcription. Options: word, sentence, or null (no timestamps). Default: null. **Timestamp Level Accuracy:** Sentence-level timestamps work well and provide reliable results. However, word-level timestamps may not be accurate and may provide less reliable results. A URL to receive a POST request once the transcription is complete. An ID included in the webhook response to identify the request. ### Languages Supported Whisper supports several languages, but performance may vary due to factors like limited training data, script complexity, and regional dialects, potentially affecting transcription accuracy. ``` "Afrikaans": "af", "Arabic": "ar", "Belarusian": "be", "Bengali": "bn", "Bulgarian": "bg", "Chinese": "zh", "Czech": "cs", "Danish": "da", "Dutch": "nl", "English": "en", "Finnish": "fi", "French": "fr", "German": "de", "Greek": "el", "Hebrew": "he", "Hindi": "hi", "Hungarian": "hu", "Indonesian": "id", "Italian": "it", "Japanese": "ja", "Kannada": "kn", "Korean": "ko", "Malayalam": "ml", "Marathi": "mr", "Nepali": "ne", "Panjabi": "pa", "Persian": "fa", "Polish": "pl", "Portuguese": "pt", "Romanian": "ro", "Russian": "ru", "Serbian": "sr", "Spanish": "es", "Swedish": "sv", "Tagalog": "tl", "Tamil": "ta", "Telugu": "te", "Thai": "th", "Turkish": "tr", "Ukrainian": "uk", "Urdu": "ur", "Vietnamese": "vi", "Welsh": "cy" ``` **Performance may vary due to factors like script complexity, and regional dialects, which may affect transcription accuracy.** # System Details Source: https://docs.modelslab.com/enterprise-api/voice-cloning/system-details POST /voice-cloning/system-details This endpoint returns information about your server. ## Request Send a `POST` request to below endpoint to get information about your server. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/voice/system_details' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Voice cloning Source: https://docs.modelslab.com/enterprise-api/voice-cloning/text-to-audio The Voice cloning endpoint enables you to generate audio by providing a text input along with a valid audio URL or a pre-created voice using a voice_id. Make sure you add your [s3 details](/enterprise-api/general/update-s3-details) for `voice_cloning` server, so you can receive image generated in your bucket. Images generated without s3 details being added will be delete after **24 hours** [voice\_id](https://modelslab.com/voice-lists) can be found here. ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/voice/text_to_audio' \ ``` You can either pass `init_audio` or `voice_id`. However, if both are passed at the same time the `init_audio` takes preference. ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enteprise_api_key", "prompt":"Narrative voices capable of pronouncing terminologies & acronyms in training and ai learning materials.", "init_audio":"https://assets.modelslab.ai/generations/d5b64159-b9cc-4342-996e-ebde7e7e35c0.mp3", "language":"english", "webhook": null, "track_id": null } ``` ## Body Attributes Your API Key used for request authorization. Text prompt with description of the audio you want to generate. A valid audio URL to be voice-cloned. Minimum length: 4 seconds, Maximum length: 30 seconds. Optional. ID of voice from available list Find Voice IDs Here. The language of the voice. Default: english. The emotional tone of the generated voice. Options: neutral, happy, sad, angry, dull. Default: neutral. Whether the input sound clip is in base64 format. Default: false. Whether you want temporary links (useful if your country blocks access to storage sites). Default: false. Provide a URL to receive a POST API call once the audio generation is complete. This ID is returned in the response to the webhook API call and will be used to identify the request. # Update Server Source: https://docs.modelslab.com/enterprise-api/voice-cloning/update-server POST /voice-cloning/update-server This endpoint is used to update your dedicated server. ## Request Send a `POST` request to below endpoint to update your dedicated server. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/voice/update_server' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Voice Cover Source: https://docs.modelslab.com/enterprise-api/voice-cloning/voice-cover The Voice Cover endpoint allows you to transform a song or audio file into a different voice using a provided model ID. Make sure you add your [s3 details](/enterprise-api/general/update-s3-details) for `voice_cloning` server, so you can receive image generated in your bucket. Images generated without s3 details being added will be delete after **24 hours** Find all available voice models [HERE](https://modelslab.com/models/category/voice-cloning). ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/voice/voice_cover' \ ``` ## Example[​](#example "Direct link to Example") ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key", "init_audio": "https://music.youtube.com/watch?v=aZ1hziFhj1o", "model_id": "zoro", "pitch": "none", "rate": 0.5, "radius": 3, "mix": 0.25, "algorithm": "rmvpe", "hop_length": 128, "originality": 0.5, "lead_voice_volume_delta": "+1", "backup_voice_volume_delta": "-2", "instrument_volume_delta":"+2", "reverb_size": 0.15, "wetness": 0.2, "dryness": 0.8, "damping": 0.7, "base64": false, "temp": false, "webhook": null, "track_id" : null } ``` ## Body Attributes Your API Key used for request authorization. URL (YouTube links supported) or valid .wav file base64 data whose audio you want to clone with the model. ID of the voice cover model Find Models Here. Voice pitch conversion. Options:
  • m2f: Male-to-Female
  • f2m: Female-to-Male
  • none: No pitch conversion
Pitch detection algorithm. Default: rmvpe. Rate of control for generated voice leakage. Higher values bias model towards training data. Default: 0.5. Seed for reproducibility. Same seed gives the same output. Pass null for a random seed. The language of the cloned voice. Default: english. Emotional tone of the generated voice. Default: neutral. Floating point value for playback speed of the speaker. Default: 1.0. Median filtering length to reduce breathiness and artifacts. Default: 3. Mix between original loudness and fixed loudness. Default: 0.25. Hop length for pitch changes (only applies when using mangio-crepe). Controls similarity to original vocals (voiceless consonants). Default: 0.33. Adjust lead vocals volume. Range: -5 (decrease) to +5 (increase). Adjust backup vocals volume. Range: -5 (decrease) to +5 (increase). Adjust instrumental volume. Range: -5 (decrease) to +5 (increase). Reverb room size. Default: 0.15. Reverb for generated vocals. Default: 0.2. Reverb for original vocals. Default: 0.8. High-frequency damping factor in reverb. Default: 0.7. Whether the input sound clip is in base64 format. Default: false. Whether you want the output to be auto-deleted from the server after a short time. Default: false. A URL to receive a POST API call once the voice cloning process is complete. This ID is returned in the webhook callback to identify the request. # Voice to Voice Source: https://docs.modelslab.com/enterprise-api/voice-cloning/voice-to-voice This endpoint is used to clone a voice from a target audio file. Make sure you add your [s3 details](/enterprise-api/general/update-s3-details) for `voice_cloning` server, so you can receive image generated in your bucket. Images generated without s3 details being added will be delete after **24 hours** ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/voice/voice_to_voice' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key":"enterprise_api_key", "init_audio":"https://assets.modelslab.ai/generations/a9823a38-6c67-43f7-80a3-11e7eea504c0", "target_audio":"https://assets.modelslab.ai/generations/a9823a38-6c67-43f7-80a3-11e7eea504c0", "temp":false, "base64":false, "webhook":null, "track_id":null } ``` ## Body Attributes Your API Key used for request authorization. Source utterances. Must be a valid URL or base64 data for a WAV/MP3 file.\ Maximum length: 30 seconds. Target voice that should say the original utterances. Must be a valid URL or base64 data for a WAV/MP3 file.\ Maximum length: 30 seconds. Whether the input sound clips are provided in base64 format. Default: false. Whether you want temporary links (useful if your country blocks access to storage sites). Default: false. Provide a URL to receive a POST API call once the voice cover generation is complete. This ID is returned in the webhook API call and will be used to identify the request. # Voice Upload Source: https://docs.modelslab.com/enterprise-api/voice-cloning/voice-upload This endpoint is used to upload a voice. `voice_id` returned with [Text To Audio Endpoint](/enterprise-api/voice-cloning/text-to-audio) ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/voice/voice_upload' \ ``` ## Body Attributes Your API Key used for request authorization. Display name of the voice you want to upload. Audio URL of the voice sample. Only mp3 and wav are allowed.\ Recommended length: 10–25 seconds for best results. The language of the voice sample. It must match the actual spoken language of the uploaded audio. Default: english. ## Body ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key":"enterprise_api_key", "name":"Jacob", "init_audio":"https://assets.modelslab.ai/generations/5c3eef10-0eb4-4db8-8b12-fc4eedbf30b9.mp3", "language":"english" } ``` # Clear Cache Source: https://docs.modelslab.com/enterprise-api/z-image-turbo/clear-cache POST /flux/clear_cache This endpoint is used to clear the API's cache. ## Request Send a `POST` request to below endpoint to clear the API's cache. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/z_image_turbo/clear_cache' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Clear Queue Source: https://docs.modelslab.com/enterprise-api/z-image-turbo/clear-queue POST /flux/clear_queue This endpoint is used to clear the API's queue. ## Request Send a `POST` request to below endpoint to clear the API's cache. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/z_image_turbo/clear_queue' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Fetch Image Source: https://docs.modelslab.com/enterprise-api/z-image-turbo/fetch POST /flux/fetch Fetch Queued Images API fetches queued images for flux. ## Request Send a `POST` request to below endpoint to return the corresponding queued images. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/z_image_turbo/fetch/{id}' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Image to Image Source: https://docs.modelslab.com/enterprise-api/z-image-turbo/img2img This endpoint generates an image from a text prompt and init image using z image turbo model. Make sure you add your [s3 details](/enterprise-api/general/update-s3-details.mdx) for `flux` server, so you can receive image generated in your bucket. Images generated without s3 details being added will be delete after **24hours** ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/z_image_turbo/img2img' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key" : "enterprise_api_key", "prompt": "ultra realistic close up portrait ((beautiful pale cyberpunk female with heavy black eyeliner))", "negative_prompt": "bad quality", "init_image": "https://example.com/image.png", "width": "512", "height": "512", "safety_checker": false, "lora_model":null, "lora_strength":null, "seed": null, "samples":1, "base64":false, "webhook": null, "track_id": null } ``` ## Body Attributes Your API Key used for request authorization. Text prompt with description of the things you want in the image to be generated. Items you don't want in the image. URL of the initial image to use as a starting point for generation. Max Height: Width: 1024x1024. Max Height: Width: 1024x1024. Number of images to be returned in response. The maximum value is 2. Optional. LoRa models to use. Optional. Strength of the LoRa model(s). If multiple LoRa models, provide comma-separated values (0.1 to 1). A checker for NSFW images. If such an image is detected, it will be replaced by a blank image. Seed is used to reproduce results. Same seed will give you the same image again. Pass null for a random number. Queue response instantly before processing finishes instead of waiting a minimum amount of time. default: false, options: true or false. Get response as base64 string. default: false, options: true or false. Set a URL to get a POST API call once the image generation is complete. This ID is returned in the response to the webhook API call. This will be used to identify the webhook request. # Enterprise Z Image Turbo API Source: https://docs.modelslab.com/enterprise-api/z-image-turbo/overview Ultra-fast turbo image generation on dedicated enterprise GPU servers. Optimized text-to-image with full server management. Not on Enterprise yet? Get your enterprise plan at [ModelsLab](https://modelslab.com/enterprise) ## Available Endpoints This endpoint generates and returns an image from a text prompt using the Flux model. This endpoint generates an image from a text prompt and init image using the Z Image Turbo model. This endpoint fetches already generated or queued images by ID. This endpoint clears the server cache. This endpoint clears the server queue. This endpoint restarts the server. This endpoint retrieves system and server details. This endpoint updates the server to the latest version. # Restart Server Source: https://docs.modelslab.com/enterprise-api/z-image-turbo/restart-server POST /flux/restart_server This endpoint is used to restart your dedicated server. ## Request Send a `POST` request to below endpoint to restart your dedicated server. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/z_image_turbo/restart_server' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # System Details Source: https://docs.modelslab.com/enterprise-api/z-image-turbo/system-details POST /flux/system_details This endpoint returns information about your server. ## Request Send a `POST` request to below endpoint to get information about your server. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/z_image_turbo/system_details' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Text to Image Source: https://docs.modelslab.com/enterprise-api/z-image-turbo/text2img This endpoint generates an image from a text prompt using z image turbo model. Make sure you add your [s3 details](/enterprise-api/general/update-s3-details.mdx) for `flux` server, so you can receive image generated in your bucket. Images generated without s3 details being added will be delete after **24hours** ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/z_image_turbo/text2img' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key" : "enterprise_api_key", "prompt": "ultra realistic close up portrait ((beautiful pale cyberpunk female with heavy black eyeliner))", "negative_prompt": "bad quality", "width": "512", "height": "512", "safety_checker": false, "lora_model":null, "lora_strength":null, "seed": null, "samples":1, "base64":false, "webhook": null, "track_id": null } ``` ## Body Attributes Your API Key used for request authorization. Text prompt with description of the things you want in the image to be generated. Items you don't want in the image. Max Height: Width: 1024x1024. Max Height: Width: 1024x1024. Number of images to be returned in response. The maximum value is 2. Optional. LoRa models to use. Optional. Strength of the LoRa model(s). If multiple LoRa models, provide comma-separated values (0.1 to 1). A checker for NSFW images. If such an image is detected, it will be replaced by a blank image. Seed is used to reproduce results. Same seed will give you the same image again. Pass null for a random number. Queue response instantly before processing finishes instead of waiting a minimum amount of time. default: false, options: true or false. Get response as base64 string. default: false, options: true or false. Set a URL to get a POST API call once the image generation is complete. This ID is returned in the response to the webhook API call. This will be used to identify the webhook request. # Update Server Source: https://docs.modelslab.com/enterprise-api/z-image-turbo/update-server POST /flux/update_server This endpoint is used to update your dedicated server. ## Request Send a `POST` request to below endpoint to update your dedicated server. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v1/enterprise/z_image_turbo/update_server' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "enterprise_api_key" } ``` # Error Codes Source: https://docs.modelslab.com/error-codes Understanding and handling API errors ## Error Response Format When an error occurs, the API returns a JSON response with the following structure: ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "status": "error", "message": "Human-readable error description" } ``` Some legacy endpoints may return `messege` instead of `message`. Handle both fields for compatibility. ## HTTP Status Codes **Cause**: The request contains invalid parameters or is malformed. **Common Issues**: * Missing required parameter (e.g., `prompt`, `key`) * Invalid parameter type (e.g., string instead of number) * Parameter value out of allowed range * Malformed JSON in request body **Example Response**: ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "status": "error", "message": "prompt is required" } ``` **Solution**: Review your request parameters against the API documentation. Ensure all required fields are included and properly formatted. **Cause**: Authentication failed or API key is invalid. **Common Issues**: * Missing `key` parameter in request body * Invalid or revoked API key * Expired API key **Example Response**: ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "status": "error", "message": "Invalid API key" } ``` **Solution**: 1. Verify your API key is correct 2. Check the key is included in the request body 3. Ensure the key hasn't been revoked in your [dashboard](https://modelslab.com/dashboard/api-keys) **Cause**: Insufficient credits or expired subscription. **Example Response**: ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "status": "error", "message": "Insufficient credits. Please add more credits to continue." } ``` **Solution**: Add credits or renew your subscription from your [dashboard](https://modelslab.com/dashboard) or view [pricing plans](https://modelslab.com/pricing). **Cause**: The requested feature is not available on your current plan. **Example Response**: ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "status": "error", "message": "This feature requires a premium subscription" } ``` **Solution**: Upgrade your subscription to access this feature. **Cause**: You've exceeded your rate limit (queue limit). **Example Response**: ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "status": "error", "message": "Rate limit exceeded. Maximum 5 queued requests allowed.", "retry_after": 30 } ``` **Solution**: 1. Wait for current requests to complete 2. Implement exponential backoff in your code 3. Consider upgrading your plan for higher limits See [Rate Limits](/rate-limits) for plan-specific queue limits. **Cause**: An internal server error occurred during processing. **Example Response**: ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "status": "error", "message": "Internal server error. Please try again." } ``` **Solution**: 1. Wait a few seconds and retry the request 2. If the error persists, check the [status page](https://modelslab.com/status) 3. Contact [support](https://modelslab.com/support) if the issue continues **Cause**: The service is temporarily unavailable, usually due to high load or maintenance. **Example Response**: ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "status": "error", "message": "Service temporarily unavailable. Please try again later." } ``` **Solution**: Wait and retry with exponential backoff. Check the status page for any ongoing maintenance. ## Common Error Scenarios ### Missing Required Parameters ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} // Request missing prompt { "key": "your_api_key", "model_id": "flux" } // Response { "status": "error", "message": "prompt is required" } ``` ### Invalid Model ID ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} // Request with invalid model { "key": "your_api_key", "prompt": "A sunset", "model_id": "invalid_model_name" } // Response { "status": "error", "message": "Model not found: invalid_model_name" } ``` ### Image URL Issues ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} // Request with inaccessible image URL { "key": "your_api_key", "init_image": "https://example.com/image.jpg" } // Response { "status": "error", "message": "Unable to fetch image from provided URL" } ``` When using image URLs, ensure the image is publicly accessible and returns proper CORS headers. ## Handling Errors in Code ### Python ```python theme={"theme":{"light":"github-light","dark":"github-dark"}} import requests import time def make_api_request(payload, max_retries=3): url = "https://modelslab.com/api/v6/images/text2img" for attempt in range(max_retries): response = requests.post(url, json=payload) data = response.json() if response.status_code == 200: if data.get("status") == "success": return data["output"] elif data.get("status") == "processing": # Handle async processing return poll_for_result(data["id"]) elif response.status_code == 429: # Rate limited - wait and retry retry_after = data.get("retry_after", 30) print(f"Rate limited. Waiting {retry_after} seconds...") time.sleep(retry_after) continue elif response.status_code == 401: raise Exception("Invalid API key") elif response.status_code >= 500: # Server error - retry with backoff wait_time = 2 ** attempt print(f"Server error. Retrying in {wait_time} seconds...") time.sleep(wait_time) continue else: raise Exception(f"API Error: {data.get('message', 'Unknown error')}") raise Exception("Max retries exceeded") ``` ### JavaScript ```javascript theme={"theme":{"light":"github-light","dark":"github-dark"}} async function makeApiRequest(payload, maxRetries = 3) { const url = "https://modelslab.com/api/v6/images/text2img"; for (let attempt = 0; attempt < maxRetries; attempt++) { try { const response = await fetch(url, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(payload) }); const data = await response.json(); if (response.ok) { if (data.status === "success") { return data.output; } else if (data.status === "processing") { return await pollForResult(data.id); } } if (response.status === 429) { const retryAfter = data.retry_after || 30; console.log(`Rate limited. Waiting ${retryAfter} seconds...`); await new Promise(r => setTimeout(r, retryAfter * 1000)); continue; } if (response.status === 401) { throw new Error("Invalid API key"); } if (response.status >= 500) { const waitTime = Math.pow(2, attempt) * 1000; console.log(`Server error. Retrying in ${waitTime / 1000} seconds...`); await new Promise(r => setTimeout(r, waitTime)); continue; } throw new Error(`API Error: ${data.message || "Unknown error"}`); } catch (error) { if (attempt === maxRetries - 1) throw error; } } throw new Error("Max retries exceeded"); } ``` ## Validation Errors When request validation fails, you'll receive specific error messages: | Field | Error Message | Solution | | --------------- | ------------------------------------------ | ------------------------------ | | prompt | "prompt is required" | Include the `prompt` parameter | | prompt | "prompt must be a string" | Ensure prompt is a text string | | width | "width must be between 256 and 1024" | Use valid dimensions | | height | "height must be divisible by 8" | Use values like 512, 768, 1024 | | samples | "samples must be between 1 and 4" | Request 1-4 images per call | | guidance\_scale | "guidance\_scale must be between 1 and 20" | Use values in valid range | ## Processing Status vs Errors Not all non-success responses are errors. Some indicate the request is still processing: ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} // This is NOT an error - request is processing { "status": "processing", "id": "abc123-def456", "eta": 30, "message": "Your request is being processed" } ``` Use the [fetch endpoint](/general-api/fetch-image) to check the status of processing requests. ## Getting Help Get community help Contact support team Check service status # Fetch Video Source: https://docs.modelslab.com/faceswap-api/fetch POST /faceswap/fetch/{id} Fetch Queued Request API returns queued or generated videos, useful for delayed processing. **Note:** This endpoint does not generate new videos; it only returns already generated or queued video generations. ## Request Send a `POST` request to below endpoint to return the corresponding queued videos, where `{id}` is the ID returned together with the URL in the response upon its generation. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v6/faceswap/fetch/{id}' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "" } ``` # Multiple Face Swap Source: https://docs.modelslab.com/faceswap-api/multiple-face-swap POST /faceswap/multiple_face_swap Swap all detected faces in a single image with faces from a target image. ## Request Make a `POST` request to below endpoint and pass the required parameters in the request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v6/faceswap/multiple_face_swap' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key", "init_image":"https://i.pinimg.com/564x/4c/6a/d0/4c6ad0f74a3a251344cb115699a9a7c9.jpg", "target_image":"https://i.pinimg.com/564x/11/ac/0d/11ac0ddaf6962e395f30abc61043393e.jpg", "base64":false, "webhook": null, "track_id": null } ``` # Face Swap API Source: https://docs.modelslab.com/faceswap-api/overview Generate face swap videos and images with AI-powered face swapping. Supports single and multiple face swap, video face swap, and specific face targeting. Only Standard and Premium accounts have access to this endpoint. **[Upgrade Here](https://modelslab.com/pricing)** ### Endpoints Allows swapping faces in a single image. Swaps faces for all detected faces within a single image. Swaps faces for all detected faces within a single video. Swaps specific faces in a video based on a reference face. # Single Video Swap Source: https://docs.modelslab.com/faceswap-api/single-video-swap POST /faceswap/single_video_swap Swap all detected faces in a single video with faces from an input image. ## Request Make a `POST` request to below endpoint and pass the required parameters in the request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v6/faceswap/single_video_swap' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key", "init_image":"https://plus.unsplash.com/premium_photo-1661508557554-e3d96f2fdde5?fm=jpg&q=60&w=3000&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxzZWFyY2h8OXx8YmVhdXRpZnVsJTIwZ2lybHxlbnwwfHwwfHx8MA%3D%3D", "init_video":"https://tawk.link/6332cd5154f06e12d8971855/vc/66d997a6a2bc5fe2b627a250/v/4239c555189b772d5ca1bd5aa4bf872c4c12a07e/sdfsdfsdf.mp4", "output_format":"mp4", "webhook":null, "track_id": null } ``` # Specific Face Swap Source: https://docs.modelslab.com/faceswap-api/specific-face-swap POST /faceswap/single_face_swap Swap faces in a single image by providing the initial image and the target image. ## Request Make a `POST` request to below endpoint and pass the required parameters in the request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v6/faceswap/single_face_swap' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key":"", "init_image":"https://assets.modelslab.ai/generations/f139a3a7-1c64-4255-a53d-5b1c2a14b564", "target_image":"https://assets.modelslab.ai/generations/f139a3a7-1c64-4255-a53d-5b1c2a14b564", "reference_image":"https://assets.modelslab.ai/generations/f139a3a7-1c64-4255-a53d-5b1c2a14b564", "base64":false, "webhook": null, "track_id": null } ``` # Specific Video Swap Source: https://docs.modelslab.com/faceswap-api/specific-video-swap POST /faceswap/specific_video_swap Swapping specific faces in a video based on a reference image. ## Request Make a `POST` request to below endpoint and pass the required parameters in the request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v6/faceswap/specific_video_swap' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key", "init_video": "https://tawk.link/6332cd5154f06e12d8971855/vc/66d997a6a2bc5fe2b627a250/v/4239c555189b772d5ca1bd5aa4bf872c4c12a07e/sdfsdfsdf.mp4", "init_image" :"https://images-ext-1.discordapp.net/external/rJOvGZHIWsIijkfvCn5dByZNh_RfZZxUIiyyo7yOFIY/https/images.hindustantimes.com/rf/image_size_630x354/HT/p2/2017/12/27/Pictures/_1e5bc084-ead1-11e7-ad70-11504944e689.jpg?format=webp&width=984&height=553", "reference_image": "https://images-ext-1.discordapp.net/external/Z8sBOyxEy9tsqkd9gsNK2dHZh-Em6LDqrmyjcDeMXII/https/i.ibb.co/2PGZ3p7/lmao.png?format=webp&quality=lossless&width=412&height=662", "output_format": "mp4", "webhook": null, "track_id": null } ``` # Assets Generated Source: https://docs.modelslab.com/general-api/assets-generated POST /assets_generated Get a list of generated assets acrross endpoints. ## Request Send a `POST` request to below endpoint. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v6/assets_generated' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key", "type": "image" } ``` # Base64 Image Crop Source: https://docs.modelslab.com/general-api/base64-crop POST /base64_crop Lets you Upload an image and crop it, by passing the appropriate request parameters to the endpoint. Note that the maximum file size for upload is 5MB. and Make sure you are passing the image in **base64** format. ## Request Send a `POST` request to below endpoint. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v3/base64_crop' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key", "image": "data:image/png;base64,your_base_64_string", "crop": "true" } ``` # Base64 to URL Source: https://docs.modelslab.com/general-api/base64-to-url POST /base64_to_url Convert base64 strings of image, audio, video and 3d object file to a valid URL. The URL expires in 24 hours, supports max 5MB uploads, and requires valid base64 format. ## Request Send a `POST` request to below endpoint. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v6/base64_to_url' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key", "base64_string": "data:image/png;base64," } ``` # Automatically Buy Lora Model Source: https://docs.modelslab.com/general-api/buy-model POST /dreambooth/buy_model Allows you to buy a Lora model automatically ## Request Send a `POST` request to below endpoint and pass the **quantity** of the models you want to buy in the request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v3/dreambooth/buy_model' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key", "quantity": "" } ``` # Automatically Buy Subscription Plan Source: https://docs.modelslab.com/general-api/buy-subscription POST /buy_subscription This endpoint allows you to buy subscription for a particular api key automatically Before calling this endpoint, make sure that you have enabled **[Subscription Auto Payment](https://modelslab.com/dashboard/subscription)** on your dashboard. ## Request Send a `POST` request to below endpoint and pass the desired **plan\_name** to buy in the request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v3/buy_subscription' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key":"your-default-api-key", "plan_name":"basic_monthly" } ``` # Check Processing Requests Source: https://docs.modelslab.com/general-api/check-requests POST /processing/request_count Get the current number of processing requests before sending another request. This endpoint allows users to check how many requests are currently being processed before sending another request. This endpoint is throttled to 30 requests per minute to avoid abuse. ## Request Send a `GET` request to below endpoint. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request GET 'https://modelslab.com/api/v6/processing/request_count' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key" } ``` # Clear User Cache Source: https://docs.modelslab.com/general-api/clear-cache GET /clear_cache This endpoint is used to clear the user's cache. ## Request Send a `POST` request to below endpoint to clear the user's cache. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} curl --request POST 'https://modelslab.com/api/v5/clear_cache' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "" } ``` # Delete Image Source: https://docs.modelslab.com/general-api/delete-image POST /delete_image This endpoint is used to delete an image using the image name. ## Request Send a `POST` request to below endpoint and pass the name of the image you want to delete to the **image** parameter of the request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v3/delete_image' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key", "request_id": 2398, "type": "image" } ``` # General Utility APIs Source: https://docs.modelslab.com/general-api/overview ModelsLab utility endpoints for base64 conversion, model management, subscription handling, cache management, and NSFW content checks. ### Endpoints This endpoint is used to upload an image in Base64 Format and crop it. Convert base64 strings of image, audio, video and 3d object file to a valid URL. This endpoint allows you to buy a LoRA model automatically. This endpoint allows you to buy an API key with a subscription plan automatically. This endpoint allows you to see the current subscription plan you are on and your remaining balance. This endpoint is used to clear the user's cache. This endpoint is used to delete an image using the image name. # Subscribed Plan Source: https://docs.modelslab.com/general-api/subscribed-plan POST /subscribed_plan This endpoint allows you to see the current subscription plan you are on and your remaining balance ## Request Send a `POST` request to below endpoint to get the current subscription plan you are on and your remaining balance. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/subscribed_plan' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "" } ``` # Check Wallet Balance Source: https://docs.modelslab.com/general-api/wallet-balance POST /wallet_balance Check your current wallet balance. This endpoint allows users to check their current wallet balance. ## Request Send a `POST` request to below endpoint. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/wallet_balance' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key" } ``` ## Response ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "status": "success", "data": { "balance": 43.6, "currency": "USD" } } ``` # Authentication Source: https://docs.modelslab.com/gguf-cloud/authentication Find your GGUF Cloud deployment's base URL and authenticate with your existing ModelsLab API key using the Authorization, x-api-key, or key header. Every GGUF Cloud deployment is a private endpoint with its own base URL, authenticated with your existing ModelsLab API key. No separate key is required. ## Base URL Each deployment has a unique base URL. The `{deployment_id}` is shown on the deployment's dashboard page at [modelslab.com/gguf-cloud](https://modelslab.com/gguf-cloud): ``` https://modelslab.com/api/gguf/{deployment_id} ``` ### Choosing the right base\_url The two SDK families expect the base URL in slightly different forms. Use the matching one: | SDK / Client | `base_url` value | | --------------------------------------- | --------------------------------------------------- | | OpenAI SDK (Python, Node, LangChain, …) | `https://modelslab.com/api/gguf/{deployment_id}/v1` | | Anthropic SDK / Claude Code | `https://modelslab.com/api/gguf/{deployment_id}` | The OpenAI SDK appends paths like `/chat/completions` to the base URL, so the base URL ends in `/v1`. The Anthropic SDK appends `/v1/messages` itself, so its base URL is the **root** (no trailing `/v1`). ## API key Authenticate with your existing **ModelsLab API key**. You can find or create one in your [API Keys Dashboard](https://modelslab.com/dashboard/api-keys). The gateway accepts the key in any of three headers, so SDKs from both ecosystems work unchanged: Bearer token form used by OpenAI SDKs: `Authorization: Bearer YOUR_MODELSLAB_API_KEY` Header used by Anthropic SDKs and Claude Code: `x-api-key: YOUR_MODELSLAB_API_KEY` Plain header form: `key: YOUR_MODELSLAB_API_KEY` Never share your API key publicly or commit it to version control. Treat it like a password and use environment variables in production. ## Examples ```python Python (OpenAI SDK) theme={"theme":{"light":"github-light","dark":"github-dark"}} from openai import OpenAI client = OpenAI( api_key="YOUR_MODELSLAB_API_KEY", base_url="https://modelslab.com/api/gguf/YOUR_DEPLOYMENT_ID/v1", ) ``` ```python Python (Anthropic SDK) theme={"theme":{"light":"github-light","dark":"github-dark"}} from anthropic import Anthropic client = Anthropic( api_key="YOUR_MODELSLAB_API_KEY", base_url="https://modelslab.com/api/gguf/YOUR_DEPLOYMENT_ID", ) ``` ```bash cURL (Authorization) theme={"theme":{"light":"github-light","dark":"github-dark"}} curl "https://modelslab.com/api/gguf/YOUR_DEPLOYMENT_ID/v1/models" \ -H "Authorization: Bearer $MODELSLAB_API_KEY" ``` ```bash cURL (x-api-key) theme={"theme":{"light":"github-light","dark":"github-dark"}} curl "https://modelslab.com/api/gguf/YOUR_DEPLOYMENT_ID/v1/models" \ -H "x-api-key: $MODELSLAB_API_KEY" ``` ## Next steps Call the OpenAI-compatible endpoints on your deployment. Call the Anthropic-compatible endpoint, or point Claude Code at your deployment. # Chat Completions Source: https://docs.modelslab.com/gguf-cloud/chat-completions OpenAI-compatible chat completions, completions, embeddings, and models endpoints served by your dedicated GGUF Cloud deployment. Your GGUF Cloud deployment exposes the standard **OpenAI-compatible** routes, backed by your model's `llama-server`. Point any OpenAI SDK or compatible client at your deployment's base URL with `/v1` appended. ## Endpoints | Method | Path | Description | | ------ | ---------------------- | --------------------------------------------------- | | `POST` | `/v1/chat/completions` | Chat-style completions (messages array). | | `POST` | `/v1/completions` | Classic text completions (single `prompt`). | | `POST` | `/v1/embeddings` | Embeddings for the deployed model (when supported). | | `GET` | `/v1/models` | List the model served by this deployment. | All paths are relative to your deployment base URL: ``` https://modelslab.com/api/gguf/{deployment_id} ``` ## Request ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} POST https://modelslab.com/api/gguf/{deployment_id}/v1/chat/completions ``` Authenticate with your ModelsLab API key (see [Authentication](/gguf-cloud/authentication)). ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} curl -X POST "https://modelslab.com/api/gguf/YOUR_DEPLOYMENT_ID/v1/chat/completions" \ -H "Authorization: Bearer $MODELSLAB_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "local", "messages": [ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "What is the capital of France?"} ], "max_tokens": 256, "temperature": 0.7 }' ``` ## Body ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "model": "local", "messages": [ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "What is the capital of France?"} ], "max_tokens": 256, "temperature": 0.7, "top_p": 0.95, "stop": ["\n\n"], "stream": false } ``` ## Body Attributes The model to use. A deployment serves a **single** model, so this can be `"local"` or the model id you deployed — either way the request is routed to your deployment's model. Array of message objects, each with a `role` (`system`, `user`, or `assistant`) and `content`. Used by `/v1/chat/completions`. A single text prompt. Used by the `/v1/completions` endpoint instead of `messages`. Maximum number of tokens to generate. Range: `1` to the model's context limit. Sampling temperature. Lower values (`0.1`–`0.3`) produce focused, deterministic output; higher values increase creativity. Range: `0.0`–`2.0`. Nucleus sampling — only consider tokens with cumulative probability above this threshold. Range: `0.0`–`1.0`. Use either `temperature` or `top_p`. Only sample from the top K most likely tokens (a llama.cpp sampling option). Penalty applied to repeated tokens. Values `> 1` discourage repetition (a llama.cpp sampling option). Penalizes tokens that have already appeared, encouraging new topics. Range: `-2`–`2`. Penalizes tokens proportionally to how often they have appeared. Range: `-2`–`2`. One or more sequences where generation stops. The stop sequence is not included in the output. Seed for reproducible sampling. The same seed and input produce the same output. When `true`, responses are streamed as Server-Sent Events (`text/event-stream`). See [Streaming](#streaming). ## Response ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "id": "chatcmpl-abc123", "object": "chat.completion", "created": 1712345678, "model": "local", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "The capital of France is Paris." }, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 25, "completion_tokens": 8, "total_tokens": 33 } } ``` ## Response Fields Unique identifier for the completion. The object type, e.g. `chat.completion` (or `chat.completion.chunk` while streaming). The model that produced the response (your deployment's model). The generated choices. Each item contains an `index`, a `message` (with `role` and `content`), and a `finish_reason`. Token accounting: `prompt_tokens`, `completion_tokens`, and `total_tokens`. ## Streaming Set `"stream": true` to receive Server-Sent Events (SSE) as tokens are generated: ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} curl -X POST "https://modelslab.com/api/gguf/YOUR_DEPLOYMENT_ID/v1/chat/completions" \ -H "Authorization: Bearer $MODELSLAB_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "local", "messages": [{"role": "user", "content": "Write a haiku"}], "stream": true }' ``` Each SSE event carries a `chat.completion.chunk` object, terminated by `data: [DONE]`: ``` data: {"id":"chatcmpl-abc123","object":"chat.completion.chunk","choices":[{"index":0,"delta":{"content":"Silent"},"finish_reason":null}]} data: {"id":"chatcmpl-abc123","object":"chat.completion.chunk","choices":[{"index":0,"delta":{"content":" snow"},"finish_reason":null}]} data: [DONE] ``` ## SDK Examples This endpoint is a drop-in replacement for the OpenAI API. Just change the `base_url` and `api_key`: ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}} from openai import OpenAI client = OpenAI( api_key="YOUR_MODELSLAB_API_KEY", base_url="https://modelslab.com/api/gguf/YOUR_DEPLOYMENT_ID/v1", ) # Non-streaming response = client.chat.completions.create( model="local", messages=[ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Explain quantum computing in simple terms"}, ], max_tokens=256, ) print(response.choices[0].message.content) # Streaming stream = client.chat.completions.create( model="local", messages=[{"role": "user", "content": "Write a story"}], stream=True, ) for chunk in stream: if chunk.choices[0].delta.content: print(chunk.choices[0].delta.content, end="") ``` ```javascript JavaScript theme={"theme":{"light":"github-light","dark":"github-dark"}} import OpenAI from 'openai'; const client = new OpenAI({ apiKey: 'YOUR_MODELSLAB_API_KEY', baseURL: 'https://modelslab.com/api/gguf/YOUR_DEPLOYMENT_ID/v1', }); const response = await client.chat.completions.create({ model: 'local', messages: [ { role: 'system', content: 'You are a helpful assistant.' }, { role: 'user', content: 'Hello!' }, ], }); console.log(response.choices[0].message.content); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"github-dark"}} curl -X POST "https://modelslab.com/api/gguf/YOUR_DEPLOYMENT_ID/v1/chat/completions" \ -H "Authorization: Bearer $MODELSLAB_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "local", "messages": [{"role": "user", "content": "Hello!"}] }' ``` ## Other OpenAI routes ```bash List models theme={"theme":{"light":"github-light","dark":"github-dark"}} curl "https://modelslab.com/api/gguf/YOUR_DEPLOYMENT_ID/v1/models" \ -H "Authorization: Bearer $MODELSLAB_API_KEY" ``` ```bash Text completions theme={"theme":{"light":"github-light","dark":"github-dark"}} curl -X POST "https://modelslab.com/api/gguf/YOUR_DEPLOYMENT_ID/v1/completions" \ -H "Authorization: Bearer $MODELSLAB_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "local", "prompt": "Once upon a time", "max_tokens": 128 }' ``` ```bash Embeddings theme={"theme":{"light":"github-light","dark":"github-dark"}} curl -X POST "https://modelslab.com/api/gguf/YOUR_DEPLOYMENT_ID/v1/embeddings" \ -H "Authorization: Bearer $MODELSLAB_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "local", "input": "The quick brown fox" }' ``` `/v1/embeddings` is only available when the deployed model supports embeddings. If it does not, the endpoint returns an error from `llama-server`. # Errors Source: https://docs.modelslab.com/gguf-cloud/errors Error reference for the GGUF Cloud gateway — 401, 404, 503, and 502 responses, their JSON shape, and how to handle them. The GGUF Cloud gateway authenticates your request, confirms the deployment is yours and ready, then proxies to your model's `llama-server`. Gateway-level errors are returned in a consistent JSON shape. ## Error Response Format ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "error": { "type": "authentication_error", "message": "Human-readable error description" } } ``` This shape applies to errors raised by the **gateway** (auth, routing, readiness). Errors raised by the model server itself (for example an invalid sampling parameter) are passed through from `llama-server` and may use the standard OpenAI/Anthropic error shape. ## HTTP Status Codes **Cause**: The API key is missing or invalid. **Common Issues**: * No key sent in the `Authorization`, `x-api-key`, or `key` header. * The key is incorrect, revoked, or not a valid ModelsLab API key. **Example Response**: ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "error": { "type": "authentication_error", "message": "Invalid API key." } } ``` **Solution**: Send your ModelsLab API key in one of the accepted headers (see [Authentication](/gguf-cloud/authentication)) and verify it hasn't been revoked in your [dashboard](https://modelslab.com/dashboard/api-keys). **Cause**: There is no deployment for this `deployment_id`, or it does not belong to your account. **Example Response**: ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "error": { "type": "not_found_error", "message": "No deployment found for this endpoint." } } ``` **Solution**: Check the `deployment_id` in your base URL against the one on your [deployment dashboard](https://modelslab.com/gguf-cloud), and confirm the API key belongs to the same account that owns the deployment. **Cause**: The deployment exists but is not ready — it is still deploying or has been paused. **Example Response**: ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "error": { "type": "overloaded_error", "message": "Endpoint is not ready (status: deploying). It may still be deploying or paused." } } ``` **Solution**: Wait until the deployment shows **Ready** on the dashboard, then retry. If it is paused, resume it first. **Cause**: The deployment is marked ready but the model pod is currently unreachable — typically restarting or warming up after a config change. **Example Response**: ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "error": { "type": "api_error", "message": "The model endpoint is unreachable right now. It may be restarting — try again in a moment." } } ``` **Solution**: This is transient. Retry shortly, ideally with exponential backoff. If it persists, check the deployment status on the dashboard. ## Handling Errors Treat `503` and `502` as **retryable** — the endpoint is coming up or restarting. Retry with backoff and stop on `401`/`404`, which require a fix on your side. ```python theme={"theme":{"light":"github-light","dark":"github-dark"}} import time import httpx def call_with_retry(url, headers, payload, max_retries=4): for attempt in range(max_retries): response = httpx.post(url, headers=headers, json=payload, timeout=120) if response.status_code == 200: return response.json() if response.status_code in (502, 503): # Endpoint still deploying / restarting — retry with backoff time.sleep(2 ** attempt) continue # 401 / 404 are not retryable — surface the gateway message error = response.json().get("error", {}) raise Exception(f"{error.get('type')}: {error.get('message')}") raise Exception("Max retries exceeded — endpoint did not become ready") ``` ## Related Base URLs and the accepted auth headers. Error reference for the rest of the ModelsLab API. # Messages Source: https://docs.modelslab.com/gguf-cloud/messages Anthropic-compatible messages endpoint served by your dedicated GGUF Cloud deployment. Works with the Anthropic SDK and Claude Code. Your GGUF Cloud deployment also speaks the **Anthropic protocol** natively via the `/v1/messages` endpoint. Point the Anthropic SDK or **Claude Code** at your deployment's base URL — the **root** URL, with no `/v1` suffix, since the Anthropic SDK appends `/v1/messages` itself. ## Request ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} POST https://modelslab.com/api/gguf/{deployment_id}/v1/messages ``` Pass your ModelsLab API key in the `x-api-key` header (see [Authentication](/gguf-cloud/authentication)). ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} curl -X POST "https://modelslab.com/api/gguf/YOUR_DEPLOYMENT_ID/v1/messages" \ -H "x-api-key: $MODELSLAB_API_KEY" \ -H "Content-Type: application/json" \ -H "anthropic-version: 2023-06-01" \ -d '{ "model": "local", "max_tokens": 1024, "messages": [ {"role": "user", "content": "What is the capital of France?"} ] }' ``` ## Body ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "model": "local", "max_tokens": 1024, "messages": [ {"role": "user", "content": "What is the capital of France?"} ], "system": "You are a helpful assistant.", "temperature": 0.7, "stream": false } ``` ## Body Attributes The model to use. A deployment serves a **single** model, so this can be `"local"` or the model id you deployed — it is always routed to your deployment's model. Maximum number of tokens to generate. Required in the Anthropic format. Input messages. Roles are `user` and `assistant` only — the system prompt goes in the `system` parameter, not in `messages`. System prompt, passed separately from the message list. Sampling temperature. In the Anthropic format the range is `0.0`–`1.0`. Nucleus sampling threshold. Range: `0.0`–`1.0`. Custom sequences where generation stops. When `true`, responses are streamed as Server-Sent Events (`text/event-stream`). ## Response ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "id": "msg_abc123", "type": "message", "role": "assistant", "content": [ { "type": "text", "text": "The capital of France is Paris." } ], "model": "local", "stop_reason": "end_turn", "usage": { "input_tokens": 15, "output_tokens": 8 } } ``` ## Response Fields Unique identifier for the message. The object type, `message`. The generated content blocks. Text responses contain `{"type": "text", "text": "..."}`. Why generation stopped, e.g. `end_turn` or `max_tokens`. Token accounting: `input_tokens` and `output_tokens`. ## Streaming Set `"stream": true` to receive Server-Sent Events: ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} curl -X POST "https://modelslab.com/api/gguf/YOUR_DEPLOYMENT_ID/v1/messages" \ -H "x-api-key: $MODELSLAB_API_KEY" \ -H "Content-Type: application/json" \ -H "anthropic-version: 2023-06-01" \ -d '{ "model": "local", "max_tokens": 1024, "messages": [{"role": "user", "content": "Write a haiku"}], "stream": true }' ``` ## Anthropic SDK This endpoint is a drop-in replacement for the Anthropic API. Use the deployment **root** as the `base_url` (the SDK adds `/v1/messages`): ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}} from anthropic import Anthropic client = Anthropic( api_key="YOUR_MODELSLAB_API_KEY", base_url="https://modelslab.com/api/gguf/YOUR_DEPLOYMENT_ID", ) # Non-streaming message = client.messages.create( model="local", max_tokens=1024, messages=[{"role": "user", "content": "Explain quantum computing"}], ) print(message.content[0].text) # Streaming with client.messages.stream( model="local", max_tokens=1024, messages=[{"role": "user", "content": "Write a story"}], ) as stream: for text in stream.text_stream: print(text, end="") ``` ```javascript JavaScript theme={"theme":{"light":"github-light","dark":"github-dark"}} import Anthropic from '@anthropic-ai/sdk'; const client = new Anthropic({ apiKey: 'YOUR_MODELSLAB_API_KEY', baseURL: 'https://modelslab.com/api/gguf/YOUR_DEPLOYMENT_ID', }); const message = await client.messages.create({ model: 'local', max_tokens: 1024, messages: [{ role: 'user', content: 'Hello!' }], }); console.log(message.content[0].text); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"github-dark"}} curl -X POST "https://modelslab.com/api/gguf/YOUR_DEPLOYMENT_ID/v1/messages" \ -H "x-api-key: $MODELSLAB_API_KEY" \ -H "Content-Type: application/json" \ -H "anthropic-version: 2023-06-01" \ -d '{ "model": "local", "max_tokens": 1024, "messages": [{"role": "user", "content": "Hello!"}] }' ``` ## Using with Claude Code Because your deployment speaks the Anthropic protocol, you can use it as a backend for [Claude Code](https://claude.ai/claude-code). Point Claude Code at your deployment's root base URL and authenticate with your ModelsLab API key: ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} ANTHROPIC_BASE_URL="https://modelslab.com/api/gguf/YOUR_DEPLOYMENT_ID" \ ANTHROPIC_AUTH_TOKEN="YOUR_MODELSLAB_API_KEY" \ claude --model "local" ``` Claude Code sends the API key as `x-api-key`, which the GGUF Cloud gateway accepts. Your deployment serves a single model, so the `--model` value is routed to that model regardless of the name you pass. # GGUF Cloud Source: https://docs.modelslab.com/gguf-cloud/overview Deploy any GGUF / llama.cpp model on a dedicated single-tenant GPU. Each deployment is its own private endpoint that speaks both the OpenAI and Anthropic protocols natively. **GGUF Cloud** lets you deploy any GGUF (llama.cpp) model on a **dedicated, single-tenant GPU**. Each deployment becomes its own private API endpoint, backed by [`llama.cpp`](https://github.com/ggml-org/llama.cpp) (`llama-server`), and speaks **both the OpenAI and Anthropic protocols natively** — so you can point the OpenAI SDK, the Anthropic SDK, **Claude Code**, or any compatible client at it with just a base URL change. Unlike the shared [LLM API](/llm-api/overview), a GGUF Cloud deployment runs **only your model on your own GPU**. There are no neighbors, the model stays loaded, and the endpoint is reachable exclusively with your ModelsLab API key. ## How it works Choose any GGUF model (from Hugging Face, your own quantization, or one of our presets) at [modelslab.com/gguf-cloud](https://modelslab.com/gguf-cloud). We provision a single-tenant GPU pod running `llama-server` with your model loaded. Your deployment gets a unique `deployment_id`. Point the OpenAI SDK, Anthropic SDK, or Claude Code at your deployment's base URL using your existing ModelsLab API key. Get a deployment and find your `deployment_id` on the dashboard at [modelslab.com/gguf-cloud](https://modelslab.com/gguf-cloud). ## Base URL Every deployment has its own base URL. The `{deployment_id}` is shown on the deployment's dashboard page: ``` https://modelslab.com/api/gguf/{deployment_id} ``` * **OpenAI SDKs** use the base URL with `/v1` appended → `https://modelslab.com/api/gguf/{deployment_id}/v1` * **Anthropic SDKs / Claude Code** use the base URL as-is → `https://modelslab.com/api/gguf/{deployment_id}` See [Authentication](/gguf-cloud/authentication) for the full details on base URLs and API keys. ## Quickstart Authenticate with your existing ModelsLab API key. Because the deployment serves a single model, the `model` field can be `"local"` (or the model id you deployed) — it's always routed to your deployment's model. ```python Python (OpenAI SDK) theme={"theme":{"light":"github-light","dark":"github-dark"}} from openai import OpenAI client = OpenAI( api_key="YOUR_MODELSLAB_API_KEY", base_url="https://modelslab.com/api/gguf/YOUR_DEPLOYMENT_ID/v1", ) response = client.chat.completions.create( model="local", messages=[{"role": "user", "content": "Hello!"}], ) print(response.choices[0].message.content) ``` ```python Python (Anthropic SDK) theme={"theme":{"light":"github-light","dark":"github-dark"}} from anthropic import Anthropic client = Anthropic( api_key="YOUR_MODELSLAB_API_KEY", base_url="https://modelslab.com/api/gguf/YOUR_DEPLOYMENT_ID", ) message = client.messages.create( model="local", max_tokens=1024, messages=[{"role": "user", "content": "Hello!"}], ) print(message.content[0].text) ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"github-dark"}} curl -X POST "https://modelslab.com/api/gguf/YOUR_DEPLOYMENT_ID/v1/chat/completions" \ -H "Authorization: Bearer $MODELSLAB_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "local", "messages": [{"role": "user", "content": "Hello!"}] }' ``` ## Explore Base URLs, your `deployment_id`, and the three accepted auth headers. OpenAI-compatible `/v1/chat/completions`, `/v1/completions`, `/v1/embeddings`, and `/v1/models`. Anthropic-compatible `/v1/messages`. Works with the Anthropic SDK and Claude Code. Gateway error reference: 401, 404, 503, and 502 and how to handle them. # Model Selection Guide Source: https://docs.modelslab.com/guides/model-selection How to discover, choose, and use the right AI model for your generation requests across image, video, audio, and LLM endpoints # Model Selection Guide Every generation request on ModelsLab requires a `model_id` parameter that tells the API which AI model to use. With 50,000+ models available, this guide helps you discover and choose the right one. *** ## How model\_id Works The `model_id` is a string identifier you pass in your API request body. It determines which model processes your generation. ```python theme={"theme":{"light":"github-light","dark":"github-dark"}} import requests response = requests.post( "https://modelslab.com/api/v7/images/text-to-image", json={ "key": "your_api_key", "model_id": "flux", # <-- this selects the model "prompt": "a red apple on a white table", "width": 512, "height": 512 } ) ``` ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} curl -X POST "https://modelslab.com/api/v7/images/text-to-image" \ -H "Content-Type: application/json" \ -d '{ "key": "your_api_key", "model_id": "flux", "prompt": "a red apple on a white table", "width": 512, "height": 512 }' ``` *** ## Three Ways to Discover Models ### 1. API: Models Endpoint Query the models API to search programmatically: ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} # Search by name curl "https://modelslab.com/api/v7/models?search=flux&key=your_api_key" # Filter by feature curl "https://modelslab.com/api/v7/models?feature=imagen&key=your_api_key" ``` ### 2. CLI: modelslab models The CLI provides rich model discovery commands: ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} # Search by name modelslab models search --search "flux" # Filter by feature category modelslab models search --feature imagen # Image models modelslab models search --feature video_fusion # Video models modelslab models search --feature audio_gen # Audio models modelslab models search --feature llmaster # LLM/chat models # Get full details about a model modelslab models detail --id flux # JSON output for scripting modelslab models search --search "flux" --output json --jq '.[].model_id' ``` ### 3. Web: Model Browser Browse and filter all models visually at [modelslab.com/models](https://modelslab.com/models). *** ## Models by Category ### Image Generation Use with `/api/v7/images/text-to-image`, `/api/v7/images/image-to-image`, and `/api/v7/images/inpaint`. | model\_id | Name | Best For | | ------------ | ------------------- | --------------------------------- | | `flux` | Flux Dev | Fast, high-quality general images | | `midjourney` | MidJourney | Artistic, stylized images | | `sdxl` | Stable Diffusion XL | Versatile base model | | `imagen-3` | Google Imagen 3 | Premium photorealistic images | | `imagen-4` | Google Imagen 4 | Latest Google image model | For image-to-image and inpainting with SD/SDXL models (e.g., `midjourney`), include the `scheduler` parameter. Flux models don't require it. ### Video Generation Use with `/api/v7/video-fusion/text-to-video` and `/api/v7/video-fusion/image-to-video`. | model\_id | Name | Type | | -------------- | ----------------------- | ------------------- | | `seedance-t2v` | Seedance Text-to-Video | Text to video | | `seedance-i2v` | Seedance Image-to-Video | Image to video | | `wan2.2` | Wan 2.1 | Text/image to video | | `wan2.6-t2v` | Wan 2.6 Text-to-Video | Text to video | | `wan2.6-i2v` | Wan 2.6 Image-to-Video | Image to video | | `veo2` | Google Veo 2 | Premium video | | `veo3` | Google Veo 3 | Latest Google video | | `sora-2` | OpenAI Sora 2 | Premium video | Video generation is asynchronous. The API returns a `processing` status with an `id` — use `/api/v7/video-fusion/fetch/{id}` to poll for results. ### Audio & Voice Use with `/api/v7/voice/*` endpoints. | model\_id | Name | Endpoint | | ------------------------ | -------------------------- | ---------------- | | `eleven_multilingual_v2` | ElevenLabs Multilingual v2 | text-to-speech | | `eleven_english_sts_v2` | ElevenLabs Voice Changer | speech-to-speech | | `scribe_v1` | ElevenLabs Scribe | speech-to-text | | `eleven_sound_effect` | ElevenLabs SFX | sound-generation | | `music_v1` | ElevenLabs Music | music-gen | | `inworld-tts-1` | Inworld TTS | text-to-speech | Text-to-speech uses the `prompt` parameter (not `text`) and requires a valid ElevenLabs `voice_id` (e.g., `21m00Tcm4TlvDq8ikWAM` for Rachel). ### LLM / Chat Use with `/api/v7/llm/chat/completions` (OpenAI-compatible format). | model\_id | Name | Provider | | ----------------------------------------------- | -------------------- | -------- | | `meta-llama-3-8B-instruct` | Llama 3 8B Instruct | Meta | | `meta-llama-Llama-3.3-70B-Instruct-Turbo` | Llama 3.3 70B Turbo | Meta | | `meta-llama-Meta-Llama-3.1-405B-Instruct-Turbo` | Llama 3.1 405B Turbo | Meta | | `deepseek-ai-DeepSeek-R1-Distill-Llama-70B` | DeepSeek R1 | DeepSeek | | `deepseek-ai-DeepSeek-V3` | DeepSeek V3 | DeepSeek | | `gemini-2.0-flash-001` | Gemini 2.0 Flash | Google | | `gemini-2.5-pro` | Gemini 2.5 Pro | Google | | `Qwen-Qwen2.5-72B-Instruct-Turbo` | Qwen 2.5 72B Turbo | Qwen | | `mistralai-Mixtral-8x7B-Instruct-v0.1` | Mixtral 8x7B | Mistral | The chat completions endpoint accepts both `model_id` and `model` (OpenAI-compatible alias). The `messages` array follows the standard OpenAI format. *** ## Code Examples ### Image Generation (Python) ```python theme={"theme":{"light":"github-light","dark":"github-dark"}} import requests response = requests.post( "https://modelslab.com/api/v7/images/text-to-image", json={ "key": "your_api_key", "model_id": "flux", "prompt": "a futuristic cityscape at sunset, highly detailed", "width": 1024, "height": 1024, "samples": 1 } ) data = response.json() if data["status"] == "success": print(f"Image URL: {data['output'][0]}") ``` ### Chat Completion (Python) ```python theme={"theme":{"light":"github-light","dark":"github-dark"}} response = requests.post( "https://modelslab.com/api/v7/llm/chat/completions", json={ "key": "your_api_key", "model_id": "meta-llama-3-8B-instruct", "messages": [ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Explain quantum computing briefly."} ], "max_tokens": 200, "temperature": 0.7 } ) data = response.json() print(data["choices"][0]["message"]["content"]) ``` ### Chat Completion (OpenAI SDK Compatible) ```python theme={"theme":{"light":"github-light","dark":"github-dark"}} from openai import OpenAI client = OpenAI( base_url="https://modelslab.com/api/v7/llm", api_key="your_api_key" ) response = client.chat.completions.create( model="meta-llama-3-8B-instruct", messages=[{"role": "user", "content": "Hello!"}], max_tokens=50 ) print(response.choices[0].message.content) ``` ### CLI Examples ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} # Generate image with specific model modelslab generate image --prompt "sunset over mountains" --model flux # Chat with an LLM modelslab generate chat --message "Explain AI" --model meta-llama-3-8B-instruct # Generate video modelslab generate video --prompt "ocean waves" --model seedance-t2v # Set a default model modelslab config set generation.default_model flux ``` *** ## Tips for Choosing the Right Model 1. **Start with popular models** — `flux` for images, `meta-llama-3-8B-instruct` for chat 2. **Use feature filters** — `modelslab models search --feature imagen` narrows results 3. **Check model details** — `modelslab models detail --id ` shows supported parameters 4. **Consider provider** — models from different providers (Google, Meta, ElevenLabs) have different capabilities and pricing 5. **Test with small requests first** — use low resolution/token counts while experimenting *** ## Resources * [Model Browser](https://modelslab.com/models) — Visual model discovery * [API Reference](/api-reference) — Full endpoint documentation * [CLI Installation](https://github.com/ModelsLab/modelslab-cli) — Install the CLI tool # Song Generation Guide Source: https://docs.modelslab.com/guides/song-generation-guide Professional guide to creating music with ModelsLab Song Generator API powered by ACE-Step v1.5 Song Generation Guide # Song Generation Guide This guide contains professional music creation knowledge to help you create high-quality songs using the ModelsLab Song Generator API, powered by **ACE-Step v1.5** model. *** ## Overview The Song Generator API allows you to create complete songs with vocals in 50+ languages using the advanced **ACE-Step v1.5** model. You can either provide your own lyrics or let the AI generate them automatically based on your prompt. ### Key Features * **Duration Control**: Generate songs from 30 seconds to 8 minutes (30-480 seconds) * **50+ Languages**: Support for languages from Arabic to Chinese * **Lyrics Generation**: Automatic lyrics generation or use your own * **Instrumental Mode**: Generate instrumental versions without vocals * **Style Control**: Use caption to define music style, instruments, and atmosphere *** ## Understanding the Parameters ### Caption: Your Music Blueprint **Caption is the most important parameter** affecting your generated song. It describes the overall music elements you want. #### What to Include in Caption | Dimension | Examples | | ------------------------- | ------------------------------------------------------------------------------ | | **Style/Genre** | pop, rock, jazz, electronic, hip-hop, R\&B, folk, reggaeton, synthwave | | **Emotion/Atmosphere** | melancholic, uplifting, energetic, dreamy, dark, nostalgic, euphoric, intimate | | **Instruments** | acoustic guitar, piano, synth pads, 808 drums, strings, brass, electric bass | | **Timbre Texture** | warm, bright, crisp, airy, punchy, lush, raw, polished | | **Era Reference** | 80s synth-pop, 90s grunge, 2010s EDM, vintage soul, modern trap | | **Vocal Characteristics** | female vocal, male vocal, breathy, powerful, falsetto, raspy | | **Production Style** | lo-fi, high-fidelity, live recording, studio-polished | #### Caption Writing Principles 1. **Be Specific** — "sad piano ballad with female breathy vocal" works better than "a sad song" 2. **Combine Dimensions** — Mix style + emotion + instruments + timbre for precise control 3. **Use References** — "80s synthwave style" or "reggaeton with flamenco influence" conveys complex aesthetics quickly 4. **Texture Words Matter** — Adjectives like warm, crisp, airy, punchy influence mixing and timbre 5. **Balance Detail vs Freedom** — More details = more control, fewer details = more AI creativity 6. **Avoid Conflicts** — Don't combine incompatible styles like "classical strings" and "hardcore metal" unless you want evolution **Example Good Captions:** ``` A modern reggaeton track with strong flamenco influence, featuring female vocal with reverb, deep sub-bass, crisp percussion, and plucked synth guitar riff ``` ``` Lo-fi hip-hop beat with warm vinyl crackle, mellow piano chords, subtle jazz drums, and atmospheric pad textures ``` ``` 80s synthwave pop with bright synth leads, punchy drum machine, nostalgic atmosphere, and powerful female vocals ``` *** ## Lyrics: Your Song's Timeline Lyrics control how your song unfolds over time. They include: * Lyric text content * Structure tags (\[Verse], \[Chorus], etc.) * Vocal style hints * Instrumental sections * Energy changes ### Common Structure Tags | Category | Tag | Description | | -------------------- | ----------------------- | ------------------------------- | | **Basic Structure** | `[Intro]` | Opening, establish atmosphere | | | `[Verse]` / `[Verse 1]` | Verse, narrative progression | | | `[Pre-Chorus]` | Build energy before chorus | | | `[Chorus]` | Emotional climax, hook | | | `[Bridge]` | Transition or elevation | | | `[Outro]` | Ending, conclusion | | **Dynamic Sections** | `[Build]` | Energy gradually rising | | | `[Drop]` | Electronic music energy release | | | `[Breakdown]` | Reduced instrumentation | | **Instrumental** | `[Instrumental]` | Pure instrumental, no vocals | | | `[Guitar Solo]` | Guitar solo section | | | `[Piano Interlude]` | Piano interlude | | **Special Tags** | `[Fade Out]` | Fade out ending | ### Vocal Control Tags | Tag | Effect | | -------------------- | ------------------------------ | | `[raspy vocal]` | Raspy, textured vocals | | `[whispered]` | Whispered vocals | | `[falsetto]` | Falsetto vocals | | `[powerful belting]` | Powerful, high-pitched singing | | `[harmonies]` | Layered harmonies | ### Energy Tags | Tag | Effect | | ------------------- | ----------------------- | | `[high energy]` | High energy, passionate | | `[building energy]` | Increasing energy | | `[explosive]` | Explosive energy | | `[melancholic]` | Melancholic mood | | `[euphoric]` | Euphoric feeling | ### Lyrics Writing Tips **1. Control Syllable Count** Keep **6-10 syllables per line** for best results. Consistent syllable counts create better rhythm. **2. Use Case for Intensity** ``` [Verse] walking through the empty streets (normal) [Chorus] WE ARE THE CHAMPIONS! (high intensity) ``` **3. Parentheses for Background Vocals** ``` [Chorus] We rise together (together) Into the light (into the light) ``` **4. Clear Section Separation** Always separate sections with blank lines: ``` [Verse 1] First verse lyrics here Continue first verse [Chorus] Chorus lyrics here Chorus continues ``` ### Keep Caption and Lyrics Consistent ⚠️ **Critical**: Descriptions in Caption and Lyrics must align. If Caption says "soft piano ballad" but Lyrics has `[explosive metal solo]`, results will be poor. **Checklist:** * Instruments in Caption ↔ Instrumental tags in Lyrics * Emotion in Caption ↔ Energy tags in Lyrics * Vocal description in Caption ↔ Vocal control tags in Lyrics *** ## Duration Calculation **You MUST calculate appropriate duration** based on your lyrics and structure. ### Estimation Method * **Per line of lyrics**: 3-5 seconds * **Intro/Outro**: 5-10 seconds each * **Instrumental sections**: 5-15 seconds * **Typical structures**: * 2 verses + 2 choruses: 120-150 seconds minimum * 2 verses + 2 choruses + bridge: 180-240 seconds * Full song with intro/outro: 210-270 seconds (3.5-4.5 minutes) ### Common Pitfall ❌ **DON'T**: 10 lines of lyrics with 60 seconds duration → rushed and compressed ✅ **DO**: 10 lines → \~40 seconds vocals + 20 seconds intro/outro = 60+ seconds **Rule**: When in doubt, estimate longer rather than shorter. *** ## Using Lyrics Generation When you don't have lyrics, set `lyrics_generation: true` and provide: 1. **prompt**: Describe the topic/theme for lyrics 2. **caption**: Describe the music style (same as with manual lyrics) ### Example Request with Lyrics Generation ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key", "lyrics_generation": true, "prompt": "A song about overcoming challenges and finding inner strength, with uplifting message and emotional journey from doubt to confidence", "caption": "Inspiring pop ballad with piano and strings, building from intimate verse to powerful anthemic chorus, female vocal with emotional delivery", "duration": 180, "webhook": null, "track_id": null } ``` *** ## Instrumental Mode To generate music without vocals, set `instrumental: true`: ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key", "lyrics_generation": false, "lyrics": "[Instrumental]", "caption": "Energetic electronic dance music with driving bassline, synth melodies, and dynamic build-ups", "instrumental": true, "duration": 240, "webhook": null, "track_id": null } ``` *** ## Language Support The API supports 50+ languages. Specify the language code: | Language | Code | Language | Code | | ---------- | ---- | -------- | ---- | | English | en | Spanish | es | | Chinese | zh | French | fr | | Japanese | ja | German | de | | Korean | ko | Italian | it | | Portuguese | pt | Russian | ru | | Hindi | hi | Arabic | ar | | Cantonese | yue | Turkish | tr | [See full language table in API reference](/voice-cloning/song-generator#supported-languages) *** ## Complete Example ### Reggaeton Track with Manual Lyrics ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key", "lyrics_generation": false, "lyrics": "[Intro: Sampled Vocal Loop] (Oh-oh-oh-oh-oh-oh-oh-oh) [Chorus] Esta noche todo te lo daré Es libre ya no me amarraré Grita mi nombre, dime que me quieres Me pierdo en tus ojos como si fuera nieve [Verse 1] Tus ojos me hipnotizan, me hacen suspirar Tus labios me llaman, no puedo escapar Tus manos me tocan, siento la pasión Cada latido es una explosión [Chorus] Esta noche todo te lo daré Es libre ya no me amarraré Grita mi nombre, dime que me quieres Me pierdo en tus ojos como si fuera nieve [Bridge - whispered] Solo un instante Deja que te acerque, ven a mí [Final Chorus] Esta noche todo te lo daré Entre tus brazos me quedaré Grita mi nombre, dime que me quieres Me pierdo en tus ojos como si fuera nieve [Outro] Solo una noche más", "caption": "A modern reggaeton track with strong flamenco influence, opening with pitched vocal sample over dembow beat. Clear confident female vocal in Spanish with reverb. Deep sub-bass, crisp drum machine, plucked synth guitar riff. Layered vocals in chorus, atmospheric bridge, sparse whispered outro.", "duration": 199, "language": "es", "webhook": null, "track_id": null } ``` ### Analysis **Caption matches Lyrics:** * ✅ Caption says "reggaeton with flamenco" → Lyrics in Spanish with reggaeton structure * ✅ Caption says "confident female vocal" → Lyrics tone matches * ✅ Caption mentions "whispered outro" → Lyrics has `[Bridge - whispered]` * ✅ Duration 199 seconds appropriate for lyrics amount *** ## Best Practices Summary 1. **Caption First** — Spend time crafting detailed, specific caption 2. **Consistent Description** — Ensure caption and lyrics tell the same story 3. **Calculate Duration** — Count lyrics lines and sections, then estimate time 4. **Use Structure Tags** — Clear sections improve song structure 5. **Test Iterations** — Start simple, then refine based on results 6. **Language Matters** — Set correct language code for best pronunciation *** ## Common Mistakes to Avoid | Mistake | Fix | | ------------------------------ | ------------------------------------------ | | Too short duration for lyrics | Calculate: lines × 4 seconds + intro/outro | | Conflicting caption and lyrics | Align instruments, energy, vocal style | | Vague caption | Add specific genres, instruments, emotions | | Too many structure tags | Keep tags simple, details in caption | | No section separation | Add blank lines between sections | | Mixed incompatible styles | Either separate or describe as evolution | *** ## Getting Started 1. Start with [Song Generator API Reference](/voice-cloning/song-generator) 2. Try simple examples first 3. Iterate on caption and lyrics 4. Use webhooks for async processing 5. Join our [Discord](https://discord.com/invite/modelslab-1033301189254729748) for community support *** **Need Help?** Check our [API Reference](/voice-cloning/song-generator) or reach out via [Support](https://modelslab.com/support). # Base64 to URL Source: https://docs.modelslab.com/image-editing/base64-to-url POST /image_editing/base64_to_url This endpoint allows you to upload image in base64 format and get it in url format. ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v6/image_editing/base64_to_url' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key":"api key", "init_image":"data:image/png;base64, " } ``` # Caption Source: https://docs.modelslab.com/image-editing/caption POST /image_editing/caption This endpoint allows you to caption images. ![Caption Endpoint](https://assets.modelslab.ai/generations/d143055d-4747-47d9-adfc-5d73315cf4f0.webp) ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body to the endpoint. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v6/image_editing/caption' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key":"your_api_key", "init_image":"https://i.pinimg.com/736x/6e/ab/48/6eab481a1ee8fcfaec32a316d2768a61.jpg", "length":"long", "base64": false, "webhook": null, "track_id": null } ``` # Face Generator Source: https://docs.modelslab.com/image-editing/face-gen POST /image_editing/face_gen This endpoint allows you to generate image with the face image provided. Image url generated will not be accessible after 24 hours, kindly save your image generations accordingly. ### Facegen Face gen endpoint result ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body to the endpoint. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v6/image_editing/face_gen' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key", "prompt": "pretty woman", "negative_prompt": "anime, cartoon, drawing, big nose, long nose, fat, ugly, big lips, big mouth, face proportion mismatch, unrealistic, monochrome, lowres, bad anatomy, worst quality, low quality, blurry", "face_image":"https://assets.modelslab.ai/generations/568d6320-8b6c-4af8-8725-51c0c9f633a3", "width": "512", "height": "512", "samples": "1", "num_inference_steps": "21", "safety_checker": false, "base64": false, "seed": null, "guidance_scale": 7.5, "webhook": null, "track_id": null } ``` # Fashion Source: https://docs.modelslab.com/image-editing/fashion POST /image_editing/fashion This endpoint allows you to wear a cloth image sample on an existing model body ### Fashion Fashion endpoint result ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body to the endpoint. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v6/image_editing/fashion' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key", "prompt": ":A realistic photo of a model wearing a beautiful t-shirt", "negative_prompt": "Low quality, unrealistic, bad cloth, warped cloth", "init_image": "https://assets.modelslab.ai/generations/9f8b17c2-5b41-42da-8bcb-290710eb53bd.png", "cloth_image": "https://assets.modelslab.ai/generations/8e7ff52e-124b-4f6a-a04a-3340f41a1bc0.png", "cloth_type": "upper_body", "guidance_scale": 7.5, "num_inference_steps": 21, "seed": null, "temp": "no", "webhook": null, "track_id": null } ``` # Fetch Image Source: https://docs.modelslab.com/image-editing/fetchimage POST /image_editing/fetch/{id} Retrieve queued images using the Fetch Queued Images API. This endpoint does not generate new images, it returns already generated/queued images. ## Request Send a `POST` request to below endpoint to return the corresponding queued images. Where `{id}` is the ID returned together with the image URL in the response upon its generation.. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v6/image_editing/fetch/{id}' \ ``` ## Body ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "" } ``` # Flux Head Shot Source: https://docs.modelslab.com/image-editing/flux-headshot POST /image_editing/flux_headshot This endpoint allows you to generate head shot with flux capabilities. ### Flux Headshot Face gen endpoint result ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body to the endpoint. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v6/image_editing/flux_headshot' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key", "prompt": "pretty woman", "negative_prompt": "anime, cartoon, drawing, big nose, long nose, fat, ugly, big lips, big mouth, face proportion mismatch, unrealistic, monochrome, lowres, bad anatomy, worst quality, low quality, blurry", "face_image":"https://assets.modelslab.ai/generations/dadf8fb5-ee78-4038-b0d7-3dde65547217", "width": "1024", "height": "1024", "num_inference_steps": "21", "seed":null, "guidance_scale": 7.5, "webhook": null, "track_id": null } ``` # Flux kontext Image to Image Source: https://docs.modelslab.com/image-editing/flux-kontext-img-to-image POST /images/img2img Create high quality image from text using FLUX Kontext model. Text to image endpoint result ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v6/images/img2img' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key", "init_image": "https://assets.modelslab.ai/generations/197fdb87-3d94-4a3d-bf2b-6c1b2a73a623", "init_image_2": "https://pub-3626123a908346a7a8be8d9295f44e26.r2.dev/generations/output.jpg", "prompt": "a girl from image one holding the can from image two", "negative_prompt": "(worst quality:2), (low quality:2), (normal quality:2), (jpeg artifacts), (blurry), (duplicate), (morbid), (mutilated), (out of frame), (extra limbs), (bad anatomy), (disfigured), (deformed), (cross-eye), (glitch), (oversaturated), (overexposed), (underexposed), (bad proportions), (bad hands), (bad feet), (cloned face), (long neck), (missing arms), (missing legs), (extra fingers), (fused fingers), (poorly drawn hands), (poorly drawn face), (mutation), (deformed eyes), watermark, text, logo, signature, grainy, tiling, censored, nsfw, ugly, blurry eyes, noisy image, bad lighting, unnatural skin, asymmetry", "model_id": "flux-kontext-dev", "num_inference_steps": "28", "safety_checker": true, "strength": "0.5", "guidance": "2.5", "enhance_prompt": null } ``` # Head shot Source: https://docs.modelslab.com/image-editing/head-shot POST /image_editing/head_shot This endpoint allows you to generate head shot image. Image url generated will not be accessible after 24 hours, kindly save your image generations accordingly ### Head Shot Head-Shot endpoint result ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body to the endpoint. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v6/image_editing/head_shot' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key", "prompt": "pretty woman", "negative_prompt": "anime, cartoon, drawing, big nose, long nose, fat, ugly, big lips, big mouth, face proportion mismatch, unrealistic, monochrome, lowres, bad anatomy, worst quality, low quality, blurry", "face_image":"https://assets.modelslab.ai/generations/568d6320-8b6c-4af8-8725-51c0c9f633a3", "width": "512", "height": "512", "samples": "1", "num_inference_steps": "21", "safety_checker": false, "base64": false, "seed": null, "guidance_scale": 7.5, "webhook": null, "track_id": null } ``` # Image Mixer Source: https://docs.modelslab.com/image-editing/imagemixer POST /image_editing/img_mixer This endpoint generates image by mixing multiple images. Together with the image you can add your description of the desired result by passing prompt and negative prompt. ### Image Mixer Image-Mixer endpoint result ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body to the endpoint. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v6/image_editing/img_mixer' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key":"", "seed":12345, "init_image":[ "https://assets.modelslab.ai/generations/063c90e1-1740-410c-be84-23d379dcfee2", "https://assets.modelslab.ai/generations/8205b5be-c212-4a3e-ba74-3c824b8acc25" ], "prompt":"rose man", "negative_prompt":"A polluted city", "width":800, "height":600, "guidance_scale":10, "steps":41, "samples":1 } ``` # Inpainting Source: https://docs.modelslab.com/image-editing/inpaint POST /image_editing/inpaint This endpoint generates and returns an image from an image and a mask passed with their URLs in the request Together with the image and the mask you can add your description of the desired result by passing prompt and negative prompt. ### Inpaintin Inpainting endpoint result ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v6/image_editing/inpaint' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key", "prompt": "a cat sitting on a bench", "negative_prompt": null, "init_image": "https://raw.githubusercontent.com/CompVis/stable-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo.png", "mask_image": "https://raw.githubusercontent.com/CompVis/stable-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo_mask.png", "width": "512", "height": "512", "samples": 1, "num_inference_steps": "30", "safety_checker": "no", "guidance_scale": 5, "strength": 0.7, "base64": false, "seed": null, "webhook": null, "track_id": null } ``` # Mask Creator Source: https://docs.modelslab.com/image-editing/mask-creator POST /image_editing/mask_creator This endpoint helps to mask an object on a given image. ## Request ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v6/image_editing/mask_creator' \ ``` Make a `POST` request to below endpoint and pass the required parameters as a request body to the endpoint. ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key", "init_image": "https://i.ibb.co/kMRK2mg/image2.jpg", "specific_object": "the ball", "track_id":null, "webhook":null } ``` # Object Removal Source: https://docs.modelslab.com/image-editing/object-remover POST /image_editing/object_removal This endpoint helps to remove object from an existing image. ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body to the endpoint. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v6/image_editing/object_removal' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key", "init_image": "https://assets.modelslab.ai/generations/cc002943-8327-4a0e-899e-d0567527f84b", "mask_image": "https://assets.modelslab.ai/generations/e0cc8b55-9250-43eb-8764-9040e1eeb1ec", "track_id":null, "webhook":null } ``` # Outpainting Source: https://docs.modelslab.com/image-editing/outpaint POST /image_editing/outpaint This endpoint helps to outpaint by expanding the giving image. ### Outpaint Outpainting endpoint result ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body to the endpoint. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v6/image_editing/outpaint' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key", "seed": 12345, "width": 512, "height": 512, "prompt": "a majestic cat house, lush greenery, filled with plants, high quality, cartoonish, realistic, 4k", "image": "https://i.ibb.co/wp0w7nt/1-d212fe65-f95c-4bbe-b275-99f0dedd901a.png", "negative_prompt": "dull background, text, characters, symbols, unrealistic, repetitive background, boring background, bad, low quality, black background", "overlap_width": 32, "num_inference_steps": 15, "guidance_scale": 8.0, "temp": true, "base64": false, "webhook": null, "track_id": null } ``` # Image Editing API Source: https://docs.modelslab.com/image-editing/overview AI image editing API for face generation, inpainting, outpainting, background removal, super resolution, headshots, and object removal. ### Endpoints
This endpoint allows you to edit images using Qwen model. NEW
This endpoint allows you to caption images. NEW
Edit image from text based using flux kontext model. Allows overlaying a clothing image on a model body; inputs need white background, full-body model, and isolated clothing. This endpoint allows you to generate image with the face image provided. Generates and returns an image from an image and a mask passed with their URLs in the request. Use this endpoint to outpaint. Use this endpoint to get a super resolution version of an image by passing its URL. Use this endpoint to remove background and(or) create mask. This endpoint allows you to generate head shot with flux capabilities. This endpoint allows you to generate head shot image. Image mixers merges two images togethers to produce an eye catching result. This endpoint helps to mask an object on a given image. This endpoint helps to remove object from an existing image. This endpoint allows you to upload image in base64 format and get it in url format.
# Qwen Edit Source: https://docs.modelslab.com/image-editing/qwen-edit POST /image_editing/qwen_edit This endpoint allows you to edit images using Qwen model. ![Qwen Edit endpoint result](https://assets.modelslab.ai/generations/cc18442d-6dc0-4eb2-9c40-27fa7c59dce4.jpg) ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body to the endpoint. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v6/image_editing/qwen_edit' \ ``` The `init_image` parameter can accept a string if editing a single image or an array of strings if editing multiple images. Maximum number of images to be passed is 4. ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key":"", "prompt": "The girl holding a Pepsi can from image 2 in her left hand.", "init_image": [ "https://assets.modelslab.ai/generations/9398f98f-8b37-4d2b-98b8-04e0d22167e3.jpg", "https://assets.modelslab.ai/generations/57df2bbf-512a-4a9a-bf99-35cde14113e7.jpg" ], "safety_checker": true, "model_id": "qwen-edit-2509", "base64": false, "webhook": null, "track_id": null } ``` # Background Removal & Create mask Source: https://docs.modelslab.com/image-editing/removebg-createmask POST /image_editing/removebg_mask This endpoint removes background from image and create mask. ### Remove Background Mask removebg-createmask endpoint result ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body to the endpoint. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v6/image_editing/removebg_mask' \ ``` If you want only mask as a output then set the parameter `only_mask`:`true` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key":"", "seed":12345, "image":"https://assets.modelslab.ai/generations/31d4567d-b60a-4d09-9650-987fc0aae2cf", "post_process_mask": false, "only_mask": false, "alpha_matting":false, "webhook": null, "track_id": null } ``` # Super Resolution Source: https://docs.modelslab.com/image-editing/super-resolution POST /image_editing/super_resolution Super Resolution API returns a super resolution version of the image. ### Super Resolution Super Resolution endpoint result ## Request Send a `POST` request to below endpoint to return the corresponding super resolution image of the image passed. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v6/image_editing/super_resolution' \ ``` ### The following upscale model are supported | Model ID | Description | | ----------------------------- | --------------------------- | | RealESRGAN\_x4plus | 4x upscaling model | | RealESRGAN\_x4plus | 4x upscaling model | | RealESRGAN\_x4plus\_anime\_6B | 4x Anime upscaling model | | RealESRGAN\_x2plus | 2x upscaling model | | realesr-general-x4v3 | 4x upscaling general model | | ultra\_resolution | 4K+ upscaling general model | ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key", "init_image": "https://i.pinimg.com/564x/fc/8e/6a/fc8e6a075f341284b0f44bf1592f9f3c.jpg", "face_enhance": false, "scale": 3, "webhook": null, "track_id": null } ``` # A1111 Schedulers Source: https://docs.modelslab.com/image-generation/a1111-scheduler/a1111-schedulers List of available A1111 Diffusers Scheduler Mapping. | **A1111** | **Stable Diffusion API** | **Additional Parameters & Notes** | | ------------------- | ------------------------------- | -------------------------------------------------------------------------- | | DPM++ 2M | DPMSolverMultistepScheduler | | | DPM++ 2M Karras | DPMSolverMultistepScheduler | init with `use_karras_sigmas="yes"` | | DPM++ 2M SDE | DPMSolverMultistepScheduler | init with `algorithm_type="dpmsolver+++"` | | DPM++ 2M SDE Karras | DPMSolverMultistepScheduler | init with `algorithm_type="dpmsolver+++"` and `use_karras_sigmas="yes"` | | DPM++ 2S a | N/A | Very similar to DPMSolverMultistepScheduler | | DPM++ 2S a Karras | N/A | Very similar to DPMSolverMultistepScheduler with use\_karras\_sigmas="yes" | | DPM++ SDE | DPMSolverSinglestepScheduler | | | DPM++ SDE Karras | DPMSolverSinglestepScheduler | init with `use_karras_sigmas="yes"` | | DPM2 | KDPM2DiscreteScheduler | | | DPM2 Karras | KDPM2DiscreteScheduler | init with `use_karras_sigmas="yes"` | | DPM2 a | KDPM2AncestralDiscreteScheduler | | | DPM2 a Karras | KDPM2AncestralDiscreteScheduler | init with `use_karras_sigmas="yes"` | | DPM adaptive | N/A | | | DPM fast | N/A | | | Euler | EulerDiscreteScheduler | | | Euler a | EulerAncestralDiscreteScheduler | | | Heun | HeunDiscreteScheduler | | | LMS | LMSDiscreteScheduler | | | LMS Karras | LMSDiscreteScheduler | Init with `use_karras_sigmas="yes"` | | N/A | DEIS | | | N/A | UniPCMultistepScheduler | | | N/A | LCMScheduler | | # A1111 Schedulers Source: https://docs.modelslab.com/image-generation/a1111-scheduler/overview Configure Automatic1111-compatible schedulers for Stable Diffusion image generation. Full list of supported sampling methods and schedulers. Get the list of available A1111 Diffusers Scheduler Mapping # Fetch Queued Images Source: https://docs.modelslab.com/image-generation/community-models/dreambooth-fetch-queue-image POST /fetch Fetch Queued Images API fetches queued images. This endpoint does not generate new images, it returns already generated/queued images. ## Request Send a `POST` request to below endpoint to return the corresponding queued images,specified by the **request\_id** parameter in the request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v6/images/fetch' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key", "request_id": "your_request_id" } ``` # Image to Image Source: https://docs.modelslab.com/image-generation/community-models/dreambooth-image-to-image POST /img2img Dreambooth Image to Image API is used to generate an image from an image based on trained or on public models. The dimensions of the generated image will be the same as the dimensions of the init\_image. You can find a list of the public models available and their IDs [here](https://modelslab.com/models?base_model%5B0%5D=sdxl-10\&base_model%5B1%5D=sd-15\&base_model%5B2%5D=flux-1-d\&base_model%5B3%5D=pony\&feature=imagen\&model_type%5B0%5D=checkpoint\&sort=recommended) Image to image endpoint result ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body to the endpoint. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v6/images/img2img' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key", "model_id": "realistic-vision-51", "prompt": "women playing tennis", "negative_prompt": null, "init_image": "https://i.pinimg.com/736x/20/ab/3d/20ab3df5c180e1cae812020bcfeb3093.jpg", "samples": "1", "num_inference_steps": "31", "safety_checker": "yes", "guidance_scale": 7.5, "strength": 0.7, "scheduler": "UniPCMultistepScheduler", "seed": null, "lora_model": null, "use_karras_sigmas": "yes", "vae": null, "lora_strength": null, "webhook": null, "track_id": null } ``` # Inpainting Source: https://docs.modelslab.com/image-generation/community-models/dreambooth-inpainting POST /inpaint Inapint some part in a given image. Inpainting endpoint result You can find a list of the public models available and their IDs [here](https://modelslab.com/models?base_model%5B0%5D=sdxl-10\&base_model%5B1%5D=sd-15\&base_model%5B2%5D=flux-1-d\&base_model%5B3%5D=pony\&feature=imagen\&model_type%5B0%5D=checkpoint\&sort=recommended) ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v6/images/inpaint' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key", "model_id": "lazymixv4-inpaint", "prompt": "a cat sitting on a bench", "negative_prompt": null, "init_image": "https://raw.githubusercontent.com/CompVis/stable-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo.png", "mask_image": "https://raw.githubusercontent.com/CompVis/stable-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo_mask.png", "width": "512", "height": "512", "samples": "1", "steps": "21", "safety_checker": "no", "guidance_scale": 7.5, "strength": 0.7, "scheduler": "UniPCMultistepScheduler", "lora_model": null, "use_karras_sigmas": "yes", "vae": null, "lora_strength": null, "seed": null, "webhook": null, "track_id": null } ``` # LoRA Source: https://docs.modelslab.com/image-generation/community-models/dreambooth-lora POST /text2img The LoRA is used to create image from text, using LoRA models, based on trained or on public models. To apply multiple LoRA models, provide a comma-separated list in the `lora_model` field, e.g., `"more_details,anime"`. You can find a list of the public and LoRA models available and their IDs **[here](https://modelslab.com/models)**. ## Request Make a `POST` request to below endpoint and pass the required parameters in the request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v6/images/text2img' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key", "model_id": "tamarin-xl-v1", "prompt": "actual 8K portrait photo of gareth person, portrait, happy colors, bright eyes, clear eyes, warm smile, smooth soft skin, big dreamy eyes, beautiful intricate colored hair, symmetrical, anime wide eyes, soft lighting, detailed face, by makoto shinkai, stanley artgerm lau, wlop, rossdraws, concept art, digital painting, looking into camera", "negative_prompt": "painting, extra fingers, mutated hands, poorly drawn hands, poorly drawn face, deformed, ugly, blurry, bad anatomy, bad proportions, extra limbs, cloned face, skinny, glitchy, double torso, extra arms, extra hands, mangled fingers, missing lips, ugly face, distorted face, extra legs, anime", "width": "512", "height": "512", "samples": "1", "num_inference_steps": "31", "safety_checker": "no", "seed": null, "guidance_scale": 7.5, "upscale": "no", "lora_strength": "0.45", "lora_model": "xl-realistic-cake-art-sty", "scheduler": "UniPCMultistepScheduler", "webhook": null, "track_id": null } ``` # Multi LoRA Source: https://docs.modelslab.com/image-generation/community-models/dreambooth-lora-multi POST /text2img Create images from text using a variety of LoRA models. You can find a list of the public and LoRA models available and their IDs **[here](https://modelslab.com/models)**. ## Request Make a `POST` request to below endpoint and pass the required parameters in the request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v6/images/text2img' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key":"your_api_key", "model_id": "f222-diffusion", "prompt": "a female model doing photoshoot, ultra realistic face, ultra high resolution, 4K image", "negative_prompt": "painting, extra fingers, mutated hands, poorly drawn hands, poorly drawn face, deformed, ugly, blurry, bad anatomy, bad proportions, extra limbs, cloned face, skinny, glitchy, double torso, extra arms, extra hands, mangled fingers, missing lips, ugly face, distorted face, extra legs, anime", "width": "512", "height": "512", "samples": "1", "num_inference_steps": "31", "safety_checker": "yes", "seed": null, "guidance_scale": 7.5, "upscale": "no", "lora_model": "teddy-jacket-v1-0,a-simple-china-dress-v6-0", "lora_strength": "0.45,0.55", "scheduler": "UniPCMultistepScheduler", "webhook": null, "track_id": null } ``` # Reload Model Source: https://docs.modelslab.com/image-generation/community-models/dreambooth-reload-model POST /model_reload Reload Model API is used to reload an idle model that has not been used for more than 7 days. After 7 days of inactivity, a model will be removed from the inference server. To use it again, make an API call to the Reload Model endpoint to reload the model. It will take **2 minutes** to reload a model. ## Request Send a `POST` request to below endpoint to reload a specific model specified by the **model\_id** parameter in the request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v6/images/model_reload' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key", "model_id": "model_id" } ``` # Text to Image Source: https://docs.modelslab.com/image-generation/community-models/dreambooth-text-to-image POST /text2img The Dreambooth Text to Image API is used to create image from text based on trained or on public models. You can make an API call to your trained models as well as to any public model. You can find a list of the public models available and their IDs [here](https://modelslab.com/models?base_model%5B0%5D=sdxl-10\&base_model%5B1%5D=sd-15\&base_model%5B2%5D=flux-1-d\&base_model%5B3%5D=pony\&feature=imagen\&model_type%5B0%5D=checkpoint\&sort=recommended) Text to image endpoint result ## Request Make a `POST` request to endpoint and pass the required parameters as a request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v6/images/text2img' \ ``` ## Body **The model\_id:"flux" does not support the following parameters `negative_prompt`, `enhance_prompt`,`enhance_style`, `lora trained on SD models`, `ip_adaptors`, `upscale` and `highres_fix` .** You can also use multi Lora. Just make sure to pass comma saparated lora model ids to the `lora_model` as `"more_details,animie"` in the request body. ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key", "model_id": "your_model_id", "prompt": "ultra realistic close up portrait ((beautiful pale cyberpunk female with heavy black eyeliner)), blue eyes, shaved side haircut, hyper detail, cinematic lighting, magic neon, dark red city, Canon EOS R3, nikon, f/1.4, ISO 200, 1/160s, 8K, RAW, unedited, symmetrical balance, in-frame, 8K", "negative_prompt": "", "enhance_prompt":"yes", "width": "512", "height": "512", "samples": "1", "num_inference_steps": "31", "safety_checker": "no", "seed": null, "guidance_scale": 7.5, "upscale": "no", "lora_model": null, "clip_skip": "2", "use_karras_sigmas": "yes", "vae": null, "lora_strength": null, "scheduler": "UniPCMultistepScheduler", "webhook": null, "track_id": null } ``` # Community Models - DreamBooth API Source: https://docs.modelslab.com/image-generation/community-models/overview Access 10,000+ community-trained Stable Diffusion models via DreamBooth API. Text-to-image, image-to-image, inpainting, and LoRA support. Currently the API supports the following image formats: **PNG** and **JPG**. You can find a list of available community models as well as their IDs [here](https://modelslab.com/models). ### Endpoints Fetch Queued Images API fetches queued images Dreambooth Image to Image API is used to generate an image from an image based on trained or on public models. Inapint some part in a given image. Create images from text using a variety of LoRA models. The LoRA is used to create image from text, using LoRA models, based on trained or on public models. Reload Model API is used to reload an idle model that has not been used for more than 7 days. The Dreambooth Text to Image API is used to create image from text based on trained or on public models. # ControlNet Main Source: https://docs.modelslab.com/image-generation/controlnet/controlnet-main POST /controlnet Control Stable Diffusion generations with ControlNet. The ControlNet [models](#models) are available in this API. You can also use this endpoint to inpaint images with ControlNet. Just make sure to pass the link to the `mask_image` in the request body and use the `controlnet_model` parameter with "inpaint" value. Contonet image ## Request Send a `POST` request to below endpoint. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v5/controlnet' \ ``` ## Models ControlNet API using ControlNet 1.1 as the default: Supported ControlNet Models: For Flux ControlNet, use ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} `model_id`: `fluxdev` ``` which supports following controlnet types: `canny`, `tile`, `depth` , `blur`, `pose`, `gray` and `low_quality`. | **ControlNet Model/Type** | **SDXL** | **SD1.5** | **FluxDev** | | ------------------------- | -------- | --------- | ----------- | | **Canny** | Yes | Yes | Yes | | **Tile** | Yes | Yes | Yes | | **Depth** | Yes | Yes | Yes | | **Blur** | Yes | Yes | Yes | | **Pose** | Yes | Yes | Yes | | **MLSD** | Yes | Yes | No | | **Lineart** | Yes | Yes | No | | **HED** | Yes | Yes | No | | **Normal** | Yes | Yes | No | | **OpenPose** | Yes | Yes | No | | **Segmentation** | Yes | Yes | No | | **Inpaint** | Yes | Yes | No | | **SoftEdge** | Yes | Yes | No | | **Shuffle** | Yes | Yes | No | | **QRCode** | Yes | Yes | No | | **Low Quality** | No | No | Yes | | **Gray** | No | No | Yes | ### ControlNet Types Overview | Type | Description | Best For | | ------------- | ----------------------- | --------------------------------------- | | **Canny** | Edge detection | Line art, outlines, structural control | | **Depth** | Depth map control | 3D structure, perspective control | | **HED** | Advanced edge detection | Detailed edge preservation | | **MLSD** | Line segment detection | Architecture, geometric structures | | **Normal** | Surface normal maps | 3D lighting, surface details | | **Scribble** | Sketch to image | Converting drawings to realistic images | | **In-Paint** | Fill masked areas | Removing or replacing objects | | **Soft Edge** | Smooth edge detection | Natural, organic shapes | | **Line Art** | Clean line art | Anime, cartoon, illustration styles | ### Key Parameters * **controlnet\_type** & **controlnet\_model**: Must match the desired control method * **auto\_hint**: Set to "yes" to automatically process input images * **controlnet\_conditioning\_scale**: Controls strength (0.1-2.0, default 0.5-1.0) * **init\_image**: Source image for control guidance * **mask\_image**: Required only for inpainting ## Body You can also use multi ControlNet. Just make sure to pass comma separated controlnet models to the `controlnet_model` as `canny,depth` and `init_image` in the request body. # ControlNet API Examples ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key", "controlnet_model": "canny", "controlnet_type": "canny", "model_id": "realistic-vision-51", "auto_hint": "yes", "guess_mode": "no", "prompt": "a girl, wearing red bikini, looking at camera, ocean in background", "negative_prompt": "human, unstructure, (black object, white object), colorful background, nsfw", "init_image": "https://assets.modelslab.ai/generations/a8572240-3040-4fd8-b9f4-aeaaf4fe287d", "mask_image": null, "width": "512", "height": "512", "samples": "1", "scheduler": "UniPCMultistepScheduler", "num_inference_steps": "30", "safety_checker": "no", "enhance_prompt": "yes", "guidance_scale": 7.5, "strength": 0.55, "seed": null, "webhook": null, "track_id": null } ``` ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key", "controlnet_model": "depth", "controlnet_type": "depth", "model_id": "realistic-vision-51", "auto_hint": "yes", "guess_mode": "no", "prompt": "baby, smiling", "negative_prompt": null, "init_image": "https://img.freepik.com/free-photo/adorable-baby-boy-smiling-camera-blurred-background_132075-10819.jpg", "mask_image": null, "width": "512", "height": "512", "samples": "1", "scheduler": "UniPCMultistepScheduler", "num_inference_steps": "30", "safety_checker": "no", "enhance_prompt": "yes", "guidance_scale": 7.5, "strength": 0.55, "seed": null, "webhook": null, "track_id": null } ``` ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key", "controlnet_model": "hed", "controlnet_type": "hed", "model_id": "realistic-vision-51", "auto_hint": "yes", "guess_mode": "no", "prompt": "baby, smiling", "negative_prompt": null, "init_image": "https://images-ext-1.discordapp.net/external/XM1tvX0cyqZOqfpRdT2BnzhaZo-Z525hXaSAD46gHJY/https/i.pinimg.com/736x/b0/a6/49/b0a649108926efec22c2fd055208955a.jpg", "mask_image": null, "width": "512", "height": "512", "samples": "1", "scheduler": "UniPCMultistepScheduler", "num_inference_steps": "30", "safety_checker": "no", "enhance_prompt": "yes", "guidance_scale": 7.5, "strength": 0.55, "seed": null, "webhook": null, "track_id": null } ``` ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key", "controlnet_model": "mlsd", "controlnet_type": "mlsd", "model_id": "realistic-vision-51", "auto_hint": "yes", "guess_mode": "no", "prompt": "ROOM INTERIOR, OLD SCHOOL, VINTAGE", "negative_prompt": null, "init_image": "https://images-ext-1.discordapp.net/external/f_MuFioFIYcAuhbGrCXkiDfRJq1nZd-L0z_DibDpMc0/https/i.pinimg.com/736x/8a/2b/1e/8a2b1e6ca4779d787ae3c98b7b1100b2.jpg", "mask_image": null, "width": "512", "height": "512", "samples": "1", "scheduler": "UniPCMultistepScheduler", "num_inference_steps": "30", "safety_checker": "no", "enhance_prompt": "yes", "guidance_scale": 7.5, "strength": 0.55, "seed": null, "webhook": null, "track_id": null } ``` ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key", "controlnet_model": "normal", "controlnet_type": "normal", "model_id": "realistic-vision-51", "auto_hint": "yes", "guess_mode": "no", "prompt": "a woman, posing", "negative_prompt": null, "init_image": "https://images-ext-1.discordapp.net/external/ZOjUvfZxcvlnt84xav_fDdIzXPuuMXcW9fA46OaZSTs/https/i.pinimg.com/736x/9d/09/ff/9d09ff904e082395f71aa12f5c83ea77.jpg", "mask_image": null, "width": "512", "height": "512", "samples": "1", "scheduler": "UniPCMultistepScheduler", "num_inference_steps": "30", "safety_checker": "no", "enhance_prompt": "yes", "guidance_scale": 7.5, "strength": 0.55, "seed": null, "webhook": null, "track_id": null } ``` ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key", "controlnet_model": "scribble", "controlnet_type": "scribble", "model_id": "realistic-vision-51", "auto_hint": "yes", "guess_mode": "no", "prompt": "a woman, posing", "negative_prompt": null, "init_image": "https://images-ext-1.discordapp.net/external/2p2KWmaWToQXVSKJnVDbmjaHJHr1-Cx4F84O8l7mhEE/https/i.pinimg.com/736x/30/0c/20/300c209d4a1396c89bf7ea32eefcce95.jpg", "mask_image": null, "width": "512", "height": "512", "samples": "1", "scheduler": "UniPCMultistepScheduler", "num_inference_steps": "30", "safety_checker": "no", "enhance_prompt": "yes", "guidance_scale": 7.5, "strength": 0.55, "seed": null, "webhook": null, "track_id": null } ``` ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key", "controlnet_model": "inpaint", "controlnet_type": "inpaint", "model_id": "realistic-vision-51", "auto_hint": "yes", "guess_mode": "no", "prompt": "bearded man", "negative_prompt": null, "init_image": "https://images-ext-1.discordapp.net/external/oo7VfGo6xDAXQIRP_k3RB5c7l4oEv4grWgkeG4xdUvc/https/i.pinimg.com/736x/0e/04/e0/0e04e00081774f01efd980f1c99ba69a.jpg", "mask_image": "https://images-ext-1.discordapp.net/external/fn7yNKSonZwSLzvprcJR5pCiacxwsaEIHQO54dK3Y7E/https/i.pinimg.com/736x/98/23/64/98236482e403a18695caaac6aac733ba.jpg", "width": "512", "height": "512", "samples": "1", "scheduler": "UniPCMultistepScheduler", "num_inference_steps": "30", "safety_checker": "no", "enhance_prompt": "yes", "guidance_scale": 7.5, "strength": 0.55, "seed": null, "webhook": null, "track_id": null } ``` ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key", "controlnet_model": "softedge", "controlnet_type": "softedge", "model_id": "realistic-vision-51", "auto_hint": "yes", "guess_mode": "no", "prompt": "man", "negative_prompt": null, "init_image": "https://images-ext-1.discordapp.net/external/XGH2QUbobf3UWY6ldA9hOp9lhV8FZvCpZfmbZAvceeY/https/i.pinimg.com/736x/49/cc/b4/49ccb461e72b11f5d5f297eb267365c9.jpg", "mask_image": "", "width": "512", "height": "512", "samples": "1", "scheduler": "UniPCMultistepScheduler", "num_inference_steps": "30", "safety_checker": "no", "enhance_prompt": "yes", "guidance_scale": 7.5, "strength": 0.55, "seed": null, "webhook": null, "track_id": null } ``` ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key", "controlnet_model": "lineart", "controlnet_type": "lineart", "model_id": "realistic-vision-51", "auto_hint": "yes", "guess_mode": "no", "prompt": "beautiful girl", "negative_prompt": null, "init_image": "https://www.shutterstock.com/image-illustration/beautiful-anima-samurai-girl-katana-600nw-2111398124.jpg", "mask_image": "", "width": "512", "height": "512", "samples": "1", "scheduler": "UniPCMultistepScheduler", "num_inference_steps": "30", "safety_checker": "no", "enhance_prompt": "yes", "guidance_scale": 7.5, "strength": 0.55, "seed": null, "webhook": null, "track_id": null } ``` ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key", "model_id": "boziorealvisxlv4", "init_image": "https://i.pinimg.com/736x/03/a0/4d/03a04d738c9aba3c4b84caa3a5b912ae.jpg", "prompt": "hot girl wearing, pink dress, high quality, 4k", "negative_prompt": "(normal quality), (low quality), (worst quality), Scandinavian Living Room paintings, sketches, fog, signature, soft, blurry, drawing, sketch, poor quality, ugly text, type, word, logo, pixelated, low resolution, saturated, high contrast, oversharpened, dirt", "auto_hint": "yes", "guess_mode": "no", "strength": 1, "controlnet_conditioning_scale": "0.5", "guidance_scale": 5, "tomesd": "yes", "seed": null, "samples": 1, "num_inference_steps": 21, "webhook": null, "track_id": null, "scheduler": "DPMSolverMultistepScheduler", "use_karras_sigmas": "yes", "base64": null, "clip_skip": 2, "controlnet_type": "canny", "controlnet_model": "canny", "upscale": "no" } ``` ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key", "model_id": "boziorealvisxlv4", "init_image": "https://i.pinimg.com/736x/03/a0/4d/03a04d738c9aba3c4b84caa3a5b912ae.jpg", "prompt": "hot girl wearing, pink dress, high quality, 4k", "negative_prompt": "(normal quality), (low quality), (worst quality), Scandinavian Living Room paintings, sketches, fog, signature, soft, blurry, drawing, sketch, poor quality, ugly text, type, word, logo, pixelated, low resolution, saturated, high contrast, oversharpened, dirt", "auto_hint": "yes", "guess_mode": "no", "strength": 1, "controlnet_conditioning_scale": "0.5", "guidance_scale": 5, "tomesd": "yes", "seed": null, "samples": 1, "num_inference_steps": 21, "webhook": null, "track_id": null, "scheduler": "DPMSolverMultistepScheduler", "use_karras_sigmas": "yes", "base64": null, "clip_skip": 2, "controlnet_type": "depth", "controlnet_model": "depth", "upscale": "no" } ``` # ControlNet Multi Source: https://docs.modelslab.com/image-generation/controlnet/controlnet-multi POST /controlnet Control Stable Diffusion generations with Multi ControlNet. The ControlNet [models](#models) are available in this API. You can also use this endpoint to inpaint images with ControlNet. Just make sure to pass the link to the `mask_image` in the request body and use the `controlnet_model` parameter with "inpaint" value. ## Request Send a `POST` request to below endpoint. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v5/controlnet' \ ``` ## Body You can also use multi ControlNet. Just make sure to pass comma separated ControlNet models to the `controlnet_model` as `canny,depth` and `init_image` in the request body. ### Models ControlNet API using Controlnet 1.1 as default: Suported controlnet\_model: * canny * depth * hed * mlsd * normal * openpose * scribble * segmentation * inpaint * softedge * lineart * shuffle * tile * face\_detector * qrcode ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key", "controlnet_model": "openpose,canny,face_detector", "controlnet_type" :"openpose", "model_id": "midjourney", "auto_hint": "yes", "guess_mode" : "yes", "prompt": "human model doing photoshoot, ultra realistic face, ultra high resolution, 4K image", "negative_prompt": null, "control_image":"https://assets.modelslab.ai/generations/a8572240-3040-4fd8-b9f4-aeaaf4fe287d", "init_image": "https://assets.modelslab.ai/generations/a8572240-3040-4fd8-b9f4-aeaaf4fe287d", "mask_image": null, "width": "512", "height": "512", "samples": "1", "scheduler": "UniPCMultistepScheduler", "num_inference_steps": "30", "safety_checker": "no", "enhance_prompt": "yes", "guidance_scale": 7.5, "controlnet_conditioning_scale": 0.7, "strength": 0.55, "lora_model": "yae-miko-genshin,more_details", "clip_skip": "2", "tomesd": "yes", "use_karras_sigmas": "yes", "lora_strength": null, "seed": null, "webhook": null, "track_id": null } ``` # ControlNet API Source: https://docs.modelslab.com/image-generation/controlnet/overview Control AI image generation with ControlNet. Guide outputs using edge detection, pose estimation, depth maps, and other conditioning methods. ### Endpoints The ControlNet API provides more control over the generated images. It also supports providing multiple ControlNet models. The ControlNet API provides more control over the generated images. It also supports providing multiple ControlNet models. # Text to Image Source: https://docs.modelslab.com/image-generation/flux/flux-text-to-image POST /text2img Create high quality images from text using the FLUX model. Text to image endpoint result Generate photorealistic images from text descriptions using the FLUX model. FLUX excels at creating highly detailed, realistic images with excellent prompt adherence. You can apply LoRA models to your FLUX generations using the `lora_model` parameter. To use multiple LoRAs, pass comma-separated LoRA model IDs to `lora_model` (e.g. `"more_details,animie"`) and matching comma-separated weights to `lora_strength` (e.g. `"0.8,0.6"`). ## Request Make a `POST` request to the endpoint below with the required parameters. ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} POST https://modelslab.com/api/v6/images/text2img ``` ## Parameters Your API key for authentication. Get one from your [dashboard](https://modelslab.com/dashboard/api-keys). The model to use for generation. Use `flux` for the FLUX model. Text description of the image you want to generate. Be specific and detailed for best results. Things you don't want in the image. Example: "blurry, low quality, distorted" Image width in pixels. Must be between 256-1024 and divisible by 8. Image height in pixels. Must be between 256-1024 and divisible by 8. Number of images to generate. Range: 1-4. Number of denoising steps. Higher values produce more detailed images but take longer. Range: 20-50. How closely to follow the prompt. Higher values = more literal interpretation. Range: 1-20. Enable NSFW content filter. Values: "yes" or "no". Random seed for reproducible results. Use the same seed with same parameters to get identical images. Number of CLIP layers to skip. Affects style interpretation. Range: 1-4. The LoRA model ID to apply during generation. For multiple LoRAs, pass comma-separated model IDs, e.g. `"more_details,animie"`. The strength (weight) applied to the LoRA model. For multiple LoRAs, pass comma-separated values matching the order of `lora_model`, e.g. `"0.8,0.6"`. URL to receive a POST request when generation completes. See [Webhooks](/webhooks). Your custom identifier to track this request. Returned in response and webhook. ## Request Example ```json Body theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key", "model_id": "flux", "prompt": "ultra realistic close up portrait ((beautiful pale cyberpunk female with heavy black eyeliner)), blue eyes, shaved side haircut, hyper detail, cinematic lighting, magic neon, dark red city, Canon EOS R3, nikon, f/1.4, ISO 200, 1/160s, 8K, RAW, unedited, symmetrical balance, in-frame, 8K", "negative_prompt": "blurry, low quality, distorted, deformed", "width": 512, "height": 512, "samples": 1, "num_inference_steps": 31, "safety_checker": "no", "seed": null, "guidance_scale": 7.5, "clip_skip": 2, "lora_model": "more_details", "lora_strength": "0.8", "webhook": null, "track_id": null } ``` ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}} import requests response = requests.post( "https://modelslab.com/api/v6/images/text2img", json={ "key": "your_api_key", "model_id": "flux", "prompt": "ultra realistic portrait of a cyberpunk woman, blue eyes, cinematic lighting, 8K", "negative_prompt": "blurry, low quality, distorted", "width": 512, "height": 512, "samples": 1, "num_inference_steps": 31, "guidance_scale": 7.5 } ) data = response.json() print(data) ``` ```javascript JavaScript theme={"theme":{"light":"github-light","dark":"github-dark"}} const response = await fetch("https://modelslab.com/api/v6/images/text2img", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ key: "your_api_key", model_id: "flux", prompt: "ultra realistic portrait of a cyberpunk woman, blue eyes, cinematic lighting, 8K", negative_prompt: "blurry, low quality, distorted", width: 512, height: 512, samples: 1, num_inference_steps: 31, guidance_scale: 7.5 }) }); const data = await response.json(); console.log(data); ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"github-dark"}} curl -X POST "https://modelslab.com/api/v6/images/text2img" \ -H "Content-Type: application/json" \ -d '{ "key": "your_api_key", "model_id": "flux", "prompt": "ultra realistic portrait of a cyberpunk woman, blue eyes, cinematic lighting, 8K", "negative_prompt": "blurry, low quality, distorted", "width": 512, "height": 512, "samples": 1, "num_inference_steps": 31, "guidance_scale": 7.5 }' ``` ## Response ### Success Response When the image is generated successfully: ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "status": "success", "generationTime": 2.45, "id": 12345678, "output": [ "https://pub-3626123a908346a7a8be8d9295f44e26.r2.dev/generations/abc123.png" ], "proxy_links": { "0": "https://cdn.modelslab.com/generations/abc123.png" }, "meta": { "prompt": "ultra realistic portrait...", "model_id": "flux", "width": 512, "height": 512, "seed": 12345 } } ``` ### Processing Response For complex requests, you may receive a processing status: ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "status": "processing", "id": 12345678, "eta": 10, "message": "Your request is being processed" } ``` When you receive a processing response, use the [Fetch endpoint](/image-generation/community-models/dreambooth-fetch-queue-image) to poll for results. ### Error Response ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "status": "error", "message": "prompt is required" } ``` ## Response Fields | Field | Type | Description | | ---------------- | ------- | -------------------------------------- | | `status` | string | "success", "processing", or "error" | | `id` | integer | Unique request identifier | | `output` | array | URLs of generated images | | `proxy_links` | object | CDN-optimized URLs for faster delivery | | `generationTime` | float | Time taken to generate (seconds) | | `meta` | object | Generation parameters used | ## Tips for Better Results FLUX responds well to detailed, specific prompts. Include: * Subject description * Style (photorealistic, cinematic, etc.) * Lighting details * Camera settings (for photorealistic images) Always include a negative prompt to avoid common issues: ``` "blurry, low quality, distorted, deformed, ugly, bad anatomy" ``` * **Lower (3-7)**: More creative, varied results * **Higher (8-15)**: More literal prompt adherence * **Default (7.5)**: Good balance for most use cases Use the `lora_model` parameter to apply a LoRA and fine-tune the style or subject of your generation: * Pass a single LoRA ID, e.g. `"more_details"`. * For multiple LoRAs, pass comma-separated IDs to `lora_model` and matching weights to `lora_strength`. * Tune `lora_strength` (typically `0.6`–`1.0`) to control how strongly each LoRA is applied. ## Related Endpoints Transform existing images with FLUX Retrieve results for processing requests # FLUX Image Generation API Source: https://docs.modelslab.com/image-generation/flux/overview Generate high-quality AI images with FLUX models. Text-to-image generation using state-of-the-art FLUX architecture via ModelsLab API. ### Endpoints Create image from text based using flux model. # Image to Image Source: https://docs.modelslab.com/image-generation/hidream-o1/image-to-image image-generation/hidream-o1/openapi.json POST /img2img Transform existing images using the HiDream O1 model. The dimensions of the generated image will be the same as the dimensions of the init\_image. Transform existing images with text guidance using the HiDream O1 model. ## Request Make a `POST` request to the endpoint below with the required parameters. ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} POST https://modelslab.com/api/v6/images/img2img ``` ### Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key", "model_id": "hidream-o1", "prompt": "a cat sitting on a bench, oil painting style", "negative_prompt": "blurry, low quality", "init_image": "https://raw.githubusercontent.com/CompVis/stable-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo.png", "strength": 0.7, "width": 2048, "height": 2048, "samples": 1, "num_inference_steps": 31, "safety_checker": "no", "seed": null, "guidance_scale": 7.5, "webhook": null, "track_id": null } ``` # HiDream O1 Image Generation API Source: https://docs.modelslab.com/image-generation/hidream-o1/overview Generate high-quality AI images with the HiDream O1 model. Text-to-image and image-to-image generation using the HiDream O1 architecture via ModelsLab API. ### Endpoints Create images from text using the HiDream O1 model. Transform existing images with HiDream O1. # Text to Image Source: https://docs.modelslab.com/image-generation/hidream-o1/text-to-image image-generation/hidream-o1/openapi.json POST /text2img Create high quality images from text using the HiDream O1 model. Generate photorealistic images from text descriptions using the HiDream O1 model. HiDream O1 excels at creating highly detailed, realistic images with excellent prompt adherence. ## Request Make a `POST` request to the endpoint below with the required parameters. ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} POST https://modelslab.com/api/v6/images/text2img ``` ### Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key", "model_id": "hidream-o1", "prompt": "ultra realistic close up portrait ((beautiful pale cyberpunk female with heavy black eyeliner)), blue eyes, shaved side haircut, hyper detail, cinematic lighting, magic neon, dark red city, Canon EOS R3, nikon, f/1.4, ISO 200, 1/160s, 8K, RAW, unedited, symmetrical balance, in-frame, 8K", "negative_prompt": "blurry, low quality, distorted, deformed", "width": "1024", "height": "1024", "samples": "1", "num_inference_steps": "31", "safety_checker": "no", "seed": null, "guidance_scale": 7.5, "clip_skip": "2", "webhook": null, "track_id": null } ``` # Krea 2 Turbo Image Generation API Source: https://docs.modelslab.com/image-generation/krea-2-turbo/overview Generate high-quality AI images with the Krea 2 Turbo model. Text-to-image generation using the Krea 2 Turbo architecture via ModelsLab API. ### Endpoints Create images from text using the Krea 2 Turbo model. # Text to Image Source: https://docs.modelslab.com/image-generation/krea-2-turbo/text-to-image image-generation/krea-2-turbo/openapi.json POST /text2img Create high quality images from text using the Krea 2 Turbo model. Generate photorealistic images from text descriptions using the Krea 2 Turbo model. Krea 2 Turbo excels at creating highly detailed, realistic images with excellent prompt adherence. Maximum dimensions are **1488×1200** or **1200×1488** (portrait/landscape). 1488×1488 is not supported. ## Request Make a `POST` request to the endpoint below with the required parameters. ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} POST https://modelslab.com/api/v6/images/text2img ``` ### Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key", "model_id": "krea-2-turbo", "prompt": "ultra realistic close up portrait ((beautiful pale cyberpunk female with heavy black eyeliner)), blue eyes, shaved side haircut, hyper detail, cinematic lighting, magic neon, dark red city, Canon EOS R3, nikon, f/1.4, ISO 200, 1/160s, 8K, RAW, unedited, symmetrical balance, in-frame, 8K", "negative_prompt": "blurry, low quality, distorted, deformed", "width": "1024", "height": "1024", "samples": "1", "num_inference_steps": "31", "safety_checker": "no", "seed": null, "guidance_scale": 7.5, "webhook": null, "track_id": null } ``` # Get Trained Models List Source: https://docs.modelslab.com/image-generation/model-operation/finetune-list POST /finetune_list This endpoint returns an array with the IDs of the models that you have created. ## Request Send a `POST` request to below endpoint to obtain a list with model IDs. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v3/finetune_list' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key" } ``` # Get Public Models List Source: https://docs.modelslab.com/image-generation/model-operation/model-list POST /model_list This endpoint returns a list of all the public models available. ## Request Send a `POST` request to below endpoint to obtain a list with the available public models and their IDs. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v4/dreambooth/model_list' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key" } ``` # Model Operations API Source: https://docs.modelslab.com/image-generation/model-operation/overview Manage AI models on ModelsLab. List available models, upload custom models, and retrieve fine-tuned model information via API. ## Endpoints This endpoint returns an array with the IDs of the models that you have created. This endpoint is used to load a private or public model This endpoint returns a list of all the public models available. # Upload Model Source: https://docs.modelslab.com/image-generation/model-operation/upload-model POST /load_model This endpoint is used to load a private or public model ## Request Send a `POST` request to below endpoint. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v3/load_model' \ ``` ## Load a ckpt or safetensors Model from Civitai ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key", "url": "https://civitai.com/api/download/models/132760?type=Model&format=SafeTensor&size=pruned&fp=fp16", "revision": "fp32", "model_id": "stable-diffusion-1.0-inpainting-0.1", "force_load": "yes", "model_category": "stable_diffusion_xl", "model_format": "safetensors", "model_visibility": "public", "model_name": "stable-diffusion-1.0-inpainting-0.1", "model_image": "https://assets.modelslab.ai/generations/95aebdb1-302f-42c4-b461-64b6ce9214e4", "hf_upload": "no" } ``` ## Load a diffusers model ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key", "url": "diffusers/stable-diffusion-xl-1.0-inpainting-0.1", "model_id": "stable-diffusion-xl-1.0-inpainting-0.1", "force_load": "yes", "revision": "fp16", "model_category": "stable_diffusion_xl", "model_format": "diffusers", "model_visibility": "public", "model_name": "stable-diffusion-xl-1.0-inpainting-0.1", "model_image": "https://assets.modelslab.ai/generations/95aebdb1-302f-42c4-b461-64b6ce9214e4", "hf_upload": "no" } ``` # Image Generation API Source: https://docs.modelslab.com/image-generation/overview Generate stunning AI images with 10,000+ Stable Diffusion models, FLUX, ControlNet, and community models via ModelsLab's Image Generation API. ### Categories Collection of APIs that lets you generate images in seconds. Generate higher quality images with Flux family of models. Generate high-quality images with the HiDream O1 model. Generate high-quality images with Pony models. Generate images with the NanoBanana Lite Pretrained model. Collection of APIs that lets you use Community LoRA Models and many more. The ControlNet API provides more control over the generated images. It also supports providing multiple ControlNet models at once. List of All available A1111 Diffusers Schedulers. Collection of APIs dedicated to model training. Collection of APIs for various model operations. # Image to Image Source: https://docs.modelslab.com/image-generation/pony-models/image-to-image image-generation/pony-models/openapi.json POST /img2img Transform existing images using Pony models. The dimensions of the generated image will be the same as the dimensions of the init\_image. Transform existing images with text guidance using Pony models. See available [schedulers](/image-generation/pony-models/scheduler) for Pony models. ## Request Make a `POST` request to the endpoint below with the required parameters. ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} POST https://modelslab.com/api/v6/images/img2img ``` ### Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key", "model_id": "pony-realism", "prompt": "a cat sitting on a bench, oil painting style", "negative_prompt": "blurry, low quality", "init_image": "https://raw.githubusercontent.com/CompVis/stable-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo.png", "strength": 0.7, "width": 2048, "height": 2048, "samples": 1, "num_inference_steps": 31, "safety_checker": "no", "seed": null, "guidance_scale": 7.5, "scheduler": "DPMSolverMultistepScheduler", "use_karras_sigmas": "yes", "algorithm_type": "sde-dpmsolver++", "clip_skip": "2", "webhook": null, "track_id": null } ``` # Inpainting Source: https://docs.modelslab.com/image-generation/pony-models/inpaint image-generation/pony-models/openapi.json POST /inpaint Inpaint some part in a given image using Pony models. Inpainting endpoint result You can find a list of the public models available and their IDs [here](https://modelslab.com/models?base_model%5B0%5D=sdxl-10\&base_model%5B1%5D=sd-15\&base_model%5B2%5D=flux-1-d\&base_model%5B3%5D=pony\&feature=imagen\&model_type%5B0%5D=checkpoint\&sort=recommended) See available [schedulers](/image-generation/pony-models/scheduler) for Pony models. ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v6/images/inpaint' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key", "model_id": "pony-realism", "prompt": "a cat sitting on a bench", "negative_prompt": null, "init_image": "https://raw.githubusercontent.com/CompVis/stable-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo.png", "mask_image": "https://raw.githubusercontent.com/CompVis/stable-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo_mask.png", "width": "512", "height": "512", "samples": "1", "steps": "21", "safety_checker": "no", "guidance_scale": 7.5, "strength": 0.7, "scheduler": "DPMSolverMultistepScheduler", "use_karras_sigmas": "yes", "algorithm_type": "sde-dpmsolver++", "clip_skip": "2", "seed": null, "webhook": null, "track_id": null } ``` # Pony Models Image Generation API Source: https://docs.modelslab.com/image-generation/pony-models/overview Generate high-quality AI images with Pony models. Text-to-image and image-to-image generation using the Pony model architecture via ModelsLab API. ### Endpoints Create images from text using Pony models. Transform existing images with Pony models. Inpaint parts of images using Pony models. Available schedulers for Pony models. # Schedulers Source: https://docs.modelslab.com/image-generation/pony-models/scheduler Available schedulers for Pony models. These are the available schedulers for Pony models. ## Quick lookup: Civitai / ComfyUI name → request fields | Civitai / ComfyUI sampler | `scheduler` | `algorithm_type` | `use_karras_sigmas` | | ------------------------- | --------------------------------- | ----------------- | ------------------- | | Euler | `EulerDiscreteScheduler` | — | `no` | | Euler a (Euler Ancestral) | `EulerAncestralDiscreteScheduler` | — | `no` | | LMS | `LMSDiscreteScheduler` | — | `no` | | LMS Karras | `LMSDiscreteScheduler` | — | `yes` | | Heun | `HeunDiscreteScheduler` | — | `no` | | DPM2 | `KDPM2DiscreteScheduler` | — | `no` | | DPM2 Karras | `KDPM2DiscreteScheduler` | — | `yes` | | DPM2 a | `KDPM2AncestralDiscreteScheduler` | — | `no` | | DPM2 a Karras | `KDPM2AncestralDiscreteScheduler` | — | `yes` | | DPM++ 2M | `DPMSolverMultistepScheduler` | — | `no` | | DPM++ 2M Karras | `DPMSolverMultistepScheduler` | — | `yes` | | DPM++ 2M SDE | `DPMSolverMultistepScheduler` | `sde-dpmsolver++` | `no` | | DPM++ 2M SDE Karras | `DPMSolverMultistepScheduler` | `sde-dpmsolver++` | `yes` | | DPM++ 3M SDE \* | `DPMSolverMultistepScheduler` | `sde-dpmsolver++` | `no` | | DPM++ 3M SDE Karras \* | `DPMSolverMultistepScheduler` | `sde-dpmsolver++` | `yes` | | DPM++ SDE | `DPMSolverSinglestepScheduler` | `sde-dpmsolver++` | `no` | | DPM++ SDE Karras | `DPMSolverSinglestepScheduler` | `sde-dpmsolver++` | `yes` | | DDIM | `DDIMScheduler` | — | `no` | | DDPM | `DDPMScheduler` | — | `no` | | PLMS / PNDM | `PNDMScheduler` | — | `no` | | UniPC | `UniPCMultistepScheduler` | — | `no` | | DEIS | `DEISMultistepScheduler` | — | `no` | | LCM | `LCMScheduler` | — | `no` | | IPNDM | `IPNDMScheduler` | — | `no` | A `—` in the `algorithm_type` column means: omit the field, or send `no`. Only the following diffusers schedulers honor `use_karras_sigmas=yes`: * `DPMSolverMultistepScheduler` * `DPMSolverSinglestepScheduler` * `KDPM2DiscreteScheduler` * `KDPM2AncestralDiscreteScheduler` * `LMSDiscreteScheduler` # Text to Image Source: https://docs.modelslab.com/image-generation/pony-models/text-to-image image-generation/pony-models/openapi.json POST /text2img Create high quality images from text using Pony models. Generate photorealistic images from text descriptions using Pony models. Pony models are known for their vibrant, high-quality outputs with excellent prompt adherence. See available [schedulers](/image-generation/pony-models/scheduler) for Pony models. ## Request Make a `POST` request to the endpoint below with the required parameters. ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} POST https://modelslab.com/api/v6/images/text2img ``` ### Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key", "model_id": "pony-realism", "prompt": "ultra realistic close up portrait ((beautiful pale cyberpunk female with heavy black eyeliner)), blue eyes, shaved side haircut, hyper detail, cinematic lighting, magic neon, dark red city, Canon EOS R3, nikon, f/1.4, ISO 200, 1/160s, 8K, RAW, unedited, symmetrical balance, in-frame, 8K", "negative_prompt": "blurry, low quality, distorted, deformed", "width": "1024", "height": "1024", "samples": "1", "num_inference_steps": "31", "safety_checker": "no", "seed": null, "guidance_scale": 7.5, "scheduler": "DPMSolverMultistepScheduler", "use_karras_sigmas": "yes", "algorithm_type": "sde-dpmsolver++", "clip_skip": "2", "webhook": null, "track_id": null } ``` # Fetch Image Source: https://docs.modelslab.com/image-generation/realtime-stable-diffusion/fetchimage POST /realtime/fetch/{id} Fetch Queued Images API fetches queued images from stable diffusion. This endpoint does not generate new images, it returns already generated/queued images. ## Request Send a `POST` request to below endpoint to return the corresponding queued images. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v6/realtime/fetch/{id}' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key" } ``` # Image to Image Source: https://docs.modelslab.com/image-generation/realtime-stable-diffusion/image-to-image POST /realtime/img2img Generates a new image from a existing image. Image to image endpoint result This API currently supports the following image formats: **`PNG`** and **`JPG`**. ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body to the endpoint. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v6/realtime/img2img' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key", "prompt": "a cat sitting on a bench", "negative_prompt": "bad quality", "init_image": "https://raw.githubusercontent.com/CompVis/stable-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo.png", "width": "512", "height": "512", "samples": "1", "temp": false, "safety_checker": false, "strength":0.7, "seed": null, "webhook": null, "track_id": null } ``` # Inpainting Source: https://docs.modelslab.com/image-generation/realtime-stable-diffusion/inpaint POST /realtime/inpaint Generates and returns an image from an image and a mask. Inpainting endpoint result This API currently supports the following image formats: **`PNG`** and **`JPG`**. ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v6/realtime/inpaint' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key", "prompt": "a cat sitting on a bench", "negative_prompt": "bad quality", "init_image": "https://raw.githubusercontent.com/CompVis/stable-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo.png", "mask_image": "https://raw.githubusercontent.com/CompVis/stable-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo_mask.png", "width": "512", "height": "512", "samples": 1, "safety_checker": false, "strength": 0.7, "base64": false, "seed": null, "webhook": null, "track_id": null } ``` # Realtime Stable Diffusion API Source: https://docs.modelslab.com/image-generation/realtime-stable-diffusion/overview Generate images in real-time with optimized Stable Diffusion models. Ultra-fast text-to-image, image-to-image, and inpainting endpoints. ### Endpoints This endpoint generates and returns an image from a text passed in the request. This endpoint generates and returns an image from an image passed with its URL in the request. This endpoint generates a new image from an image and a mask. URL to fetch the result when processing is completed. # Text to Image Source: https://docs.modelslab.com/image-generation/realtime-stable-diffusion/text-to-image POST /realtime/text2img Generate images fast with normal quality, where speed is more critical than high resolution. Text to image endpoint result This API currently supports the following image formats: **`PNG`** and **`JPG`**. ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v6/realtime/text2img' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key", "prompt": "ultra realistic close up portrait ((beautiful pale cyberpunk female with heavy black eyeliner))", "negative_prompt": "bad quality", "width": "512", "height": "512", "safety_checker": false, "seed": null, "samples": 1, "base64": false, "webhook": null, "track_id": null } ``` # Upload Base64 Image and Crop Source: https://docs.modelslab.com/image-generation/train-model/base64-crop POST /base64_crop lets you upload an image in base64 and crop it. ## Request Send a `POST` request to below endpoint. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v3/base64_crop' \ ``` Make sure you are passing the image in **base64** format. ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key", "image": "data:image/png;base64,your_base_64_string", "crop": "true" } ``` # Cancel Training Request Source: https://docs.modelslab.com/image-generation/train-model/cancel-training POST /cancel_training/{training_id} Cancel a dreambooth training request. ## Request Send a `POST` request to below endpoint. Where `{training_id}` is the one returned in the response upon initiating the model training. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v3/cancle_training/{training_id}' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "" } ``` # Delete Training Source: https://docs.modelslab.com/image-generation/train-model/finetune-delete POST /delete/{training_id} Delete a created dreambooth training request. ## Request Send a `POST` request to below endpoint. Where `{training_id}` is the one returned in the response upon initiating the model training using the Create training endpoint. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v3/finetune/delete/{training_id}' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "" } ``` # Get Trained Model List Source: https://docs.modelslab.com/image-generation/train-model/finetune-list POST /finetune_list Returns a list with all the models that you have created. ## Request Send a `POST` request to below endpoint to obtain a list with model IDs. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v3/finetune_list' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "" } ``` # Get Training Status Source: https://docs.modelslab.com/image-generation/train-model/finetune-status POST /fine_tune_status/{training_id} This endpoint returns the model's current training status and estimated time remaining, if still in progress. This endpoint only returns information for an already initiated model training. ## Request Make a `POST` request to belowendpoint. Where `{training_id}` is returned in the response upon initiating the model training using the Create Dreambooth Request endpoint. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v3/fine_tune_status/{training_id}' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "" } ``` # Train a Lora Model with Custom Images Source: https://docs.modelslab.com/image-generation/train-model/lora-finetune POST /lora_fine_tune Train a Lora model on normal lora and sdxl with any object or person with your own images. ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v3/lora_fine_tune' \ ``` You can train a model on normal lora models and sdxl and get its style for this endpoint, also each training cost \$1. Fund your you wallet to get started ### Training Types The table below lists all the possible values for the `training_type` parameter. | Value | Description | | :--------- | :----------------------------------------------------------------------------------------------------------------- | | **men** | Train on faces of men. | | **female** | Train on faces of females. | | **couple** | Train on couples of male and female; in images array pass images of couples, instead of images of a single person. | | **null** | Train on object or anything. | ### Training Status Values The table below describes all possible training statuses. | Status | Description | | :-------------------------- | :--------------------------------- | | deploying\_gpu | Deploying GPU | | training\_started | Training started | | training\_success | Training completed successfully | | trained\_model\_compressing | Compressing the trained model | | trained\_model\_uploading | Uploading the trained model | | trained\_model\_uploaded | Trained model uploaded | | deploying\_model | Deploying the trained model | | model\_ready | The trained model is ready for use | ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key":"", "instance_prompt": "photo of ambika0 man", "class_prompt": "photo of a man", "base_model_type": "sdxl", "negative_prompt":" lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry", "images": [ "https://raw.githubusercontent.com/pnavitha/sampleImages/master/1.png", "https://raw.githubusercontent.com/pnavitha/sampleImages/master/2.png", "https://raw.githubusercontent.com/pnavitha/sampleImages/master/3.png", "https://raw.githubusercontent.com/pnavitha/sampleImages/master/4.png", "https://raw.githubusercontent.com/pnavitha/sampleImages/master/5.png", "https://raw.githubusercontent.com/pnavitha/sampleImages/master/6.png", "https://raw.githubusercontent.com/pnavitha/sampleImages/master/7.png", "https://raw.githubusercontent.com/pnavitha/sampleImages/master/8.png", "https://raw.githubusercontent.com/pnavitha/sampleImages/master/9.png" ], "seed": "0", "training_type": "men", "max_train_steps": "18", "lora_type":"lora", "webhook": null } ``` ### Webhook This is an example webhook post call in JSON format. ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "status": "success", "training_status": "deploying_gpu", "logs": "it will take upto 25 minutes", "model_id": "F5jvdzGnYi" } ``` ### Request[​](#request-1 "Direct link to Request") * JS * PHP * NODE * PYTHON * JAVA ``` var myHeaders = new Headers();myHeaders.append("Content-Type", "application/json");var raw = JSON.stringify({ "key":"", "instance_prompt": "photo of ambika0 man", "class_prompt": "photo of a man", "base_model_type": "sdxl", "negative_prompt":" lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry", "images": [ "https://raw.githubusercontent.com/pnavitha/sampleImages/master/1.png", "https://raw.githubusercontent.com/pnavitha/sampleImages/master/2.png", "https://raw.githubusercontent.com/pnavitha/sampleImages/master/3.png", "https://raw.githubusercontent.com/pnavitha/sampleImages/master/4.png", "https://raw.githubusercontent.com/pnavitha/sampleImages/master/5.png", "https://raw.githubusercontent.com/pnavitha/sampleImages/master/6.png", "https://raw.githubusercontent.com/pnavitha/sampleImages/master/7.png", "https://raw.githubusercontent.com/pnavitha/sampleImages/master/8.png", "https://raw.githubusercontent.com/pnavitha/sampleImages/master/9.png" ], "seed": "0", "training_type": "men", "max_train_steps": "18", "lora_type":"lora", "webhook": null});var requestOptions = { method: 'POST', headers: myHeaders, body: raw, redirect: 'follow'};fetch("https://modelslab.com/api/v3/lora_fine_tune", requestOptions) .then(response => response.text()) .then(result => console.log(result)) .catch(error => console.log('error', error)); ``` ``` "", "instance_prompt" => "photo of ambika0 man", "class_prompt" => "photo of person", "base_model_type" => "sdxl", "negative_prompt" => " lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry", "images" => [ "https://raw.githubusercontent.com/pnavitha/sampleImages/master/1.png", "https://raw.githubusercontent.com/pnavitha/sampleImages/master/2.png", "https://raw.githubusercontent.com/pnavitha/sampleImages/master/3.png", "https://raw.githubusercontent.com/pnavitha/sampleImages/master/4.png", "https://raw.githubusercontent.com/pnavitha/sampleImages/master/5.png", "https://raw.githubusercontent.com/pnavitha/sampleImages/master/6.png", "https://raw.githubusercontent.com/pnavitha/sampleImages/master/7.png", "https://raw.githubusercontent.com/pnavitha/sampleImages/master/8.png", "https://raw.githubusercontent.com/pnavitha/sampleImages/master/9.png" ], "seed" => "0", "training_type" => "men", "lora_type":"lora", "max_train_steps" => "18", "webhook" => "" ];$curl = curl_init();curl_setopt_array($curl, array( CURLOPT_URL => 'https://modelslab.com/api/v3/lora_fine_tune', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => json_encode($payload), CURLOPT_HTTPHEADER => array( 'Content-Type: application/json' ),));$response = curl_exec($curl);curl_close($curl);echo $response; ``` ``` var request = require('request');var options = { 'method': 'POST', 'url': 'https://modelslab.com/api/v3/lora_fine_tune', 'headers': { 'Content-Type': 'application/json' }, body: JSON.stringify({ "key":"", "instance_prompt": "photo of ambika0 man", "class_prompt": "photo of a man", "base_model_type": "sdxl", "negative_prompt":" lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry", "images": [ "https://raw.githubusercontent.com/pnavitha/sampleImages/master/1.png", "https://raw.githubusercontent.com/pnavitha/sampleImages/master/2.png", "https://raw.githubusercontent.com/pnavitha/sampleImages/master/3.png", "https://raw.githubusercontent.com/pnavitha/sampleImages/master/4.png", "https://raw.githubusercontent.com/pnavitha/sampleImages/master/5.png", "https://raw.githubusercontent.com/pnavitha/sampleImages/master/6.png", "https://raw.githubusercontent.com/pnavitha/sampleImages/master/7.png", "https://raw.githubusercontent.com/pnavitha/sampleImages/master/8.png", "https://raw.githubusercontent.com/pnavitha/sampleImages/master/9.png" ], "seed": "0", "training_type": "men", "max_train_steps": "18", "lora_type":"lora", "webhook": null })};request(options, function (error, response) { if (error) throw new Error(error); console.log(response.body);}); ``` ``` import requestsimport jsonurl = "https://modelslab.com/api/v3/lora_fine_tune"payload = json.dumps({ "key":"", "instance_prompt": "photo of ambika0 man", "class_prompt": "photo of a man", "base_model_type": "sdxl", "negative_prompt":" lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry", "images": [ "https://raw.githubusercontent.com/pnavitha/sampleImages/master/1.png", "https://raw.githubusercontent.com/pnavitha/sampleImages/master/2.png", "https://raw.githubusercontent.com/pnavitha/sampleImages/master/3.png", "https://raw.githubusercontent.com/pnavitha/sampleImages/master/4.png", "https://raw.githubusercontent.com/pnavitha/sampleImages/master/5.png", "https://raw.githubusercontent.com/pnavitha/sampleImages/master/6.png", "https://raw.githubusercontent.com/pnavitha/sampleImages/master/7.png", "https://raw.githubusercontent.com/pnavitha/sampleImages/master/8.png", "https://raw.githubusercontent.com/pnavitha/sampleImages/master/9.png" ], "seed": "0", "training_type": "men", "max_train_steps": "18", "lora_type":"lora", "webhook": "",})headers = { 'Content-Type': 'application/json'}response = requests.request("POST", url, headers=headers, data=payload)print(response.text) ``` ``` OkHttpClient client = new OkHttpClient().newBuilder() .build();MediaType mediaType = MediaType.parse("application/json");RequestBody body = RequestBody.create(mediaType, "{\n \"key\":\"\",\n \"instance_prompt\": \"photo of ambika0 man\",\n \"class_prompt\": \"photo of a man\",\n \"base_model_type\": \"normal\",\n \"negative_prompt\":\" lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry\",\n \"images\": [\n \"https://raw.githubusercontent.com/pnavitha/sampleImages/master/1.png\",\n \"https://raw.githubusercontent.com/pnavitha/sampleImages/master/2.png\",\n \"https://raw.githubusercontent.com/pnavitha/sampleImages/master/3.png\",\n \"https://raw.githubusercontent.com/pnavitha/sampleImages/master/4.png\",\n \"https://raw.githubusercontent.com/pnavitha/sampleImages/master/5.png\",\n \"https://raw.githubusercontent.com/pnavitha/sampleImages/master/6.png\",\n \"https://raw.githubusercontent.com/pnavitha/sampleImages/master/7.png\",\n \"https://raw.githubusercontent.com/pnavitha/sampleImages/master/8.png\",\n \"https://raw.githubusercontent.com/pnavitha/sampleImages/master/9.png\"\n ],\n \"seed\": \"0\",\n \"training_type\": \"men\",\n \"max_train_steps\": \"18\",\n \"lora_type\":\"lora\",\n \"webhook\": null\n}");Request request = new Request.Builder() .url("https://modelslab.com/api/v3/lora_fine_tune") .method("POST", body) .addHeader("Content-Type", "application/json") .build();Response response = client.newCall(request).execute(); ``` ### Response[​](#response "Direct link to Response") ``` { "status": "success", "messege": "deploying_gpu", "data": "it will take upto 30 minutes.", "training_id": "F5jvdzGnYi"} ``` # Model Training API Source: https://docs.modelslab.com/image-generation/train-model/overview Train and fine-tune custom AI image models with LoRA. Upload datasets, monitor training status, and manage your fine-tuned models. ### Endpoints Returns a list with all the models that you have created. Train a Lora model any object or person with your own images. This endpoint returns the model's current training status and estimated time remaining, if still in progress. Delete a created dreambooth training request. Cancel a dreambooth training request. Lets you upload an image in base64 and crop it. # API Documentation - AI Image, Video & Audio APIs Source: https://docs.modelslab.com/index ModelsLab API docs: generate images, videos, audio, and 3D models with Stable Diffusion, FLUX, and 10,000+ AI models. SDKs for Python, TypeScript, and more. Hero Light Hero Dark ## Getting Started Transform your ideas into reality with ModelsLab's comprehensive AI API suite. Get up and running in minutes with our developer-first platform. Complete API documentation with examples and integration guides Test models and experiment with parameters before integration Connect AI agents like Claude Code, OpenCode, and Cursor to ModelsLab Official SDKs for Python, TypeScript, PHP, Dart, and Go ## Core AI Offerings Explore our comprehensive suite of AI APIs designed for next-generation applications. Create stunning visuals with 10,000+ Stable Diffusion models Generate and edit videos from text prompts and existing footage Text-to-speech, voice cloning, speech-to-text. Transform text and images into 3D models and objects ## Enterprise Solutions Scale your AI applications with enterprise-grade infrastructure and support. Private GPU infrastructure and Flexible pricing. pricing from startup to enterprise scale 24/7 priority support with dedicated account management # Exterior Restorer Source: https://docs.modelslab.com/interior-api/exterior-restorer POST /interior/exterior_restorer This endpoint refreshes worn building exteriors into polished designs guided by your prompt. ## Request Make a `POST` request to below endpoint and pass the required parameters in the request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v6/interior/exterior_restorer' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key":"", "init_image": "https://i.pinimg.com/736x/b2/94/76/b29476a69497bbc870d48a531e0008db.jpg", "prompt": "make beautiful pink and golden color exterior", "seed": 0, "guidance_scale": 8, "strength": 0.99, "num_inference_steps": 51, "base64": false, "temp": false, "specific_object": null, "webhook": null, "track_id": null } ``` # Fetch Image Source: https://docs.modelslab.com/interior-api/fetch POST /interior/fetch/{id} Fetch Queued Request API fetches queued request. **Note:** This endpoint does not generate new images; it only returns already generated or queued images. ## Request Send a `POST` request to below endpoint to return the corresponding queued Images. Where `{id}` is the ID returned together with the URL in the response upon its generation. This endpoint does not generate new image, it returns already generated/queued image. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v6/interior/fetch/{id}' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "" } ``` # Floor Planning Source: https://docs.modelslab.com/interior-api/floor-planning POST /interior/floor_planning Generate a rendered image of a floor plan for a room based on the provided input. ## Request Make a `POST` request to below endpoint and pass the required parameters in the request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v6/interior/floor_planning' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key":"", "init_image": "https://i.pinimg.com/564x/f6/73/9d/f6739dc3fec02fa4019d1045fdad4d47.jpg", "prompt": "rendering floor plan of the apartment layout,top view,white background,masterpiece, kitchen, living room, sofa, chair,bedroom,car best quality, extremely detailed,best illustration, best shadow", "seed": 0, "guidance_scale": 8, "strength": 0.99, "num_inference_steps": 51, "base64": false, "temp": false, "specific_object": null, "webhook": null, "track_id": null } ``` # Interior Source: https://docs.modelslab.com/interior-api/interior POST /interior/make Create an interior design from an image using this endpoint. ## Request Make a `POST` request to below endpoint and pass the required parameters in the request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v6/interior/make' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key":"", "init_image":"https://imagedelivery.net/PP4qZJxMlvGLHJQBm3ErNg/50bc1662-8d41-468e-55d0-9575ad096000/768", "prompt": "Luxury bedroom with an elegant wooden floor, a stylish table, and a plush red carpet, creating a warm and sophisticated ambiance.", "negative_prompt": "bad quality", "seed": 0, "guidance_scale": 8, "strength": 0.99, "num_inference_steps": 51, "base64": false, "temp": false, "scale_down": 6, "webhook":null, "track_id":null } ``` # Interior Mixer Source: https://docs.modelslab.com/interior-api/interior-mixer POST /interior/interior_mixer Add objects from one image into another room image with AI-powered object placement. ## Request Make a `POST` request to below endpoint and pass the required parameters in the request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v6/interior/interior_mixer' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key":"", "init_image": "https://assets.modelslab.ai/generations/6840b690-116b-438c-b59c-0e433f19252d.jpg", "object_image":"https://assets.modelslab.ai/generations/a9affef8-07ee-4ffe-aad5-195f18c17dc5.jpg", "prompt": "add sofa from image 1 to the good position room in image 2", "width": 1024, "height": 1024, "guidance_scale": 8, "num_inference_steps": 51, "base64": false, "webhook": null, "track_id": null } ``` # Object Removal Source: https://docs.modelslab.com/interior-api/object-removal POST /interior/object_removal Remove objects from images using AI-powered object removal. ## Request Make a `POST` request to below endpoint and pass the required parameters in the request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v6/interior/object_removal' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key":"", "init_image": "https://i.pinimg.com/1200x/3f/5e/e3/3f5ee397f73d2ba20952d20698616fd3.jpg", "object_name":"remove sofa from the image", "base64": false, "webhook": null, "track_id": null } ``` # Interior Design API Source: https://docs.modelslab.com/interior-api/overview AI-powered interior design API for room decoration, floor planning, scenario changes, sketch rendering, and exterior restoration. ### Endpoints The Interior endpoint allows you to generate home interiors easily. The Floor Planning endpoint allows you to generate a floor plan from a room image. The Room Decorator endpoint allows you to create room decors using a prompt. Convert bad exterior to good exterior Change the environment scenario Convert exterior house sketch into real world photo
Remove objects from images using AI-powered object removal NEW
Add objects from one image into another room image NEW
# Room Decorator Source: https://docs.modelslab.com/interior-api/room-decorator POST /interior/room_decorator This endpoint helps decorate a room according to the prompt provided. ## Request Make a `POST` request to below endpoint and pass the required parameters in the request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v6/interior/room_decorator' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key":"", "init_image": "https://assets.modelslab.ai/generations/05550b6f-032a-408e-83ae-8100f2c481e5", "prompt": "A luxurious bedroom featuring an elegant table, rich red carpet, and polished wooden flooring", "negative_prompt": "bad quality", "seed": 0, "guidance_scale": 8, "strength": 0.99, "num_inference_steps": 51, "base64": false, "temp": false, "specific_object": "mid-century coffee table", "webhook":null, "track_id": null } ``` # Scenario Changer Source: https://docs.modelslab.com/interior-api/scenario-changer POST /interior/scenario_changer Swap the environment around your space to preview how a home looks across different scenarios. ## Request Make a `POST` request to below endpoint and pass the required parameters in the request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v6/interior/scenario_changer' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key":"your_api_key", "init_image": "https://assets.modelslab.ai/generations/9cf6beb0-60e3-4885-a55c-e60abc270382.avif", "prompt": "A beautiful house in the snow", "scenario": "snow", "seed": 0, "guidance_scale": 8, "strength": 0.99, "num_inference_steps": 51, "base64": false, "temp": false, "specific_object": null, "webhook": null, "track_id": null } ``` # Sketch Rendering Source: https://docs.modelslab.com/interior-api/sketch-rendering POST /interior/sketch_rendering This endpoint allows you to convert exterior house sketch into real world photo as per prompt. ## Request Make a `POST` request to below endpoint and pass the required parameters in the request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v6/interior/sketch_rendering' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key":"your_api_key", "init_image": "https://assets.modelslab.ai/generations/1c719292-8e8b-4235-8c9c-fcd4f21cc3a0.jpg", "prompt": "turn this pencil sketch of a modern home into a photorealistic render with warm evening lighting", "seed": 0, "guidance_scale": 8, "strength": 0.99, "num_inference_steps": 51, "base64": false, "temp": false, "specific_object": null, "webhook": null, "track_id": null } ``` # Advanced Parameters Source: https://docs.modelslab.com/llm-api/advanced-parameters Detailed reference for all LLM API parameters including sampling, penalties, streaming, and response formatting. ## Chat Completions Parameters These parameters are available on the [Chat Completions](/llm-api/chat-completions) endpoint (OpenAI-compatible). ### Core Parameters | Parameter | Type | Required | Default | Description | | ------------ | ------- | -------- | ------- | ------------------------------------------------------------------------------ | | `model` | string | Yes | — | Model ID to use. See [List Models](/llm-api/list-models) for available models. | | `messages` | array | Yes | — | Array of message objects with `role` and `content`. | | `max_tokens` | integer | No | 1000 | Maximum tokens to generate. Range: 1 to model's max context. | | `stream` | boolean | No | `false` | Enable Server-Sent Events streaming. | ### Sampling Parameters | Parameter | Type | Range | Default | Description | | ------------- | ------- | ----- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `temperature` | float | 0–2 | 1.0 | Controls randomness. Lower values (0.1–0.3) produce focused, deterministic output. Higher values (0.8–1.5) increase creativity and variety. Set to 0 for greedy decoding. | | `top_p` | float | 0–1 | 1.0 | Nucleus sampling — only consider tokens with cumulative probability above this threshold. Lower values (0.1) make output more focused. Use either `temperature` or `top_p`, not both. | | `top_k` | integer | 1+ | — | Only sample from the top K most likely tokens. Lower values constrain output. Not all models support this. | Avoid setting both `temperature` and `top_p` at the same time. Use one or the other for best results. ### Penalty Parameters | Parameter | Type | Range | Default | Description | | -------------------- | ----- | ------- | ------- | -------------------------------------------------------------------------------------------------------------------- | | `presence_penalty` | float | -2 to 2 | 0 | Penalizes tokens that have appeared in the text so far. Positive values encourage the model to explore new topics. | | `frequency_penalty` | float | -2 to 2 | 0 | Penalizes tokens based on how often they've appeared. Positive values reduce repetition proportionally to frequency. | | `repetition_penalty` | float | 0.1–2 | 1.0 | Multiplicative penalty on repeated tokens. Values > 1 discourage repetition, \< 1 encourage it. | ### Stop Sequences | Parameter | Type | Default | Description | | --------- | --------------- | ------- | ------------------------------------------------------------------------------------------------------ | | `stop` | string or array | `null` | Up to 4 sequences where the API will stop generating. The stop sequence is not included in the output. | ````json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "stop": ["\n\n", "END", "```"] } ```` ### Response Format | Parameter | Type | Default | Description | | ----------------- | ------- | ------- | -------------------------------------------------------------------------------- | | `response_format` | object | — | Force the model to output in a specific format. | | `seed` | integer | — | Attempt deterministic output. Same seed + same input should produce same output. | | `n` | integer | 1 | Number of completions to generate. | **JSON mode:** ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "response_format": {"type": "json_object"} } ``` When using JSON mode, you must also instruct the model to output JSON in your system or user message, e.g. "Respond in JSON format." ### Function Calling | Parameter | Type | Default | Description | | --------------------- | ---------------- | -------- | ---------------------------------------------------------------------------------------------- | | `tools` | array | — | List of tools/functions the model can call. See [Function Calling](/llm-api/function-calling). | | `tool_choice` | string or object | `"auto"` | Controls tool usage: `"auto"`, `"none"`, `"required"`, or a specific tool. | | `parallel_tool_calls` | boolean | `true` | Whether the model can call multiple tools in one turn. | *** ## Messages Parameters These parameters are available on the [Messages](/llm-api/messages) endpoint (Anthropic-compatible). ### Core Parameters | Parameter | Type | Required | Default | Description | | ------------ | ------- | -------- | ------- | ----------------------------------------------------------------------------------- | | `model` | string | Yes | — | Model ID to use. | | `messages` | array | Yes | — | Input messages. Roles: `user` and `assistant` only (system goes in `system` param). | | `max_tokens` | integer | Yes | — | Maximum tokens to generate. Required for Anthropic format. | | `system` | string | No | — | System prompt. Passed separately, not as a message. | | `stream` | boolean | No | `false` | Enable streaming via Server-Sent Events. | ### Sampling Parameters | Parameter | Type | Range | Default | Description | | ------------- | ------- | ----- | ------- | ----------------------------------------------------------------- | | `temperature` | float | 0–1 | 1.0 | Controls randomness. Note: Anthropic format caps at 1.0, not 2.0. | | `top_p` | float | 0–1 | — | Nucleus sampling threshold. | | `top_k` | integer | 1+ | — | Only sample from the top K tokens. | ### Stop Sequences | Parameter | Type | Default | Description | | ---------------- | ----- | ------- | ---------------------- | | `stop_sequences` | array | — | Custom stop sequences. | ### Tool Use | Parameter | Type | Default | Description | | ------------- | ------ | ------------------ | ------------------------------------------------------------------------------------------------------------------------ | | `tools` | array | — | Tools the model can use. Uses `input_schema` instead of `parameters`. See [Function Calling](/llm-api/function-calling). | | `tool_choice` | object | `{"type": "auto"}` | Controls tool usage: `{"type": "auto"}`, `{"type": "any"}`, or `{"type": "tool", "name": "..."}`. | *** ## Common Patterns ### Deterministic Output For reproducible results, use low temperature with a seed: ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "temperature": 0, "seed": 42 } ``` ### Creative Writing For creative, varied output: ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "temperature": 1.2, "presence_penalty": 0.6, "frequency_penalty": 0.3 } ``` ### Structured Extraction For extracting structured data: ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "temperature": 0, "response_format": {"type": "json_object"}, "max_tokens": 2000 } ``` ### Code Generation For code generation tasks: ````json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "temperature": 0.2, "top_p": 0.95, "stop": ["\n\n\n", "```"] } ```` ### Conversational For natural, engaging conversations: ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "temperature": 0.8, "presence_penalty": 0.5, "max_tokens": 500 } ``` # Chat Completions Source: https://docs.modelslab.com/llm-api/chat-completions POST /chat/completions OpenAI-compatible chat completions endpoint. Works with any OpenAI SDK or compatible client. ## Request ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} POST https://modelslab.com/api/v7/llm/chat/completions ``` Pass your API key as a Bearer token in the `Authorization` header. ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} curl -X POST https://modelslab.com/api/v7/llm/chat/completions \ -H "Authorization: Bearer $MODELSLAB_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "Qwen/Qwen2.5-VL-72B-Instruct-together", "messages": [ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "What is the capital of France?"} ], "max_tokens": 1000, "temperature": 0.7 }' ``` ## Body ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "model": "Qwen/Qwen2.5-VL-72B-Instruct-together", "messages": [ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "What is the capital of France?"} ], "max_tokens": 1000, "temperature": 0.7, "top_p": 1, "stream": false, "presence_penalty": 0, "frequency_penalty": 0 } ``` ## Response ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "id": "chat-abc123", "object": "chat.completion", "created": 1712345678, "model": "Qwen/Qwen2.5-VL-72B-Instruct-together", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "The capital of France is Paris." }, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 25, "completion_tokens": 8, "total_tokens": 33 } } ``` ## Streaming Set `"stream": true` to receive Server-Sent Events (SSE) as tokens are generated: ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} curl -X POST https://modelslab.com/api/v7/llm/chat/completions \ -H "Authorization: Bearer $MODELSLAB_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "Qwen/Qwen2.5-VL-72B-Instruct-together", "messages": [{"role": "user", "content": "Write a haiku"}], "stream": true }' ``` Each SSE event contains a `chat.completion.chunk` object: ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} data: {"id":"chat-abc123","object":"chat.completion.chunk","choices":[{"index":0,"delta":{"content":"Silent"},"finish_reason":null}]} data: {"id":"chat-abc123","object":"chat.completion.chunk","choices":[{"index":0,"delta":{"content":" snow"},"finish_reason":null}]} data: [DONE] ``` ## OpenAI SDK This endpoint is fully compatible with the OpenAI SDK. Just change the `base_url` and `api_key`: ```python theme={"theme":{"light":"github-light","dark":"github-dark"}} from openai import OpenAI client = OpenAI( api_key="YOUR_MODELSLAB_API_KEY", base_url="https://modelslab.com/api/v7/llm", ) # Non-streaming response = client.chat.completions.create( model="Qwen/Qwen2.5-VL-72B-Instruct-together", messages=[ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Explain quantum computing in simple terms"}, ], max_tokens=1000, ) print(response.choices[0].message.content) # Streaming stream = client.chat.completions.create( model="Qwen/Qwen2.5-VL-72B-Instruct-together", messages=[{"role": "user", "content": "Write a story"}], stream=True, ) for chunk in stream: if chunk.choices[0].delta.content: print(chunk.choices[0].delta.content, end="") ``` ```javascript theme={"theme":{"light":"github-light","dark":"github-dark"}} import OpenAI from 'openai'; const client = new OpenAI({ apiKey: 'YOUR_MODELSLAB_API_KEY', baseURL: 'https://modelslab.com/api/v7/llm', }); const response = await client.chat.completions.create({ model: 'Qwen/Qwen2.5-VL-72B-Instruct-together', messages: [ { role: 'system', content: 'You are a helpful assistant.' }, { role: 'user', content: 'Hello!' }, ], }); console.log(response.choices[0].message.content); ``` # Using with Coding Tools Source: https://docs.modelslab.com/llm-api/coding-tools Use ModelsLab's LLM API with Claude Code, Hermes Agent, Pi, OpenAI Codex, Cursor, Continue, Aider, and other AI coding assistants. ModelsLab's LLM API is compatible with popular AI coding tools. Since it supports both OpenAI and Anthropic API formats, you can use it as a drop-in backend for most AI coding assistants. Choose any model ID available on the [ModelsLab LLM catalog](https://modelslab.com/models/category/llmaster) or through the [List Models](/llm-api/list-models) endpoint. In the examples below, replace `YOUR_MODEL_ID` with the model you want to use. ## Choose your coding agent Use ModelsLab as Claude Code's Anthropic-compatible provider. Configure ModelsLab as a custom OpenAI-compatible model provider. Add ModelsLab models through Pi's custom provider configuration. ## Claude Code [Claude Code](https://docs.anthropic.com/en/docs/claude-code) is Anthropic's agentic CLI coding tool. You can point it at ModelsLab's API to use any of 200+ LLM models. ### Quick Start Run any supported model through Claude Code using ModelsLab as the API provider. `ANTHROPIC_AUTH_TOKEN` is preferred for interactive sessions. Use `--model` or `/model` to switch model IDs. ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} CLAUDE_CODE_ATTRIBUTION_HEADER=0 \ ANTHROPIC_BASE_URL="https://modelslab.com/api/v7/llm" \ ANTHROPIC_AUTH_TOKEN="YOUR_MODELSLAB_API_KEY" \ claude --model "YOUR_MODEL_ID" --dangerously-skip-permissions ``` ### Persistent Configuration Add to your shell profile (`~/.bashrc`, `~/.zshrc`, etc.): ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} export ANTHROPIC_BASE_URL="https://modelslab.com/api/v7/llm" export ANTHROPIC_AUTH_TOKEN="YOUR_MODELSLAB_API_KEY" ``` Then run Claude Code with any model: ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} claude --model "Qwen/Qwen2.5-VL-72B-Instruct-together" claude --model "meta-llama/Llama-3.1-70B-Instruct" claude --model "deepseek-ai/DeepSeek-R1" ``` ### Non-Interactive / Scripting ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} ANTHROPIC_BASE_URL="https://modelslab.com/api/v7/llm" \ ANTHROPIC_AUTH_TOKEN="YOUR_MODELSLAB_API_KEY" \ claude --model "Qwen/Qwen2.5-VL-72B-Instruct-together" \ -p "Explain this codebase" \ --dangerously-skip-permissions ``` *** ## Hermes Agent [Hermes Agent](https://hermes-agent.nousresearch.com/) is Nous Research's open-source agent. Configure its custom OpenAI-compatible provider to run ModelsLab models. ### Quick Start Run Hermes with the ModelsLab base URL, API key, and your selected model: ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} OPENAI_BASE_URL="https://modelslab.com/api/v7/llm" \ OPENAI_API_KEY="YOUR_MODELSLAB_API_KEY" \ hermes --provider custom --model "YOUR_MODEL_ID" ``` ### Persistent Configuration Save the custom provider settings so future Hermes sessions use ModelsLab automatically: ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} hermes config set model.provider custom hermes config set model.base_url "https://modelslab.com/api/v7/llm" hermes config set OPENAI_API_KEY "YOUR_MODELSLAB_API_KEY" hermes config set model.default "YOUR_MODEL_ID" ``` Then start Hermes: ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} hermes ``` Use `hermes model` to select another configured model whenever you need to switch. *** ## Pi [Pi](https://pi.dev) is a terminal coding agent that supports custom OpenAI-compatible providers. Add ModelsLab to Pi's model configuration, then select it from Pi's model picker. ### Configuration Create or update `~/.pi/agent/models.json`: ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "providers": { "modelslab": { "baseUrl": "https://modelslab.com/api/v7/llm", "api": "openai-completions", "apiKey": "$MODELSLAB_API_KEY", "models": [ { "id": "YOUR_MODEL_ID", "name": "Your ModelsLab model", "reasoning": true, "input": ["text"], "contextWindow": 128000, "maxTokens": 16384 } ] } } } ``` Set your API key and start Pi: ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} export MODELSLAB_API_KEY="YOUR_MODELSLAB_API_KEY" pi --provider modelslab --model "YOUR_MODEL_ID" ``` You can add additional ModelsLab model IDs to the `models` array. Open `/model` in Pi to choose between the configured models. *** ## OpenAI Codex CLI [Codex CLI](https://github.com/openai/codex) is OpenAI's open-source coding agent. It works with any OpenAI-compatible API. ### Setup ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} OPENAI_API_KEY="YOUR_MODELSLAB_API_KEY" \ OPENAI_BASE_URL="https://modelslab.com/api/v7/llm" \ codex --model "Qwen/Qwen2.5-VL-72B-Instruct-together" ``` ### With Environment Variables ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} export OPENAI_API_KEY="YOUR_MODELSLAB_API_KEY" export OPENAI_BASE_URL="https://modelslab.com/api/v7/llm" codex --model "Qwen/Qwen2.5-VL-72B-Instruct-together" "refactor this function" ``` *** ## Cursor [Cursor](https://cursor.sh) is an AI-powered code editor. You can configure it to use ModelsLab as a custom OpenAI-compatible provider. ### Setup 1. Open Cursor Settings (`Cmd+,` / `Ctrl+,`) 2. Go to **Models** > **OpenAI API Key** 3. Set your API key to your ModelsLab API key 4. Set the base URL to `https://modelslab.com/api/v7/llm` 5. Add your preferred model IDs (e.g., `Qwen/Qwen2.5-VL-72B-Instruct-together`) You can now select ModelsLab models from Cursor's model dropdown. *** ## Continue (VS Code / JetBrains) [Continue](https://continue.dev) is an open-source AI code assistant for VS Code and JetBrains. ### Configuration Edit your `~/.continue/config.yaml`: ```yaml theme={"theme":{"light":"github-light","dark":"github-dark"}} models: - name: ModelsLab Qwen 72B provider: openai model: Qwen/Qwen2.5-VL-72B-Instruct-together apiBase: https://modelslab.com/api/v7/llm apiKey: YOUR_MODELSLAB_API_KEY - name: ModelsLab DeepSeek R1 provider: openai model: deepseek-ai/DeepSeek-R1 apiBase: https://modelslab.com/api/v7/llm apiKey: YOUR_MODELSLAB_API_KEY ``` *** ## Aider [Aider](https://aider.chat) is a terminal-based AI pair programming tool. ### Setup ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} OPENAI_API_KEY="YOUR_MODELSLAB_API_KEY" \ OPENAI_API_BASE="https://modelslab.com/api/v7/llm" \ aider --model "openai/Qwen/Qwen2.5-VL-72B-Instruct-together" ``` ### With `.aider.conf.yml` ```yaml theme={"theme":{"light":"github-light","dark":"github-dark"}} openai-api-key: YOUR_MODELSLAB_API_KEY openai-api-base: https://modelslab.com/api/v7/llm model: openai/Qwen/Qwen2.5-VL-72B-Instruct-together ``` *** ## LangChain Use ModelsLab as the LLM backend in your LangChain applications: ```python theme={"theme":{"light":"github-light","dark":"github-dark"}} from langchain_openai import ChatOpenAI llm = ChatOpenAI( model="Qwen/Qwen2.5-VL-72B-Instruct-together", openai_api_key="YOUR_MODELSLAB_API_KEY", openai_api_base="https://modelslab.com/api/v7/llm", temperature=0.7, ) response = llm.invoke("Explain the Builder pattern in Python") print(response.content) ``` *** ## LiteLLM [LiteLLM](https://litellm.ai) provides a unified API for 100+ LLM providers. Add ModelsLab as a custom provider: ```python theme={"theme":{"light":"github-light","dark":"github-dark"}} import litellm response = litellm.completion( model="openai/Qwen/Qwen2.5-VL-72B-Instruct-together", messages=[{"role": "user", "content": "Hello!"}], api_key="YOUR_MODELSLAB_API_KEY", api_base="https://modelslab.com/api/v7/llm", ) print(response.choices[0].message.content) ``` *** ## General OpenAI-Compatible Tools Any tool that supports a custom OpenAI base URL works with ModelsLab: | Setting | Value | | ------------ | -------------------------------------------------- | | **API Key** | Your ModelsLab API key | | **Base URL** | `https://modelslab.com/api/v7/llm` | | **Model** | Any model from [List Models](/llm-api/list-models) | Browse all available models at [modelslab.com/models/category/llmaster](https://modelslab.com/models/category/llmaster) and use the model ID directly in any compatible tool. # Count Tokens Source: https://docs.modelslab.com/llm-api/count-tokens POST /v1/messages/count_tokens Count the number of tokens in a message before sending it. Useful for cost estimation and context window management. ## Request ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} POST https://modelslab.com/api/v7/llm/v1/messages/count_tokens ``` ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} curl -X POST https://modelslab.com/api/v7/llm/v1/messages/count_tokens \ -H "x-api-key: $MODELSLAB_API_KEY" \ -H "Content-Type: application/json" \ -H "anthropic-version: 2023-06-01" \ -d '{ "model": "Qwen/Qwen2.5-VL-72B-Instruct-together", "messages": [ {"role": "user", "content": "What is the capital of France?"} ] }' ``` ## Body ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "model": "Qwen/Qwen2.5-VL-72B-Instruct-together", "messages": [ {"role": "user", "content": "What is the capital of France?"} ], "system": "You are a helpful assistant." } ``` ## Response ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "input_tokens": 15 } ``` ## Use Cases * **Cost estimation**: Calculate the cost of a request before sending it * **Context window management**: Ensure your messages fit within the model's context window * **Token budgeting**: Allocate token budgets across multiple requests ## Example ```python theme={"theme":{"light":"github-light","dark":"github-dark"}} from anthropic import Anthropic client = Anthropic( api_key="YOUR_MODELSLAB_API_KEY", base_url="https://modelslab.com/api/v7/llm", ) # Count tokens before sending token_count = client.messages.count_tokens( model="Qwen/Qwen2.5-VL-72B-Instruct-together", messages=[ {"role": "user", "content": "Write a detailed essay about AI"} ], ) print(f"Input tokens: {token_count.input_tokens}") ``` # Function Calling Source: https://docs.modelslab.com/llm-api/function-calling Enable LLMs to call functions and tools. Compatible with both OpenAI and Anthropic function calling formats. Function calling (also called "tool use") lets models invoke structured functions you define. The model decides when to call a function, generates the arguments, and you execute the function and return the result. ## OpenAI-Compatible Function Calling Use the `tools` parameter with the [Chat Completions](/llm-api/chat-completions) endpoint: ### Define Tools ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "model": "Qwen/Qwen2.5-VL-72B-Instruct-together", "messages": [ {"role": "user", "content": "What's the weather in San Francisco?"} ], "tools": [ { "type": "function", "function": { "name": "get_weather", "description": "Get the current weather for a location", "parameters": { "type": "object", "properties": { "location": { "type": "string", "description": "City and state, e.g. 'San Francisco, CA'" }, "unit": { "type": "string", "enum": ["celsius", "fahrenheit"], "description": "Temperature unit" } }, "required": ["location"] } } } ], "tool_choice": "auto" } ``` ### Model Response with Tool Call When the model decides to use a tool, the response includes a `tool_calls` array: ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "id": "chat-abc123", "choices": [ { "index": 0, "message": { "role": "assistant", "content": null, "tool_calls": [ { "id": "call_abc123", "type": "function", "function": { "name": "get_weather", "arguments": "{\"location\": \"San Francisco, CA\", \"unit\": \"fahrenheit\"}" } } ] }, "finish_reason": "tool_calls" } ] } ``` ### Return Tool Results Send the tool result back to continue the conversation: ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "model": "Qwen/Qwen2.5-VL-72B-Instruct-together", "messages": [ {"role": "user", "content": "What's the weather in San Francisco?"}, { "role": "assistant", "content": null, "tool_calls": [ { "id": "call_abc123", "type": "function", "function": { "name": "get_weather", "arguments": "{\"location\": \"San Francisco, CA\", \"unit\": \"fahrenheit\"}" } } ] }, { "role": "tool", "tool_call_id": "call_abc123", "content": "{\"temperature\": 62, \"unit\": \"fahrenheit\", \"condition\": \"foggy\"}" } ] } ``` ### Full Python Example ```python theme={"theme":{"light":"github-light","dark":"github-dark"}} import json from openai import OpenAI client = OpenAI( api_key="YOUR_MODELSLAB_API_KEY", base_url="https://modelslab.com/api/v7/llm", ) # Define your tools tools = [ { "type": "function", "function": { "name": "get_weather", "description": "Get the current weather for a location", "parameters": { "type": "object", "properties": { "location": { "type": "string", "description": "City name" } }, "required": ["location"] } } } ] # Your actual function implementations def get_weather(location: str) -> str: # Replace with real weather API call return json.dumps({"temperature": 62, "condition": "foggy"}) # Step 1: Send message with tools response = client.chat.completions.create( model="Qwen/Qwen2.5-VL-72B-Instruct-together", messages=[{"role": "user", "content": "What's the weather in Paris?"}], tools=tools, tool_choice="auto", ) message = response.choices[0].message # Step 2: Check if the model wants to call a function if message.tool_calls: # Execute the function tool_call = message.tool_calls[0] args = json.loads(tool_call.function.arguments) result = get_weather(**args) # Step 3: Send the result back final_response = client.chat.completions.create( model="Qwen/Qwen2.5-VL-72B-Instruct-together", messages=[ {"role": "user", "content": "What's the weather in Paris?"}, message, { "role": "tool", "tool_call_id": tool_call.id, "content": result, }, ], tools=tools, ) print(final_response.choices[0].message.content) else: print(message.content) ``` ## Anthropic-Compatible Tool Use Use the `tools` parameter with the [Messages](/llm-api/messages) endpoint: ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "model": "Qwen/Qwen2.5-VL-72B-Instruct-together", "max_tokens": 1024, "tools": [ { "name": "get_weather", "description": "Get the current weather for a location", "input_schema": { "type": "object", "properties": { "location": { "type": "string", "description": "City name" } }, "required": ["location"] } } ], "messages": [ {"role": "user", "content": "What's the weather in San Francisco?"} ] } ``` ### Response with Tool Use ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "id": "msg_abc123", "type": "message", "role": "assistant", "content": [ { "type": "tool_use", "id": "toolu_abc123", "name": "get_weather", "input": {"location": "San Francisco"} } ], "stop_reason": "tool_use" } ``` ### Return Tool Results ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "model": "Qwen/Qwen2.5-VL-72B-Instruct-together", "max_tokens": 1024, "tools": [...], "messages": [ {"role": "user", "content": "What's the weather in San Francisco?"}, { "role": "assistant", "content": [ { "type": "tool_use", "id": "toolu_abc123", "name": "get_weather", "input": {"location": "San Francisco"} } ] }, { "role": "user", "content": [ { "type": "tool_result", "tool_use_id": "toolu_abc123", "content": "{\"temperature\": 62, \"condition\": \"foggy\"}" } ] } ] } ``` ## Tool Choice Options Control when the model uses tools: | Value | Behavior | | ----------------------------------------------------------- | ---------------------------------------------- | | `"auto"` | Model decides whether to call a tool (default) | | `"none"` | Model will not call any tools | | `"required"` | Model must call at least one tool | | `{"type": "function", "function": {"name": "get_weather"}}` | Force a specific tool | ## Tips The model uses the `description` field to decide when to call a tool. Be specific about what the tool does and when it should be used. Define parameters with JSON Schema including types, descriptions, enums, and required fields. The more precise your schema, the better the model's arguments will be. Models may want to call multiple tools in a single response. Always check for and handle all tool calls in the `tool_calls` array. Some models support calling multiple tools in parallel within a single response. Process all tool calls and return all results before sending the next message. # List Models Source: https://docs.modelslab.com/llm-api/list-models GET /v1/models Retrieve the list of all available LLM models and their capabilities. ## Request ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} GET https://modelslab.com/api/v7/llm/v1/models ``` ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} curl https://modelslab.com/api/v7/llm/v1/models \ -H "x-api-key: $MODELSLAB_API_KEY" ``` ## Response ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "object": "list", "data": [ { "id": "Qwen/Qwen2.5-VL-72B-Instruct-together", "object": "model", "created": 1712345678, "owned_by": "Qwen" }, { "id": "meta-llama/Llama-3.1-70B-Instruct", "object": "model", "created": 1712345678, "owned_by": "Meta" } ] } ``` ## Usage with SDKs ```python theme={"theme":{"light":"github-light","dark":"github-dark"}} from openai import OpenAI client = OpenAI( api_key="YOUR_MODELSLAB_API_KEY", base_url="https://modelslab.com/api/v7/llm", ) models = client.models.list() for model in models.data: print(model.id) ``` ```python theme={"theme":{"light":"github-light","dark":"github-dark"}} import requests response = requests.get( "https://modelslab.com/api/v7/llm/v1/models", headers={"x-api-key": "YOUR_MODELSLAB_API_KEY"}, ) models = response.json() for model in models["data"]: print(model["id"]) ``` You can also browse all available models with details and playground access at [modelslab.com/models/category/llmaster](https://modelslab.com/models/category/llmaster). # Messages Source: https://docs.modelslab.com/llm-api/messages POST /v1/messages Anthropic-compatible messages endpoint. Works with the Anthropic SDK, Claude Code, and any Anthropic-compatible client. ## Request ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} POST https://modelslab.com/api/v7/llm/v1/messages ``` Pass your API key in the `x-api-key` header or as a Bearer token. ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} curl -X POST https://modelslab.com/api/v7/llm/v1/messages \ -H "x-api-key: $MODELSLAB_API_KEY" \ -H "Content-Type: application/json" \ -H "anthropic-version: 2023-06-01" \ -d '{ "model": "Qwen/Qwen2.5-VL-72B-Instruct-together", "max_tokens": 1024, "messages": [ {"role": "user", "content": "What is the capital of France?"} ] }' ``` ## Body ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "model": "Qwen/Qwen2.5-VL-72B-Instruct-together", "max_tokens": 1024, "messages": [ {"role": "user", "content": "What is the capital of France?"} ], "system": "You are a helpful assistant.", "temperature": 0.7, "top_p": 1, "stream": false } ``` ## Response ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "id": "msg_abc123", "type": "message", "role": "assistant", "content": [ { "type": "text", "text": "The capital of France is Paris." } ], "model": "Qwen/Qwen2.5-VL-72B-Instruct-together", "stop_reason": "end_turn", "usage": { "input_tokens": 15, "output_tokens": 8 } } ``` ## Streaming Set `"stream": true` to receive Server-Sent Events: ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} curl -X POST https://modelslab.com/api/v7/llm/v1/messages \ -H "x-api-key: $MODELSLAB_API_KEY" \ -H "Content-Type: application/json" \ -H "anthropic-version: 2023-06-01" \ -d '{ "model": "Qwen/Qwen2.5-VL-72B-Instruct-together", "max_tokens": 1024, "messages": [{"role": "user", "content": "Write a haiku"}], "stream": true }' ``` ## Anthropic SDK This endpoint is fully compatible with the Anthropic SDK. Just change the `base_url` and `api_key`: ```python theme={"theme":{"light":"github-light","dark":"github-dark"}} from anthropic import Anthropic client = Anthropic( api_key="YOUR_MODELSLAB_API_KEY", base_url="https://modelslab.com/api/v7/llm", ) # Non-streaming message = client.messages.create( model="Qwen/Qwen2.5-VL-72B-Instruct-together", max_tokens=1024, messages=[ {"role": "user", "content": "Explain quantum computing"} ], ) print(message.content[0].text) # Streaming with client.messages.stream( model="Qwen/Qwen2.5-VL-72B-Instruct-together", max_tokens=1024, messages=[{"role": "user", "content": "Write a story"}], ) as stream: for text in stream.text_stream: print(text, end="") ``` ```javascript theme={"theme":{"light":"github-light","dark":"github-dark"}} import Anthropic from '@anthropic-ai/sdk'; const client = new Anthropic({ apiKey: 'YOUR_MODELSLAB_API_KEY', baseURL: 'https://modelslab.com/api/v7/llm', }); const message = await client.messages.create({ model: 'Qwen/Qwen2.5-VL-72B-Instruct-together', max_tokens: 1024, messages: [ { role: 'user', content: 'Hello!' }, ], }); console.log(message.content[0].text); ``` ## Using with Claude Code You can use ModelsLab's LLM API as a backend for [Claude Code](https://claude.ai/claude-code), Anthropic's CLI coding assistant: ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} ANTHROPIC_BASE_URL="https://modelslab.com/api/v7/llm" \ ANTHROPIC_AUTH_TOKEN="YOUR_MODELSLAB_API_KEY" \ claude --model "Qwen/Qwen2.5-VL-72B-Instruct-together" ``` This lets you use any of ModelsLab's 200+ LLM models as the backend for Claude Code's agentic coding capabilities. # LLM API Source: https://docs.modelslab.com/llm-api/overview Access 200+ large language models through a unified API. OpenAI and Anthropic SDK compatible — use Claude Code, ChatGPT clients, and more with a single API key. ModelsLab's LLM API gives you access to 200+ large language models through a single, unified API. It's fully compatible with both **OpenAI** and **Anthropic** SDKs, so you can use tools like **Claude Code**, ChatGPT-compatible clients, and any OpenAI/Anthropic SDK with minimal configuration changes. ## Base URL ``` https://modelslab.com/api/v7/llm ``` ## Authentication All endpoints use **Bearer token** authentication. Pass your ModelsLab API key in the `Authorization` header: ``` Authorization: Bearer YOUR_MODELSLAB_API_KEY ``` ## Endpoints OpenAI-compatible chat completions endpoint. Works with OpenAI SDKs, LangChain, and any OpenAI-compatible client. Anthropic-compatible messages endpoint. Works with the Anthropic SDK, Claude Code, and any Anthropic-compatible client. Enable models to call functions and tools. Supports both OpenAI and Anthropic tool use formats. Detailed reference for sampling, penalties, streaming, response formatting, and more. Count the number of tokens in a message before sending it. Useful for managing costs and context windows. Retrieve the list of all available LLM models and their capabilities. Use ModelsLab with Claude Code, Codex, Cursor, Continue, Aider, and other AI coding assistants. ## SDK Compatibility ModelsLab's LLM API is designed as a **drop-in replacement** for both OpenAI and Anthropic APIs. Just change the base URL and API key: ```python theme={"theme":{"light":"github-light","dark":"github-dark"}} from openai import OpenAI client = OpenAI( api_key="YOUR_MODELSLAB_API_KEY", base_url="https://modelslab.com/api/v7/llm", ) response = client.chat.completions.create( model="Qwen/Qwen2.5-VL-72B-Instruct-together", messages=[ {"role": "user", "content": "Hello!"} ], ) print(response.choices[0].message.content) ``` ```python theme={"theme":{"light":"github-light","dark":"github-dark"}} from anthropic import Anthropic client = Anthropic( api_key="YOUR_MODELSLAB_API_KEY", base_url="https://modelslab.com/api/v7/llm", ) message = client.messages.create( model="Qwen/Qwen2.5-VL-72B-Instruct-together", max_tokens=1024, messages=[ {"role": "user", "content": "Hello!"} ], ) print(message.content[0].text) ``` ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} ANTHROPIC_BASE_URL="https://modelslab.com/api/v7/llm" \ ANTHROPIC_AUTH_TOKEN="YOUR_MODELSLAB_API_KEY" \ claude --model "Qwen/Qwen2.5-VL-72B-Instruct-together" ``` ## Supported Models Browse all available LLM models at [modelslab.com/models/category/llmaster](https://modelslab.com/models/category/llmaster), or use the [List Models](/llm-api/list-models) endpoint to fetch them programmatically. Popular models include: * **Qwen 2.5 VL 72B** — Vision-language model with strong reasoning * **DeepSeek R1** — Advanced reasoning model * **Llama 3.1 70B/405B** — Meta's open-source flagship models * **Mistral Large** — Mistral AI's most capable model * And 200+ more... # Agent Control Plane MCP Server Source: https://docs.modelslab.com/mcp-web-api/agent-control-plane Manage your entire ModelsLab account via MCP: authentication, API keys, billing, subscriptions, teams, and more — all from your AI coding agent. ## What is the Agent Control Plane MCP Server? The Agent Control Plane MCP server lets AI agents manage a full ModelsLab account lifecycle without a browser. It exposes the [Agents API (Control Plane)](/agents-api/overview) as MCP tools covering authentication, profile management, API keys, usage analytics, model discovery, billing, wallet, subscriptions, teams, training, servers, and uploads. This is separate from the [Generation MCP server](/mcp-web-api/overview) which handles image/video/audio/LLM generation. Together, these two servers give an AI agent complete access to ModelsLab. Image, video, audio, LLM generation (24 tools). Auth: API key. Account management (10 tools). Auth: Bearer token. ## Endpoint ``` https://modelslab.com/mcp/agents ``` ## Authentication The Agent Control Plane uses Sanctum bearer tokens (not API keys). Unauthenticated actions like signup and login work without a token. ```http theme={"theme":{"light":"github-light","dark":"github-dark"}} Authorization: Bearer YOUR_AGENT_ACCESS_TOKEN ``` ```http theme={"theme":{"light":"github-light","dark":"github-dark"}} X-Agent-Token: YOUR_AGENT_ACCESS_TOKEN ``` ### Getting a Token Use the `agent-auth` tool with the `login` action to get a bearer token: ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "agent-auth", "arguments": { "action": "login", "email": "you@example.com", "password": "your-password" } } } ``` The response includes an `access_token` to use for all subsequent requests. You do **not** need to install anything. The server is hosted — just configure your IDE with the URL and token. See [Agent Integration](/mcp-web-api/agent-cp-integration) for setup guides. ## Available Tools | Tool | Actions | Description | | --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------- | | `agent-auth` | signup, login, logout, logout-all, forgot-password, reset-password, resend-verification | Authentication and account creation | | `agent-tokens` | list, revoke, revoke-others, switch-account | Manage access tokens and team account context | | `agent-profile` | get, update, update-password, update-socials, update-preferences | Profile and preferences management | | `agent-api-keys` | list, create, get, update, delete | Manage API keys for generation endpoints | | `agent-usage` | summary, products, history | Usage analytics and generation history | | `agent-models` | search, filters, tags, providers, detail | Discover 50,000+ AI models | | `agent-billing` | overview, payment-methods, add/set-default/remove-payment-method, billing-info, update-billing-info, invoices, invoice-detail, invoice-pdf | Billing and payment management | | `agent-wallet` | fund, auto-funding, disable-auto-funding, withdraw, validate-coupon, redeem-coupon | Wallet funding and coupon operations | | `agent-subscriptions` | list, create, update, pause, resume, reset-cycle, charge-amount, fix-payment | Subscription lifecycle management | | `agent-teams` | list, create, get, update, delete, resend-invite, accept-invite | Team member and invite management | See detailed documentation for all 10 tools, their actions, parameters, and examples. ## Typical Agent Workflow ```text theme={"theme":{"light":"github-light","dark":"github-dark"}} 1. agent-auth (login) → Get bearer token 2. agent-api-keys (list) → Get API key for generation 3. agent-models (search) → Find a model to use 4. agent-usage (summary) → Check remaining credits 5. agent-wallet (fund) → Top up wallet if needed 6. Use generation MCP server → Generate images/video/audio with the API key ``` See the [Headless Agent Flow](/agents-api/headless-flow) for a complete 6-step walkthrough from signup to generation with no browser required. ## Server Information * **Name:** `modelslab-agent-control-plane` * **Version:** `1.0.0` * **Protocol:** MCP (Model Context Protocol) * **Transport:** HTTP with JSON-RPC 2.0 / SSE * **Local server name:** `agent-control-plane` (for stdio transport) ## Next Steps Complete documentation for all 10 agent control plane tools Setup guides for Claude Code, Cursor, VS Code, and other agents Direct REST API documentation for the control plane MCP server for AI generation (image, video, audio, LLM) # Agent Control Plane Integration Source: https://docs.modelslab.com/mcp-web-api/agent-cp-integration Setup guides for connecting the ModelsLab Agent Control Plane MCP server to Claude Code, Cursor, VS Code, and other AI agents. Connect your AI coding agent to ModelsLab's account management capabilities. The Agent Control Plane MCP server is hosted — no installation required. Just add the URL and your bearer token. ## Overview The Agent Control Plane MCP server works with any client that supports the [Model Context Protocol](https://modelcontextprotocol.io/) over HTTP: * **Claude Code** - Anthropic's CLI coding assistant * **Claude Desktop** - Claude's desktop application * **Cursor** - AI-powered code editor * **VS Code** - Via GitHub Copilot agent mode * **Windsurf** - Codeium's AI editor * **OpenCode** - Open-source AI coding agent * **Continue** - Open-source AI code assistant Unlike the [Generation MCP server](/mcp-web-api/agent-integration) which uses API keys, the Agent Control Plane uses **Sanctum bearer tokens**. Get a token by calling the `agent-auth` tool with the `login` action, or via the [REST API](/agents-api/authentication). ## Getting Your Bearer Token Before configuring your IDE, get a bearer token: ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} curl -X POST https://modelslab.com/api/agents/v1/auth/login \ -H "Content-Type: application/json" \ -d '{"email":"you@example.com","password":"your-password"}' ``` Copy the `access_token` from the response. You can also use the MCP server itself to log in — the `agent-auth` tool's `login` and `signup` actions work without authentication. ## Using Both MCP Servers Together For full ModelsLab access, configure **both** MCP servers: | Server | URL | Auth | Purpose | | ------------------- | ---------------------------------- | ------------ | -------------------------------------- | | Generation | `https://modelslab.com/mcp/v7` | API key | Image, video, audio, LLM generation | | Agent Control Plane | `https://modelslab.com/mcp/agents` | Bearer token | Account, billing, subscriptions, teams | *** ## Claude Code Edit `~/.claude/settings.json`: ```json settings.json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "mcpServers": { "modelslab": { "url": "https://modelslab.com/mcp/v7", "headers": { "Authorization": "Bearer YOUR_API_KEY" } }, "modelslab-agents": { "url": "https://modelslab.com/mcp/agents", "headers": { "Authorization": "Bearer YOUR_AGENT_TOKEN" } } } } ``` Edit `%USERPROFILE%\.claude\settings.json`: ```json settings.json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "mcpServers": { "modelslab": { "url": "https://modelslab.com/mcp/v7", "headers": { "Authorization": "Bearer YOUR_API_KEY" } }, "modelslab-agents": { "url": "https://modelslab.com/mcp/agents", "headers": { "Authorization": "Bearer YOUR_AGENT_TOKEN" } } } } ``` ### Usage ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} claude "Check my ModelsLab usage summary and wallet balance" ``` ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} claude "Search for the best flux image models on ModelsLab" ``` ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} claude "Create a new API key named 'production' on my ModelsLab account" ``` *** ## Claude Desktop Edit `~/Library/Application Support/Claude/claude_desktop_config.json`: ```json claude_desktop_config.json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "mcpServers": { "modelslab-agents": { "url": "https://modelslab.com/mcp/agents", "headers": { "Authorization": "Bearer YOUR_AGENT_TOKEN" } } } } ``` Edit `%APPDATA%\Claude\claude_desktop_config.json`: ```json claude_desktop_config.json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "mcpServers": { "modelslab-agents": { "url": "https://modelslab.com/mcp/agents", "headers": { "Authorization": "Bearer YOUR_AGENT_TOKEN" } } } } ``` Restart Claude Desktop after updating the configuration. *** ## Cursor Add to your Cursor MCP settings or edit `.cursor/mcp.json` in your project: ```json mcp.json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "servers": { "modelslab-agents": { "type": "http", "url": "https://modelslab.com/mcp/agents", "headers": { "Authorization": "Bearer YOUR_AGENT_TOKEN" } } } } ``` *** ## VS Code (Copilot Agent Mode) Edit `.vscode/mcp.json` in your workspace: ```json mcp.json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "inputs": [ { "id": "modelslab-agent-token", "type": "promptString", "description": "ModelsLab Agent Bearer Token", "password": true } ], "servers": { "modelslab-agents": { "type": "sse", "url": "https://modelslab.com/mcp/agents", "headers": { "Authorization": "Bearer ${input:modelslab-agent-token}" } } } } ``` *** ## Windsurf Edit `~/.codeium/windsurf/mcp_config.json`: ```json mcp_config.json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "mcpServers": { "modelslab-agents": { "serverUrl": "https://modelslab.com/mcp/agents", "transport": "sse", "headers": { "Authorization": "Bearer YOUR_AGENT_TOKEN" } } } } ``` *** ## OpenCode Edit `opencode.json` in your project root: ```json opencode.json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "mcp": { "servers": { "modelslab-agents": { "type": "http", "url": "https://modelslab.com/mcp/agents", "headers": { "Authorization": "Bearer YOUR_AGENT_TOKEN" } } } } } ``` Edit `~/.config/opencode/config.json`: ```json config.json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "mcp": { "servers": { "modelslab-agents": { "type": "http", "url": "https://modelslab.com/mcp/agents", "headers": { "Authorization": "Bearer YOUR_AGENT_TOKEN" } } } } } ``` *** ## Continue Edit `~/.continue/config.json`: ```json config.json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "mcpServers": [ { "name": "modelslab-agents", "transport": { "type": "http", "url": "https://modelslab.com/mcp/agents", "headers": { "Authorization": "Bearer YOUR_AGENT_TOKEN" } } } ] } ``` *** ## Generic MCP Client For any MCP-compatible client: ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "servers": { "modelslab-agents": { "transport": "http", "url": "https://modelslab.com/mcp/agents", "headers": { "Authorization": "Bearer YOUR_AGENT_TOKEN" } } } } ``` *** ## Environment Variables For security, use environment variables instead of hardcoding tokens: Add to your shell profile (`~/.bashrc`, `~/.zshrc`): ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} export MODELSLAB_AGENT_TOKEN="your_agent_token_here" ``` Then reference in config: ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "mcpServers": { "modelslab-agents": { "url": "https://modelslab.com/mcp/agents", "headers": { "Authorization": "Bearer ${MODELSLAB_AGENT_TOKEN}" } } } } ``` ```powershell theme={"theme":{"light":"github-light","dark":"github-dark"}} setx MODELSLAB_AGENT_TOKEN "your_agent_token_here" ``` Environment variable substitution support varies by client. Check your specific client's documentation. *** ## Verification After configuring, verify the integration: ### Test Connection Ask your AI agent: ``` Check my ModelsLab profile using the agent control plane ``` ### Test Model Discovery ``` Search for realistic image generation models on ModelsLab ``` ### Check for Errors If the integration is not working, check: 1. **Token**: Ensure your bearer token is valid and not expired 2. **URL**: Verify the endpoint is `https://modelslab.com/mcp/agents` 3. **Headers**: Confirm the `Authorization: Bearer` format 4. **Client support**: Ensure your MCP client supports HTTP/SSE transport *** ## Troubleshooting * Your bearer token may have expired. Get a new one via `agent-auth` login * Ensure the header format is `Bearer ` (with space after Bearer) * Some actions (signup, login, forgot-password) don't need a token * Restart your MCP client after configuration changes * Check the configuration file syntax (valid JSON) * Verify the config file is in the correct location * Verify the endpoint URL is correct * Check your network connection and firewall rules * **API key**: Used for generation endpoints (`/mcp/v7`). Get from dashboard or `agent-api-keys` tool * **Bearer token**: Used for control plane (`/mcp/agents`). Get from `agent-auth` login *** ## Next Steps Complete documentation for all 10 control plane tools Direct REST API documentation for the control plane # Agent Control Plane Tools Reference Source: https://docs.modelslab.com/mcp-web-api/agent-cp-tools-reference Complete reference for all 10 agent control plane MCP tools including actions, parameters, and examples. Each tool uses an `action` parameter to select the specific operation. All tools communicate via JSON-RPC 2.0 over the MCP endpoint at `https://modelslab.com/mcp/agents`. ## Authentication ### agent-auth Authentication and account creation. Signup, login, forgot-password, reset-password, and resend-verification do not require a bearer token. `signup`, `login`, `logout`, `logout-all`, `forgot-password`, `reset-password`, `resend-verification` Email address (required for signup, login, forgot-password, reset-password, resend-verification) Password (required for signup, login, reset-password) Password confirmation (required for reset-password) User name (optional for signup) Device name for the token (optional for login, default: `agent-control-plane`) Reset token (required for reset-password) Token expiry: `1_week`, `1_month` (default), `3_months`, `never` ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "agent-auth", "arguments": { "action": "login", "email": "agent@example.com", "password": "secret123", "token_expiry": "1_month" } } } ``` ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "agent-auth", "arguments": { "action": "signup", "email": "newuser@example.com", "password": "secret123", "name": "Agent Runner" } } } ``` *** ### agent-tokens Manage Sanctum access tokens. All actions require authentication. `list`, `revoke`, `revoke-others`, `switch-account` Token ID (required for revoke) Target team account username (required for switch-account) Device name for new token (optional for switch-account) Token expiry: `1_week`, `1_month`, `3_months`, `never` *** ## Profile & Account ### agent-profile Manage the authenticated user's profile. All actions require authentication. `get`, `update`, `update-password`, `update-socials`, `update-preferences` Display name (for update) Username (for update) Bio/about text (for update) Current password (required for update-password) New password (required for update-password) New password confirmation (required for update-password) Facebook URL (for update-socials) GitHub URL (for update-socials) Twitter/X URL (for update-socials) Instagram URL (for update-socials) Discord handle (for update-socials) Enable NSFW content (for update-preferences) Enable wallet balance notifications (for update-preferences) Wallet notification threshold amount (for update-preferences) ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "agent-profile", "arguments": { "action": "get" } } } ``` *** ## API Keys ### agent-api-keys Manage API keys for generation endpoints (`/api/v6`, `/api/v7`, `/api/v8`). All actions require authentication. `list`, `create`, `get`, `update`, `delete` API key ID (required for get, update, delete) API key name (required for create, optional for update) Notes about the API key (optional) ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "agent-api-keys", "arguments": { "action": "create", "name": "production-key" } } } ``` *** ## Usage & Analytics ### agent-usage View API usage analytics. All actions require authentication. `summary`, `products`, `history` Start date filter, YYYY-MM-DD (optional for history) End date filter, YYYY-MM-DD (optional for history) Max items to return, 1-200, default 100 (optional for history) *** ## Model Discovery ### agent-models Search and discover 50,000+ AI models. All actions require authentication. The `detail` action returns endpoint configurations with a `parameters` JSON Schema object describing each endpoint's accepted parameters (types, constraints, defaults, enums) alongside the raw `config` array, making it easy for agents to understand what parameters an endpoint accepts without parsing UI widget definitions. `search`, `filters`, `tags`, `providers`, `detail` Model ID (required for detail) Search query (for search) Filter by feature: `imagen`, `video_fusion`, `audio_gen`, `llmaster`, etc. Filter by provider name Filter by model type Filter by model subcategory Filter by base model Comma-separated tags to filter by Sort: `recommended` (default), `newest`, `popular` Results per page (default: 20) ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "agent-models", "arguments": { "action": "search", "search": "flux", "feature": "imagen", "sort": "recommended", "per_page": 10 } } } ``` *** ## Billing & Payments ### agent-billing Manage billing, payment methods, and invoices. All actions require authentication. `overview`, `payment-methods`, `add-payment-method`, `set-default-payment-method`, `remove-payment-method`, `billing-info`, `update-billing-info`, `invoices`, `invoice-detail`, `invoice-pdf` Stripe payment method ID (for add/set-default/remove-payment-method) Make the payment method default (for add-payment-method, default: true) Billing name (for update-billing-info) Billing email (for update-billing-info) Tax ID value (for update-billing-info) Tax ID type, e.g. `eu_vat`, `us_ein` (required with tax\_id) Address line 1 (for update-billing-info) Address line 2 (for update-billing-info) City (for update-billing-info) State/province (for update-billing-info) Postal/zip code (for update-billing-info) Country code (for update-billing-info) Invoice ID (for invoice-detail, invoice-pdf) *** ## Wallet ### agent-wallet Manage wallet balance, auto-recharge, and coupons. All actions require authentication. `fund`, `auto-funding`, `disable-auto-funding`, `withdraw`, `validate-coupon`, `redeem-coupon` Amount in USD (required for fund, withdraw) Stripe payment method ID (optional for fund — charges immediately; required for bonus coupon redeem) Auto charge amount, min \$5 (required for auto-funding) Balance threshold to trigger auto charge, min \$1 (required for auto-funding) Coupon code (required for validate-coupon, redeem-coupon) Purchase amount for bonus coupons (optional for validate-coupon, required for bonus coupon redeem) ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "agent-wallet", "arguments": { "action": "fund", "amount": 50, "payment_method_id": "pm_..." } } } ``` *** ## Subscriptions ### agent-subscriptions Manage subscriptions. All actions require authentication. Use `list-plans` first to discover available subscription plans and pay-as-you-go options. `list-plans`, `list`, `create`, `update`, `pause`, `resume`, `reset-cycle`, `charge-amount`, `fix-payment` Subscription ID (required for update, pause, resume, reset-cycle, fix-payment) Plan ID (required for create) New plan ID (required for update) Redirect URL after successful checkout (optional for create) Redirect URL if checkout is cancelled (optional for create) Charge amount, $5-$10000 (required for charge-amount) Plan category: `enterprise`, `imagen`, `addon`, `normal` Stripe subscription ID override *** ## Teams ### agent-teams Manage team members and invites. All actions require authentication. `list`, `create`, `get`, `update`, `delete`, `resend-invite`, `accept-invite` Team member ID (required for get, update, delete, resend-invite) Invite UUID (required for accept-invite) Email address to invite (required for create) Member role (for update) Permissions array (for update) Invite status: `pending`, `accepted` (for update) ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "agent-teams", "arguments": { "action": "create", "email": "teammate@example.com" } } } ``` # Agent Integration Source: https://docs.modelslab.com/mcp-web-api/agent-integration Setup guides for integrating ModelsLab MCP Web API with Claude Code, OpenCode, Cursor, and other AI coding agents. Connect ModelsLab's powerful AI generation capabilities to your favorite AI coding assistant. This guide covers integration with popular MCP-compatible agents and tools. ## Overview The ModelsLab MCP Web API works with any client that supports the [Model Context Protocol](https://modelcontextprotocol.io/) over HTTP. This includes: * **Claude Code** - Anthropic's CLI coding assistant * **OpenCode** - Open-source AI coding agent * **Claude Desktop** - Claude's desktop application * **Cursor** - AI-powered code editor * **Continue** - Open-source AI code assistant * **Custom integrations** - Any MCP-compatible client ## Claude Code [Claude Code](https://docs.anthropic.com/en/docs/claude-code) is Anthropic's agentic CLI tool for software development. ### Configuration Add ModelsLab to your Claude Code MCP settings file: Edit `~/.claude/settings.json`: ```json settings.json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "mcpServers": { "modelslab": { "url": "https://modelslab.com/mcp/v7", "headers": { "Authorization": "Bearer YOUR_API_KEY" } } } } ``` Edit `%USERPROFILE%\.claude\settings.json`: ```json settings.json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "mcpServers": { "modelslab": { "url": "https://modelslab.com/mcp/v7", "headers": { "Authorization": "Bearer YOUR_API_KEY" } } } } ``` ### Usage Once configured, you can ask Claude Code to generate images, videos, and audio directly: ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} claude "Generate an image of a futuristic cityscape at night using ModelsLab" ``` ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} claude "Create a 5-second video of a cat walking using the ModelsLab API" ``` *** ## OpenCode [OpenCode](https://opencode.ai) is an open-source AI coding agent that runs in your terminal. ### Configuration Add ModelsLab to your OpenCode configuration: Create or edit `opencode.json` in your project root: ```json opencode.json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "mcp": { "servers": { "modelslab": { "type": "http", "url": "https://modelslab.com/mcp/v7", "headers": { "Authorization": "Bearer YOUR_API_KEY" } } } } } ``` Edit `~/.config/opencode/config.json`: ```json config.json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "mcp": { "servers": { "modelslab": { "type": "http", "url": "https://modelslab.com/mcp/v7", "headers": { "Authorization": "Bearer YOUR_API_KEY" } } } } } ``` ### Usage Start OpenCode and use ModelsLab tools: ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} opencode ``` Then in the interactive session: ``` > Generate a logo for my startup using ModelsLab's flux-dev model ``` *** ## Claude Desktop [Claude Desktop](https://claude.ai/download) supports MCP servers for extended functionality. ### Configuration Edit `~/Library/Application Support/Claude/claude_desktop_config.json`: ```json claude_desktop_config.json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "mcpServers": { "modelslab": { "url": "https://modelslab.com/mcp/v7", "headers": { "Authorization": "Bearer YOUR_API_KEY" } } } } ``` Edit `%APPDATA%\Claude\claude_desktop_config.json`: ```json claude_desktop_config.json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "mcpServers": { "modelslab": { "url": "https://modelslab.com/mcp/v7", "headers": { "Authorization": "Bearer YOUR_API_KEY" } } } } ``` ### Restart Required After updating the configuration: 1. Completely quit Claude Desktop (not just minimize) 2. Reopen Claude Desktop 3. The ModelsLab tools should now be available *** ## Cursor [Cursor](https://cursor.sh) is an AI-powered code editor with MCP support. ### Configuration Add ModelsLab to your Cursor MCP settings: 1. Open Cursor Settings (`Cmd/Ctrl + ,`) 2. Search for "MCP" 3. Add the following server configuration: ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "mcp.servers": { "modelslab": { "url": "https://modelslab.com/mcp/v7", "headers": { "Authorization": "Bearer YOUR_API_KEY" } } } } ``` Alternatively, edit `.cursor/mcp.json` in your project: ```json mcp.json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "servers": { "modelslab": { "type": "http", "url": "https://modelslab.com/mcp/v7", "headers": { "Authorization": "Bearer YOUR_API_KEY" } } } } ``` *** ## VS Code (Copilot Agent Mode) [VS Code](https://code.visualstudio.com/) supports MCP servers through Copilot Agent Mode. ### Configuration Create or edit `.vscode/mcp.json` in your project: ```json mcp.json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "servers": { "modelslab-v7": { "type": "sse", "url": "https://modelslab.com/mcp/v7", "headers": { "Authorization": "Bearer YOUR_API_KEY" } } } } ``` ### Usage Once configured, use ModelsLab tools in Copilot Agent Mode: ``` @workspace Generate a product image using ModelsLab's text-to-image tool ``` *** ## Windsurf [Windsurf](https://codeium.com/windsurf) is an AI-powered IDE by Codeium with MCP support. ### Configuration Edit `~/.codeium/windsurf/mcp_config.json`: ```json mcp_config.json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "mcpServers": { "modelslab-v7": { "serverUrl": "https://modelslab.com/mcp/v7", "transport": "sse", "headers": { "Authorization": "Bearer YOUR_API_KEY" } } } } ``` ### Restart Required After updating the configuration, restart Windsurf for the changes to take effect. *** ## Continue [Continue](https://continue.dev) is an open-source AI code assistant that works with VS Code and JetBrains IDEs. ### Configuration Edit your Continue configuration file (`~/.continue/config.json`): ```json config.json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "mcpServers": [ { "name": "modelslab", "transport": { "type": "http", "url": "https://modelslab.com/mcp/v7", "headers": { "Authorization": "Bearer YOUR_API_KEY" } } } ] } ``` *** ## Generic MCP Client For any MCP-compatible client, use the following configuration pattern: ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "servers": { "modelslab-v7": { "transport": "http", "url": "https://modelslab.com/mcp/v7", "headers": { "Authorization": "Bearer YOUR_API_KEY" } } } } ``` *** ## Environment Variables For security, you can use environment variables instead of hardcoding your API key: Add to your shell profile (`~/.bashrc`, `~/.zshrc`, etc.): ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} export MODELSLAB_API_KEY="your_api_key_here" ``` Then reference it in your config: ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "mcpServers": { "modelslab": { "url": "https://modelslab.com/mcp/v7", "headers": { "Authorization": "Bearer ${MODELSLAB_API_KEY}" } } } } ``` Set environment variable: ```powershell theme={"theme":{"light":"github-light","dark":"github-dark"}} setx MODELSLAB_API_KEY "your_api_key_here" ``` Then reference it in your config: ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "mcpServers": { "modelslab": { "url": "https://modelslab.com/mcp/v7", "headers": { "Authorization": "Bearer %MODELSLAB_API_KEY%" } } } } ``` Note: Environment variable substitution support varies by client. Check your specific client's documentation. *** ## Verification After configuring your MCP client, verify the integration is working: ### Test Connection Ask your AI agent to list available models: ``` List the available image generation models from ModelsLab ``` ### Generate a Test Image ``` Generate a simple test image of a blue circle on a white background using ModelsLab ``` ### Check for Errors If the integration isn't working, check: 1. **API Key**: Ensure your API key is valid and has sufficient credits 2. **URL**: Verify the endpoint URL is correct 3. **Headers**: Confirm the Authorization header format is correct 4. **Client Support**: Ensure your MCP client supports HTTP transport *** ## Troubleshooting * Verify the endpoint URL is correct * Check your network connection * Ensure there are no firewall rules blocking the connection * Verify your API key is correct * Check that the Authorization header uses `Bearer ` prefix (with space) * Ensure your API key has not expired * Restart your MCP client after configuration changes * Check the configuration file syntax (valid JSON) * Verify the config file is in the correct location * Check your ModelsLab account for usage limits * Add delays between requests if making many calls * Consider upgrading your plan for higher limits *** ## Next Steps Explore all available MCP tools and their parameters Create or manage your ModelsLab API keys # MCP Web API Source: https://docs.modelslab.com/mcp-web-api/overview Connect AI agents to ModelsLab via two hosted MCP servers: Generation (image/video/audio/LLM) and Agent Control Plane (account management). ## What is the MCP Web API? ModelsLab provides **two hosted MCP servers** that give AI agents complete access to the platform — no local installation required: 24 tools for image, video, audio, and LLM generation. Auth: API key. 10 tools for account management — auth, billing, subscriptions, teams, and more. Auth: Bearer token. Both servers use the [Model Context Protocol](https://modelcontextprotocol.io/) specification over HTTP with JSON-RPC 2.0 and SSE transport. ## Endpoints | Server | URL | Auth | Purpose | | ------------------- | ---------------------------------- | ------------ | -------------------------------------- | | Generation | `https://modelslab.com/mcp/v7` | API key | Image, video, audio, LLM generation | | Agent Control Plane | `https://modelslab.com/mcp/agents` | Bearer token | Account, billing, subscriptions, teams | ## Generation Server The Generation MCP server enables AI assistants to interact with the ModelsLab V7 API for AI-powered generation capabilities including images, videos, audio, and chat completions. ### Key Features Generate, transform, and edit images using text prompts and advanced AI models Create videos from text, animate images, and apply AI transformations Text-to-speech, speech-to-text, music generation, and voice transformation Chat with powerful language models for text generation and conversation ### Authentication All requests must include your ModelsLab API key using one of the following methods: ```http theme={"theme":{"light":"github-light","dark":"github-dark"}} Authorization: Bearer YOUR_API_KEY ``` ```http theme={"theme":{"light":"github-light","dark":"github-dark"}} X-API-Key: YOUR_API_KEY ``` Get your API key from the [ModelsLab Dashboard](https://modelslab.com/dashboard/api-keys). ## Protocol The MCP Web API uses the [Model Context Protocol](https://modelcontextprotocol.io/) specification. Communication is done via JSON-RPC 2.0 over HTTP. ### Request Format ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "tool-name", "arguments": { "param1": "value1", "param2": "value2" } } } ``` ### Response Format ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "jsonrpc": "2.0", "id": 1, "result": { "content": [ { "type": "text", "text": "..." } ] } } ``` ### Available Tools (Generation Server) | Category | Tools | Description | | ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------- | | **Models** | `list-models`, `list-providers` | Browse available AI models | | **Image** | `text-to-image`, `image-to-image`, `inpaint-image`, `fetch-image` | Generate and edit images | | **Video** | `text-to-video`, `image-to-video`, `video-to-video`, `lip-sync`, `motion-control`, `fetch-video` | Create and transform videos | | **Audio** | `text-to-speech`, `speech-to-text`, `speech-to-speech`, `sound-generation`, `music-generation`, `song-extender`, `song-inpaint`, `dubbing`, `fetch-audio` | Audio generation and processing | | **LLM** | `chat-completion` | Chat with AI language models | See detailed documentation for all 24 generation tools, parameters, and examples. ## Agent Control Plane Server The Agent Control Plane MCP server lets AI agents manage an entire ModelsLab account lifecycle — signup, authentication, API keys, billing, subscriptions, and teams — without a browser. Full documentation for all 10 account management tools, setup guides, and examples. ## Quick Example Here's a simple example generating an image using the MCP Web API: **1. List available models:** ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "list-models", "arguments": { "feature": "imagen", "limit": 5 } } } ``` **2. Generate an image:** ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "jsonrpc": "2.0", "id": 2, "method": "tools/call", "params": { "name": "text-to-image", "arguments": { "model_id": "flux-dev", "prompt": "A futuristic city at night with neon lights", "width": 1024, "height": 1024 } } } ``` **3. Fetch the result:** ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "jsonrpc": "2.0", "id": 3, "method": "tools/call", "params": { "name": "fetch-image", "arguments": { "id": 12345 } } } ``` ## Error Handling Errors are returned in standard JSON-RPC 2.0 format: ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "jsonrpc": "2.0", "id": 1, "error": { "code": -32600, "message": "Authentication required. Please provide a valid API key." } } ``` ### Common Error Codes | Code | Description | | -------- | ---------------- | | `-32600` | Invalid Request | | `-32601` | Method not found | | `-32602` | Invalid params | | `-32603` | Internal error | ## Server Information | | Generation Server | Agent Control Plane | | -------------- | ---------------------------- | ------------------------------- | | **Name** | `modelslab-v7-api` | `modelslab-agent-control-plane` | | **Version** | `1.0.0` | `1.0.0` | | **Protocol** | MCP (Model Context Protocol) | MCP (Model Context Protocol) | | **Transport** | HTTP with JSON-RPC 2.0 / SSE | HTTP with JSON-RPC 2.0 / SSE | | **Local name** | `v7-api` | `agent-control-plane` | ## Next Steps Complete documentation for all 24 generation MCP tools Setup guides for Claude Code, Cursor, VS Code, and other AI agents Account management MCP server with 10 tools Setup the account management MCP server in your IDE # Tools Reference Source: https://docs.modelslab.com/mcp-web-api/tools-reference Complete reference for all MCP Web API tools including parameters, examples, and response formats. ## Models (Read-Only) ### list-models Browse and search available AI models on the ModelsLab platform. Filter by product: `imagen`, `videofusion`, `audiogen`, `llmaster`, `threedverse` Filter by model category (e.g., `stable_diffusion`, `flux`, `llm`, `video`) Filter by subcategory (e.g., `lora`, `controlnet`, `checkpoint`) Filter by provider (e.g., `modelslab`, `civitai`) Search by name, ID, description, or tags Filter models that have ALL specified tags `false` to exclude NSFW, `true` to include. Defaults to user preference Sort order: `recommended` (default), `latest`, `most-used` Max results (1-100). Default: 20 ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "list-models", "arguments": { "feature": "imagen", "search": "realistic", "limit": 5 } } } ``` *** ### list-providers List all model providers with model counts. Filter by product: `imagen`, `videofusion`, `audiogen`, `llmaster`, `threedverse` Filter by model category *** ## Image Generation ### text-to-image Generate images from text prompts. Model ID (e.g., `flux-dev`, `sdxl`) Text description of the image What to avoid in the image Image width (512-1024) Image height (512-1024) Aspect ratio (e.g., `1:1`, `16:9`, `9:16`) Number of images (1-4) Webhook URL for completion notification Custom tracking ID ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "text-to-image", "arguments": { "model_id": "flux-dev", "prompt": "A serene mountain landscape at sunset with a crystal clear lake", "negative_prompt": "blurry, low quality", "width": 1024, "height": 768, "samples": 1 } } } ``` Returns a request ID that can be used with `fetch-image` to retrieve results. *** ### image-to-image Transform existing images based on text prompts. Model ID for transformation How to transform the image Input image URL or base64 string What to avoid in the output Output width (512-1024) Output height (512-1024) Output aspect ratio Transformation strength (0-1). Higher = more change Number of images (1-4) Webhook URL Custom tracking ID *** ### inpaint-image Edit specific areas of images using masks. Model ID for inpainting What to paint in the masked area Input image URL or base64 Mask image (white = edit, black = preserve) What to avoid Transformation strength (0-1) Webhook URL Custom tracking ID *** ### fetch-image Retrieve the status and results of an image generation request. Request ID from a previous generation call *** ## Video Generation ### text-to-video Generate videos from text descriptions. Model ID for video generation Text description of the video What to avoid Video width (512-1024) Video height (512-1024) Aspect ratio (e.g., `16:9`, `9:16`) Duration in seconds (min 4) Frames per second Output resolution preset Generate in portrait orientation Keep camera position fixed Use AI to enhance the prompt Generate audio for the video Audio URL to sync with Webhook URL Custom tracking ID *** ### image-to-video Animate static images into videos. Model ID for video generation Input image URL or base64 Motion/transformation description What to avoid Video aspect ratio Duration in seconds (min 4) Output resolution preset Portrait orientation Audio URL to sync with Webhook URL Custom tracking ID *** ### video-to-video Transform existing videos with AI. Model ID for transformation How to transform the video Input video URL Optional reference image What to avoid Output aspect ratio Duration in seconds (min 4) Random seed (0-4294967295) `auto`, `low`, `medium`, `high` Webhook URL Custom tracking ID *** ### lip-sync Sync video with audio for lip movements. Model ID for lip sync Video URL or base64 containing face Audio URL or base64 to sync with Webhook URL Custom tracking ID *** ### motion-control Control motion in video generation using reference video. Model ID for motion control Character/subject image Video for motion reference Use orientation from `image` or `video` Optional text prompt (max 2500 chars) `std` (standard) or `pro` (professional) `yes` or `no` Webhook URL Custom tracking ID *** ### fetch-video Retrieve the status and results of a video generation request. Request ID from a previous video generation call *** ## Audio Generation ### text-to-speech Convert text to natural speech audio. Model ID for text-to-speech Text to convert to speech Voice ID to use Voice variation (0-1) Webhook URL Custom tracking ID *** ### speech-to-text Transcribe audio to text. Model ID for transcription Audio URL or base64 to transcribe Webhook URL Custom tracking ID *** ### speech-to-speech Voice conversion and transformation. Model ID for voice conversion Audio URL or base64 to transform Target voice ID Webhook URL Custom tracking ID *** ### sound-generation Generate sound effects from text descriptions. Model ID for sound generation Description of the sound effect Webhook URL Custom tracking ID *** ### music-generation Create music from text prompts. Model ID for music generation Description of the music to generate Webhook URL Custom tracking ID *** ### song-extender Extend existing music tracks. Model ID for song extension Audio URL or base64 to extend Direction for the extension Webhook URL Custom tracking ID *** ### song-inpaint Edit specific parts of songs. Model ID for song inpainting Audio URL or base64 to edit What to replace/edit in the song Webhook URL Custom tracking ID *** ### dubbing Create dubbed audio content. Model ID for dubbing Original audio URL or base64 Target language for dubbing Webhook URL Custom tracking ID *** ### fetch-audio Retrieve the status and results of an audio generation request. Request ID from a previous audio generation call *** ## LLM ### chat-completion Chat with AI language models. LLM model ID Array of message objects with `role` and `content` Sampling temperature Maximum tokens to generate Webhook URL Custom tracking ID ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "chat-completion", "arguments": { "model_id": "llama-3", "messages": [ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "What is the capital of France?"} ], "temperature": 0.7, "max_tokens": 500 } } } ``` # Tutorials Source: https://docs.modelslab.com/open-source/modelq/advanced-usage ModelQ usage examples. ## 🧪 Build a Text Generation Streaming Server with ModelQ and FastAPI Explore how to create a real-time text generation server using ModelQ, FastAPI, and GPT-2. This tutorial guides you through setting up FastAPI endpoints, integrating ModelQ tasks, and deploying a streaming server. 👉 [Read the full tutorial on Medium](https://medium.com/@tanmaypatil3151/building-a-text-generation-streaming-server-with-modelq-and-fastapi-8bdbd7d74f28) # Installation Source: https://docs.modelslab.com/open-source/modelq/installation ModelQ is a fast, lightweight Python library for scheduling ML inference tasks using Redis and threading, serving as a simpler alternative to Celery. ## Installation[​](#overview "Direct link to Overview") ## Install Via PyPI ```bash pip theme={"theme":{"light":"github-light","dark":"github-dark"}} pip install modelq ``` ## Install Via GitHub ```bash pip theme={"theme":{"light":"github-light","dark":"github-dark"}} pip install git+https://github.com/ModelsLab/modelq.git ``` # ModelQ - Open Source Queue Manager Source: https://docs.modelslab.com/open-source/modelq/overview ModelQ is an open-source task queue manager for AI workloads. Manage and distribute AI model inference tasks efficiently. Modelq Pn ## Features * Retry support (automatic and manual) * Timeout handling for long-running tasks * Manual retry using RetryTaskException * Streaming results from tasks in real-time * Middleware hooks for task lifecycle events * Fast, non-blocking concurrency using threads * Built-in decorators to register tasks quickly * Redis-based task queueing * CLI interface for orchestration * Pydantic model support for task validation and typing * Auto-generated REST API for tasks # Usage Source: https://docs.modelslab.com/open-source/modelq/usage ModelQ usage examples. ## Basic Usage ```python python theme={"theme":{"light":"github-light","dark":"github-dark"}} from modelq import ModelQ from modelq.exceptions import RetryTaskException from redis import Redis import time imagine_db = Redis(host="localhost", port=6379, db=0) q = ModelQ(redis_client=imagine_db) @q.task(timeout=10, retries=2) def add(a, b): return a + b @q.task(stream=True) def stream_multiples(x): for i in range(5): time.sleep(1) yield f"{i+1} * {x} = {(i+1) * x}" @q.task() def fragile(x): if x < 5: raise RetryTaskException("Try again.") return x q.start_workers() task = add(2, 3) print(task.get_result(q.redis_client)) ``` ## CLI Usage You can interact with ModelQ using the `modelq` command-line tool. All commands require an `--app-path` parameter to locate your ModelQ instance in `module:object` format. ## Start Workers ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} modelq run-workers main:modelq_app --workers 2 ``` ### Start background worker threads for executing tasks. ## Check Queue Status ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} modelq status --app-path main:modelq_app ``` Show number of servers, queued tasks, and registered task types. ## List Queued Tasks ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} modelq list-queued --app-path main:modelq_app ``` Display a list of all currently queued task IDs and their names. ## Clear the Queue ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} modelq clear-queue --app-path main:modelq_app ``` Remove all tasks from the queue. ## Remove a Specific Task ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} modelq remove-task --app-path main:modelq_app --task-id ``` Remove a specific task from the queue by ID. ## Serve API ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} modelq serve-api --app-path main:modelq_app --host 0.0.0.0 --port 8000 --log-level info ``` Start a FastAPI server for ModelQ to accept task submissions over HTTP. ## Version ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} modelq version ``` Print the current version of ModelQ CLI. ## Pydantic Support ModelQ supports **Pydantic models** as both input and output types for tasks. This allows automatic validation of input parameters and structured return values. ## Example ```python python theme={"theme":{"light":"github-light","dark":"github-dark"}} from pydantic import BaseModel, Field from redis import Redis from modelq import ModelQ import time class AddIn(BaseModel): a: int = Field(ge=0) b: int = Field(ge=0) class AddOut(BaseModel): total: int redis_client = Redis(host="localhost", port=6379, db=0) mq = ModelQ(redis_client=redis_client) @mq.task(schema=AddIn, returns=AddOut) def add(payload: AddIn) -> AddOut: print(f"Processing addition: {payload.a} + {payload.b}.") time.sleep(10) # Simulate some processing time return AddOut(total=payload.a + payload.b) ``` ## Getting Result ```python python theme={"theme":{"light":"github-light","dark":"github-dark"}} output = job.get_result(mq.redis_client, returns=AddOut) ``` ModelQ will validate inputs using Pydantic and serialize/deserialize results seamlessly. *** ## Middleware Support ModelQ allows you to plug in custom middleware to hook into events: ## Supported Events * `before_worker_boot` * `after_worker_boot` * `before_worker_shutdown` * `after_worker_shutdown` * `before_enqueue` * `after_enqueue` * `on_error` ## Example ```python python theme={"theme":{"light":"github-light","dark":"github-dark"}} from modelq.app.middleware import Middleware class LoggingMiddleware(Middleware): def before_enqueue(self, *args, **kwargs): print("Task about to be enqueued") def on_error(self, task, error): print(f"Error in task {task.task_id}: {error}") ``` ### Attach to ModelQ instance: ```python python theme={"theme":{"light":"github-light","dark":"github-dark"}} q.middleware = LoggingMiddleware() ``` *** ## Configuration Connect to Redis using custom config: ```python python theme={"theme":{"light":"github-light","dark":"github-dark"}} from redis import Redis imagine_db = Redis(host="localhost", port=6379, db=0) modelq = ModelQ( redis_client=imagine_db, delay_seconds=10, # delay between retries webhook_url="https://your.error.receiver/discord-or-slack" ) ``` *** ## License ModelQ is released under the MIT License. *** ## Contributing We welcome contributions! Open an issue or submit a PR at [github.com/modelslab/modelq](https://github.com/modelslab/modelq). # Quickstart Source: https://docs.modelslab.com/quickstart Get started with ModelsLab API in under 5 minutes. Generate your first AI image with a simple API call using cURL, Python, or JavaScript. ## Overview This guide will help you make your first API call to ModelsLab and generate an AI image. By the end, you'll have a working integration. **Time to complete**: 5 minutes **What you'll need**: * A ModelsLab account ([sign up free](https://modelslab.com)) * An API key ([get one here](https://modelslab.com/dashboard/api-keys)) ## Step 1: Get Your API Key Go to [modelslab.com](https://modelslab.com) and log in to your account. Open your [API Keys Dashboard](https://modelslab.com/dashboard/api-keys). Click **Create New Key** and copy the generated key. Save your API key securely. You won't be able to see it again after leaving the page. ## Step 2: Make Your First API Call Choose your preferred language and run the code: ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}} import requests response = requests.post( "https://modelslab.com/api/v6/images/text2img", json={ "key": "YOUR_API_KEY", "prompt": "A majestic lion in a savanna at sunset, photorealistic, 8k", "model_id": "flux", "width": 512, "height": 512, "samples": 1, "num_inference_steps": 30, "guidance_scale": 7.5 } ) data = response.json() print(data) # If successful, the image URL will be in data["output"] if data.get("status") == "success": print(f"Image URL: {data['output'][0]}") ``` ```javascript JavaScript theme={"theme":{"light":"github-light","dark":"github-dark"}} const response = await fetch("https://modelslab.com/api/v6/images/text2img", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ key: "YOUR_API_KEY", prompt: "A majestic lion in a savanna at sunset, photorealistic, 8k", model_id: "flux", width: 512, height: 512, samples: 1, num_inference_steps: 30, guidance_scale: 7.5 }) }); const data = await response.json(); console.log(data); // If successful, the image URL will be in data.output if (data.status === "success") { console.log(`Image URL: ${data.output[0]}`); } ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"github-dark"}} curl -X POST "https://modelslab.com/api/v6/images/text2img" \ -H "Content-Type: application/json" \ -d '{ "key": "YOUR_API_KEY", "prompt": "A majestic lion in a savanna at sunset, photorealistic, 8k", "model_id": "flux", "width": 512, "height": 512, "samples": 1, "num_inference_steps": 30, "guidance_scale": 7.5 }' ``` Replace `YOUR_API_KEY` with your actual API key from Step 1. ## Step 3: Understanding the Response ### Success Response When your image is generated successfully: ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "status": "success", "generationTime": 2.45, "id": "abc123-def456", "output": [ "https://pub-3626123a908346a7a8be8d9295f44e26.r2.dev/generations/abc123.png" ], "meta": { "prompt": "A majestic lion in a savanna at sunset, photorealistic, 8k", "model_id": "flux", "width": 512, "height": 512, "seed": 12345 } } ``` Open the URL in `output` to see your generated image! ### Processing Response (Async) For complex generations, you may receive a processing status: ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "status": "processing", "id": "abc123-def456", "eta": 15, "message": "Your request is being processed" } ``` If this happens, use the fetch endpoint to check the status: ```python theme={"theme":{"light":"github-light","dark":"github-dark"}} # Poll for results fetch_response = requests.post( f"https://modelslab.com/api/v6/images/fetch/{data['id']}", json={"key": "YOUR_API_KEY"} ) print(fetch_response.json()) ``` ## Key Parameters Explained | Parameter | Description | Default | | --------------------- | ---------------------------------------- | ------- | | `key` | Your API key (required) | - | | `prompt` | Text description of the image (required) | - | | `model_id` | AI model to use (e.g., "flux", "sdxl") | "flux" | | `width` | Image width in pixels (256-1024) | 512 | | `height` | Image height in pixels (256-1024) | 512 | | `samples` | Number of images to generate (1-4) | 1 | | `num_inference_steps` | Quality/detail level (20-50) | 30 | | `guidance_scale` | How closely to follow prompt (1-20) | 7.5 | ## Pro Tips for Better Results Be specific about what you want: * ❌ "a dog" * ✅ "A golden retriever puppy playing in autumn leaves, soft natural lighting, shallow depth of field, professional photography" Add style modifiers to guide the output: * "photorealistic", "8k", "detailed" * "oil painting", "watercolor", "digital art" * "cinematic lighting", "studio photography" * **Lower (3-7)**: More creative, varied results * **Higher (8-15)**: Closer to your prompt, more literal * **flux**: Best for photorealistic images * **sdxl**: Great for artistic and stylized images * Browse [all models](https://modelslab.com/models) to find the perfect fit ## Next Steps Now that you've made your first API call, explore more: Explore all image generation options Create AI-generated videos Generate speech and clone voices Edit and enhance images with AI ## Troubleshooting * Double-check your API key is copied correctly * Ensure you're including it in the `key` field of the request body * Verify your key hasn't been revoked in the dashboard You've hit your queue limit. Wait for current requests to complete or upgrade your plan. See [Rate Limits](/rate-limits) for details. Some generations take longer. Use the async pattern with the fetch endpoint to handle long-running requests. Need help? Join our [Discord community](https://discord.com/invite/modelslab-1033301189254729748) or contact [support@modelslab.com](mailto:support@modelslab.com). # Rate Limits Source: https://docs.modelslab.com/rate-limits Understanding ModelsLab API rate limits, request queuing, and concurrency limits for Free, Starter, Pro, and Enterprise subscription plans. **Rate limits help ensure fair usage and optimal performance for all users. Each subscription plan has specific limits for queued API requests.** ## Request Queue Limits Our API uses request queue limits to manage server load and ensure optimal performance. The limits vary based on your subscription plan: **5 queued API requests** Perfect for individual developers and small projects getting started with our APIs. **10 queued API requests** Ideal for growing businesses and applications with moderate usage requirements. **15 queued API requests** Designed for enterprise applications and high-volume usage scenarios. ## How Request Queuing Works Request queuing ensures that API calls are processed sequentially in a controlled manner. Here's what you need to know: ### Understanding the Limits * **Sequential Processing**: Requests are processed one after another in queue order * **Queue Management**: New requests are added to the queue and processed when previous ones complete * **Per Account**: Limits apply to your entire account, not per API endpoint * **Real-time**: The limit is enforced in real-time as requests come in ### Example Scenarios If you have 5 requests in the queue and try to make a 6th request, it will be rejected until one of the queued requests completes and is processed. You can have up to 10 requests in the queue. Any additional requests will be rejected until queue space becomes available. Up to 15 requests can be queued, providing the highest capacity for enterprise applications. ## Request Queuing When you reach your queue limit: 1. **Queue Full**: Additional requests are rejected with a rate limit error 2. **Sequential Processing**: Requests are processed one after another in queue order 3. **FIFO Order**: Requests are processed in First-In-First-Out order 4. **Automatic Processing**: Queued requests are automatically processed as previous ones complete ## Best Practices ### Optimizing for Rate Limits Keep track of your queued requests to avoid hitting limits unexpectedly. Add exponential backoff retry logic for better handling of rate limit scenarios. When possible, combine multiple operations into single requests to reduce queue usage. Consider upgrading your plan if you consistently hit queue limits. ### Error Handling When you hit rate limits, you'll receive an HTTP 429 status code with details about the limit: ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "status": "error", "message": "Rate limit exceeded. Maximum 5 queued requests allowed.", "retry_after": 30 } ``` ## Upgrading Your Plan If you need higher queue limits: 1. **Log in** to your ModelsLab account 2. **Navigate** to the billing section 3. **Select** a higher tier plan 4. **New limits** take effect immediately **Need more than 15 queued requests?** Contact our enterprise team for custom solutions tailored to your specific needs. ## Frequently Asked Questions Additional requests are rejected with a rate limit error. You'll need to wait for queued requests to complete before making new ones. No, queue limits are enforced in real-time, not on a daily basis. They're based on current queue size, not total requests per day. No, the queue limit applies to your entire account across all API endpoints. ## Support Need help with rate limits or want to discuss custom solutions? * **Documentation**: Check our [API Reference](/api-reference) for detailed endpoint information * **Support**: Contact us at [support@modelslab.com](mailto:support@modelslab.com) * **Discord**: Join our [Discord community](https://discord.com/invite/modelslab-1033301189254729748) for real-time help # Changelog Source: https://docs.modelslab.com/release-notes/api Follow along with updates across ModelsLab API and Developer Console. ## Voice Cloning API: Voice Changer Endpoint Deprecation Notice The [Voice Changer](/voice-cloning/voice-to-voice) endpoint on the Standard API will be deprecated and discontinued on July 31, 2026 (UTC). Going forward, this endpoint will only be available on the Enterprise API. Standard API users should migrate to the [Enterprise API](/enterprise-api/voice-cloning/voice-to-voice) before the deprecation date to avoid disruption. #### Endpoint Being Deprecated * **Standard API**: `POST /api/v6/voice/voice_to_voice` Voice Cloning API ## Voice Cloning API: Expanded Language Support & Performance Improvements The [Voice Cloning](/voice-cloning/voice-cloning) endpoint has been upgraded with broader language coverage and faster inference times for more natural-sounding output. #### API Endpoint * **Standard API**: `POST /api/v6/voice/text_to_audio` #### What's New * **48 languages supported** — up from 19, now covering major South Asian, Southeast Asian, Middle Eastern, and European languages * **Faster inference** — reduced latency for quicker audio generation * **More natural output** — improved prosody and pronunciation across all supported languages * **Fully backward compatible** — all existing language values continue to work #### Newly Added Languages Assamese, Bengali, Finnish, Gujarati, Hebrew, Indonesian, Kannada, Maithili, Malay, Malayalam, Marathi, Min Nan Chinese, Nepali, Odia, Punjabi, Sindhi, Sinhala, Slovak, Swahili, Tamil, Telugu, Ukrainian, Urdu, Vietnamese, Welsh, Yue Chinese ## MusicGen API: New Parameters Added `duration`, `output_format`, and `bitrate` parameters to the [MusicGen API](/voice-cloning/music-gen). #### API Endpoint * **Standard API**: `POST /api/v6/voice/music_gen` #### New Parameters * **`duration`**: Set the length of generated music in seconds. Any value between 30 and 480. Default: `30`. * **`output_format`**: Choose output format — `wav`, `mp3`, or `flac`. Default: `wav`. * **`bitrate`**: Set audio bitrate — `128k`, `192k`, or `320k`. Default: `320k`. ## Video API: Scene Maker Endpoint Deprecated The Scene Maker endpoint has been deprecated and is no longer supported as of January 26, 2026. #### Deprecated Endpoint * **Standard API**: `POST /api/v6/video/scene_maker` ## New Enterprise API Endpoint: [Speech-to-Text](/enterprise-api/speech-to-text/speech-to-text) Enterprise Speech-to-Text is now available for converting audio into text transcription. #### API Endpoint * **Enterprise API**: `POST /api/v1/enterprise/speech_to_text/transcribe` #### Key Features * Convert speech audio into text transcription * Multi-language transcription support * Optional timestamp controls with `timestamp_level` (`null`, `word`, `sentence`) * Webhook support via `webhook` and `track_id` for async tracking Song Generator API ## Song Generator API powered by ACE-Step v1.5 Major upgrade to the Song Generator API with the new **ACE-Step v1.5** model for professional-grade song creation. #### API Endpoint * **Standard API**: `POST /api/v6/voice/song_generator` #### What's New * **ACE-Step v1.5 Model**: State-of-the-art AI model for high-quality song generation with vocal synthesis * **50+ Languages**: Generate songs with vocals in languages from Arabic to Chinese, Cantonese to Spanish * **Flexible Duration**: Create songs from 30 seconds to 8 minutes (30-480 seconds) * **Instrumental Mode**: Generate instrumental versions without vocals using `instrumental` parameter * **Smart Lyrics Generation**: Automatic lyrics generation based on prompt and caption, or use your own lyrics * **Advanced Control**: * `caption` parameter for music style, instruments, atmosphere, and production style * `lyrics` parameter for song structure, vocal styles, and energy control * `prompt` parameter for automatic lyrics generation * Language-specific vocal synthesis with proper pronunciation #### New Documentation * **[Song Generator API Reference](/voice-cloning/song-generator)**: Complete API documentation with examples * **[Song Generation Guide](/guides/song-generation-guide)**: Professional guide with best practices, caption writing tips, lyrics structure guidance, duration calculation, and real-world examples #### Key Features * Professional music structure tags: `[Intro]`, `[Verse]`, `[Chorus]`, `[Bridge]`, `[Outro]` * Vocal control tags: `[raspy vocal]`, `[whispered]`, `[falsetto]`, `[powerful belting]` * Energy control: `[high energy]`, `[building energy]`, `[explosive]`, `[melancholic]` * Consistent caption-lyrics matching for optimal results * Duration calculation guidelines based on lyrics length and structure #### Getting Started Check out the [Song Generation Guide](/guides/song-generation-guide) for detailed examples and best practices for creating professional songs with the ACE-Step v1.5 model. ## New Parameter in Song Generator API Endpoint: [Song Generator API](/voice-cloning/song-generator) Added `model_id` parameter to select between `diffrhythm-short` and `diffrhythm-long` models for song generation. * `diffrhythm-short`: Generates shorter with maximum duration of 1 minute 35 seconds. * `diffrhythm-long`: Generates longer songs with maximum duration of 4 minute 45 seconds. ## New parameter in Lyrics Generator API Endpoint: [Lyrics Generator API](/voice-cloning/lyrics-generator) Added `length` parameter to specify desired length of generated lyrics. * `short`: Generates shorter lyrics with maximum duration of 1 minute 35 seconds. * `long`: Generates longer lyrics with maximum duration of 4 minute 45 seconds. #### API Endpoints * **Standard API**: `POST /api/v6/voice/song_generator` * **Standard API**: `POST /api/v6/voice/lyrics_generator` #### Key Features * Select between short and long models for song generation * Specify desired length of generated lyrics ## New Enterprise API Endpoint: [Qwen Text to Image](/enterprise-api/qwen/text-to-img) Generate high-definition images from text using the Qwen model. #### API Endpoint * **Enterprise API**: `POST /api/v1/enterprise/qwen/text2img` #### Key Features * Generate high-definition images from text using Qwen model * Supports various image styles and attributes * Resolution up to 1024x1024 pixels. ## New Video API Endpoint: [Watermark Remover](/video-api/watermark-remover) Remove watermarks from SORA videos. #### API Endpoint * **Standard API**: `POST /api/v6/video/watermark_remover` #### Key Features * SORA watermark detection and removal * Preserves video quality ## New Image Editing Endpoint: [Caption](/image-editing/caption) Simple and powerful image captioning endpoint to generate descriptive text from images. #### API Endpoint * **Standard API**: `POST /api/v6/image_editing/caption` #### Key Features * Automatic image caption generation * Customizable caption length (short, normal, long) * Supports multiple image formats: `png`, `jpeg`, `jpg` ## Flux Kontext Dev Moved to Image Editing API Flux Kontext Image to Image endpoint moved from Image Generation API to Image Editing API section for better organization. * **New Location**: [Image Editing API → Flux Kontext Image to Image](/image-editing/flux-kontext-img-to-image) * **Endpoint**: `POST /api/v6/images/img2img` * Fixed OpenAPI playground display ## New Image Editing Endpoint: [Qwen Edit](/image-editing/qwen-edit) Added Qwen Edit endpoint for AI-powered image editing using the Qwen model. #### API Endpoints * **Standard API**: `POST /api/v6/image_editing/qwen_edit` * **Enterprise API**: `POST /api/v1/enterprise/image_editing/qwen_edit` #### Key Features * Prompt-based image editing and manipulation * Support for single or multiple images (up to 4 images) ## New Interior API Endpoints Added two new endpoints to the Interior API for enhanced object manipulation capabilities: #### Object Removal * **Endpoint**: `POST /api/v6/interior/object_removal` * Remove unwanted objects from interior images using AI * Parameters: `init_image`, `object_name`, `base64`, `webhook`, `track_id` * Simple text-based object identification #### Interior Mixer * **Endpoint**: `POST /api/v6/interior/interior_mixer` * Add objects from one image into another room image * Parameters: `init_image`, `object_image`, `prompt`, `width`, `height`, `guidance_scale`, `num_inference_steps` * Intelligent object placement with prompt-based positioning * Configurable inference steps (default: 8) and guidance scale #### Documentation Updates * Added complete API reference documentation for both endpoints * Updated OpenAPI specification with new schemas * Added visual indicators for new endpoints in the overview ## Rate Limits Documentation Added comprehensive rate limits documentation with plan-specific queue limits: * **Pay as you go plan**: 5 queued API requests * **Standard plan**: 10 queued API requests * **Unlimited Premium Plan**: 15 queued API requests #### Key Features * **Sequential Processing**: Requests are processed one after another in queue order * **Queue Management**: New requests are added to the queue and processed when previous ones complete * **Real-time Enforcement**: Limits are enforced in real-time as requests come in * **FIFO Processing**: Requests are processed in First-In-First-Out order #### Enterprise API Updates * Added Reset S3 endpoint to Enterprise API General section * Updated S3 management capabilities for dedicated servers ## New Model: Wan 2.5 Added Wan 2.5 to ModelsLab with enhanced video generation capabilities: * **Text to Video**: Generate videos from text prompts with audio support * **Image to Video**: Transform static images into dynamic videos with sound * **Audio Integration**: Built-in audio support for complete multimedia experiences * **Enhanced Quality**: Improved motion smoothness and visual realism #### Available Models * [Wan 2.5 Text to Video](https://modelslab.com/models/alibaba_cloud/wan25-text-to-video-audioSupport) * [Wan 2.5 Image to Video](https://modelslab.com/models/alibaba_cloud/wan25-image-to-video) ## Added threshold parameter to NSFW Image Check * Added `threshold` parameter to `POST /nsfw_image_check`. * Type: number; range: 0–1; default: 0.5. * Controls sensitivity for NSFW detection in images/videos. # Request New Client Source: https://docs.modelslab.com/sdk/client The client for Dart provides a seamless interface to interact with Modelslab API. ### We have support via official client libraries for the following languages: Official TypeScript & JavaScript SDK for ModelsLab API Official Python SDK for ModelsLab API Official PHP SDK for ModelsLab API Official Dart SDK for ModelsLab API Official Go SDK for ModelsLab API Don't see your language? We are working on adding support for more languages. Reach out on our [Discord Community](https://discord.com/invite/modelslab-1033301189254729748) and let us know which language you would like to see next. # Dart Source: https://docs.modelslab.com/sdk/dart The client for Dart provides a seamless interface to interact with Modelslab API. ## Installation[​](#overview "Direct link to Overview") Add this to your `pubspec.yaml`: ```yaml theme={"theme":{"light":"github-light","dark":"github-dark"}} dependencies: modelslab: ^1.0.0 ``` Then run: ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} dart pub get ``` ## Realtime Api Usage ```dart theme={"theme":{"light":"github-light","dark":"github-dark"}} import 'package:modelslab/core/apis/realtime.dart'; import 'package:modelslab/core/apis/base.dart'; import 'package:modelslab/schemas/realtime.dart'; import 'package:modelslab/core/client.dart'; var client = Client(key: "Your api key"); var api = Realtime(client: client); //for text to image api. var schema = RealtimeText2ImageSchema(...) Future> response = api.textToImage(schema); //for image to image api. var schema = RealtimeImage2ImageSchema(...) Future> response = api.imageToImage(schema); ``` ## Community Api Usage ```dart theme={"theme":{"light":"github-light","dark":"github-dark"}} import 'package:modelslab/core/apis/community.dart'; import 'package:modelslab/core/apis/base.dart'; import 'package:modelslab/schemas/community.dart'; import 'package:modelslab/core/client.dart'; var client = Client(key: "Your api key"); var api = Community(client: client); //for text to image api. var schema = Text2Image(...) Future> response = api.textToImage(schema); //for image to image api. var schema = Image2Image(...) Future> response = api.imageToImage(schema); //for inpainting api. var schema = Inpainting(...) Future> response = api.inpainting(schema); //for controlnet api. var schema = ControlNet(...) Future> response = api.controlnet(schema); ``` ## Interior Api Usage ```dart theme={"theme":{"light":"github-light","dark":"github-dark"}} import 'package:modelslab/core/apis/interior.dart'; import 'package:modelslab/core/apis/base.dart'; import 'package:modelslab/schemas/interior.dart'; import 'package:modelslab/core/client.dart'; var client = Client(key: "Your api key"); var api = Interior(client: client); //for interior api. var schema = InteriorSchema(...) Future> response = api.interior(schema); //for room decorator api. var schema = RoomDecoratorSchema(...) Future> response = api.roomDecorator(schema); //for floor schema api. var schema = FloorSchema(...) Future> response = api.floor(schema); //for scenario api. var schema = ScenarioSchema(...) Future> response = api.scenario(schema); //for exterior api. var schema = ExteriorSchema(...) Future> response = api.exteriorRestorer(schema); ``` ## Audio Api Usage ```dart theme={"theme":{"light":"github-light","dark":"github-dark"}} import 'package:modelslab/core/apis/audio.dart'; import 'package:modelslab/core/apis/base.dart'; import 'package:modelslab/schemas/audio.dart'; import 'package:modelslab/core/client.dart'; var client = Client(key: "Your api key"); var api = Audio(client: client); //for text to audio api. var schema = Text2Audio(...) Future> response = api.textToAudio(schema); //for text to speech api. var schema = Text2Speech(...) Future> response = api.textToSpeech(schema); //for voice to voice api. var schema = Voice2Voice(...) Future> response = api.floor(schema); //for voice cover api. var schema = VoiceCover(...) Future> response = api.voiceCover(schema); //for music gen api. var schema = MusicGenSchema(...) Future> response = api.musicGen(schema); //for lyrics api. var schema = LyricsGenerator(...) Future> response = api.lyricsGen(schema); //for song generator api. var schema = SongGenerator(...) Future> response = api.songGenerator(schema); //for speechto text api. var schema = Speech2Text(...) Future> response = api.speechToText(schema); //for sfx api. var schema = SFX(...) Future> response = api.sfxGen(schema); ``` ## 3D Api Usage ```dart theme={"theme":{"light":"github-light","dark":"github-dark"}} import 'package:modelslab/core/apis/threed.dart'; import 'package:modelslab/core/apis/base.dart'; import 'package:modelslab/schemas/threed.dart'; import 'package:modelslab/core/client.dart'; var client = Client(key: "Your api key"); var api = ThreeD(client: client); //for text to 3D api. var schema = Text23D(...) Future> response = api.textTo3d(schema); //for image to 3D api. var schema = Image23D(...) Future> response = api.imageTo3d(schema); ``` ## Video Api Usage ```dart theme={"theme":{"light":"github-light","dark":"github-dark"}} import 'package:modelslab/core/apis/video.dart'; import 'package:modelslab/core/apis/base.dart'; import 'package:modelslab/schemas/video.dart'; import 'package:modelslab/core/client.dart'; var client = Client(key: "Your api key"); var api = Video(client: client); //for text to video api. var schema = Text2Video(...) Future> response = api.textToVideo(schema); //for image to video api. var schema = Image2Video(...) Future> response = api.imageToVideo(schema); ``` # Go Source: https://docs.modelslab.com/sdk/golang The client for Golang provides a seamless interface to interact with Modelslab API. # ModelsLab Go SDK Official Go SDK for [ModelsLab API](https://modelslab.com) - Generate AI content including images, videos, audio, 3D models, and more. ## Features **Text-to-Image & Image-to-Image** generation **Text-to-Speech & Music** generation **Interior Design & 3D** modeling **Image Editing** (upscaling, background removal, etc.) **Realtime** generation APIs **Enterprise** features support ## Quick Start ### 1. Installation ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} go mod init your-project go get github.com/modelslab/modelslab-go ``` ### 2. Get Your API Key 1. Sign up at [ModelsLab.com](https://modelslab.com) 2. Go to your dashboard 3. get your API key ### 3. Basic Usage with community models ```go theme={"theme":{"light":"github-light","dark":"github-dark"}} import ( "context" "encoding/json" "fmt" "github.com/modelslab/modelslab-go/pkg/apis/community" "github.com/modelslab/modelslab-go/pkg/client" communitySchema "github.com/modelslab/modelslab-go/pkg/schemas/community" ) func main() { c := client.New("your-api-key") api := community.New(c, false) model := "midjourney" req := &communitySchema.Text2ImageRequest{ Prompt: "a cat", ModelID: &model, } resp, err := api.TextToImage(context.Background(), &req) if err != nil { fmt.Println("Error:", err) return } out, _ := json.MarshalIndent(resp, "", " ") fmt.Println(string(out)) } ``` ### 4. Run Your Code ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} go run main.go ``` ## API Examples ### Text-to-Speech ```go theme={"theme":{"light":"github-light","dark":"github-dark"}} package main import ( "context" "encoding/json" "fmt" "github.com/modelslab/modelslab-go/pkg/apis/audio" "github.com/modelslab/modelslab-go/pkg/client" audioSchema "github.com/modelslab/modelslab-go/pkg/schemas/audio" ) func main() { c := client.New("your-api-key") api := audio.New(c, false) voice_id := "madison" language := "english" req := audioSchema.Text2SpeechRequest{ Prompt: "a cat sitting on a mat", VoiceID: &voice_id, Language: &language, } resp, err := api.TextToSpeech(context.Background(), &req) if err != nil { fmt.Println("Error:", err) return } out, _ := json.MarshalIndent(resp, "", " ") fmt.Println(string(out)) } ``` ### Text-to-Video ```go theme={"theme":{"light":"github-light","dark":"github-dark"}} package main import ( "context" "encoding/json" "fmt" "github.com/modelslab/modelslab-go/pkg/apis/video" "github.com/modelslab/modelslab-go/pkg/client" videoSchema "github.com/modelslab/modelslab-go/pkg/schemas/video" ) func main() { c := client.New("your-api-key") videoAPI := video.New(c, false) req := videoSchema.Text2VideoRequest{ Prompt: "A cat playing with a ball in a sunny garden", ModelID: "cogvideox", } resp, err := videoAPI.TextToVideo(context.Background(), &req) if err != nil { panic(err) } prettyJSON, _ := json.MarshalIndent(resp, "", " ") fmt.Println(string(prettyJSON)) } ``` ## Available APIs | API | Description | Package | | ----------------- | ----------------------------------------------------- | ---------------------------------------------------------- | | **Community** | Text-to-Image, Image-to-Image, Inpainting, ControlNet | `github.com/modelslab/modelslab-go/pkg/apis/community` | | **Audio** | Text-to-Speech, Music Generation, Voice Cloning | `github.com/modelslab/modelslab-go/pkg/apis/audio` | | **Video** | Text-to-Video, Image-to-Video | `github.com/modelslab/modelslab-go/pkg/apis/video` | | **Image Editing** | Super Resolution, Background Removal, Outpainting | `github.com/modelslab/modelslab-go/pkg/apis/image_editing` | | **Interior** | Interior Design, Room Decoration | `github.com/modelslab/modelslab-go/pkg/apis/interior` | | **3D** | Text-to-3D, Image-to-3D | `github.com/modelslab/modelslab-go/pkg/apis/threed` | | **Realtime** | Real-time Image Generation | `github.com/modelslab/modelslab-go/pkg/apis/realtime` | ## Configuration ### Basic Client ```go theme={"theme":{"light":"github-light","dark":"github-dark"}} import "github.com/modelslab/modelslab-go/pkg/client" // Simple client c := client.New("your-api-key") ``` ### Custom Configuration ```go theme={"theme":{"light":"github-light","dark":"github-dark"}} import ( "time" "github.com/modelslab/modelslab-go/pkg/client" ) config := &client.Config{ APIKey: "your-api-key", BaseURL: "https://modelslab.com/api/", FetchRetry: 10, FetchTimeout: 2 * time.Second, HTTPTimeout: 30 * time.Second, } c := client.NewWithConfig(config) ``` ### Enterprise Mode ```go theme={"theme":{"light":"github-light","dark":"github-dark"}} // For enterprise users communityAPI := community.New(c, true) // true = enterprise mode ``` ## Response Format The SDK returns **complete raw API responses** as `map[string]interface{}` to preserve all fields: ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "status": "success", "message": "Image generated successfully", "output": ["https://example.com/generated-image.jpg"], "id": 12345, "meta": { "prompt": "A beautiful sunset", "model": "stable-diffusion", "steps": 20, "seed": 12345 }, "generationTime": 5.2, "proxy_links": ["https://cdn.example.com/image.jpg"] } ``` You get **ALL** fields returned by the API, including metadata, generation time, proxy links, and any future fields. ## File Input Options The SDK supports multiple ways to provide images/audio: ```go theme={"theme":{"light":"github-light","dark":"github-dark"}} import "github.com/modelslab/modelslab-go/pkg/schemas/base" // URL input imageURL := "https://example.com/image.jpg" fileInput := base.FileInput{ URL: &imageURL, } // Base64 input base64Data := "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQ..." fileInput := base.FileInput{ Base64: &base64Data, } // File path (for local files) filePath := "/path/to/image.jpg" fileInput := base.FileInput{ FilePath: &filePath, } ``` Repository: * [Link to the repository](https://github.com/modelslab/modelslab-go) # PHP SDK Source: https://docs.modelslab.com/sdk/php Official PHP client for the ModelsLab API - generate images, videos, audio, and more. ## Overview The ModelsLab PHP SDK provides a clean, object-oriented interface to interact with all ModelsLab APIs. It handles authentication, request formatting, and response parsing automatically. View on Packagist Source code and issues ## Installation Install the SDK using Composer: ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} composer require modelslab/php ``` Or add it to your `composer.json`: ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "require": { "modelslab/php": "^1.0.2" } } ``` Requires PHP 7.4 or higher and Guzzle HTTP client. ## Quick Start Generate your first AI image: ```php theme={"theme":{"light":"github-light","dark":"github-dark"}} 'A majestic lion in a savanna at sunset, photorealistic, 8k', 'negative_prompt' => 'blurry, low quality, distorted', 'width' => 512, 'height' => 512, 'samples' => 1, 'num_inference_steps' => 30, 'guidance_scale' => 7.5 ]); $response = $modelslab->realtime()->textToImage($image); if ($response['status'] === 'success') { echo "Image URL: " . $response['output'][0]; } elseif ($response['status'] === 'processing') { echo "Processing, request ID: " . $response['id']; } ``` ## Client Configuration ### Basic Setup ```php theme={"theme":{"light":"github-light","dark":"github-dark"}} 'https://modelslab.com/api/', 'fetch_retry' => 10, 'fetch_timeout' => 2 ]); ``` ### Environment Variables Set your API key using environment variables: ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} export MODELSLAB_API_KEY="your-actual-api-key" # Or export API_KEY="your-actual-api-key" ``` Then in your code: ```php theme={"theme":{"light":"github-light","dark":"github-dark"}} $modelslab = new ModelsLab(getenv('MODELSLAB_API_KEY')); ``` *** ## Image Generation ### Text to Image (Realtime) ```php theme={"theme":{"light":"github-light","dark":"github-dark"}} 'A cyberpunk city at night, neon lights, rain, cinematic', 'negative_prompt' => 'blurry, low quality, distorted, deformed', 'width' => 1024, 'height' => 1024, 'samples' => 1, 'num_inference_steps' => 30, 'guidance_scale' => 7.5, 'seed' => 12345 // Optional: for reproducible results ]); $response = $modelslab->realtime()->textToImage($image); echo json_encode($response, JSON_PRETTY_PRINT); ``` ### Image to Image ```php theme={"theme":{"light":"github-light","dark":"github-dark"}} 'https://example.com/your-image.jpg', 'prompt' => 'Transform into a watercolor painting style', 'negative_prompt' => 'photo, realistic', 'width' => 512, 'height' => 512, 'strength' => 0.7, 'num_inference_steps' => 30, 'guidance_scale' => 7.5 ]); $response = $modelslab->realtime()->imageToImage($image); echo json_encode($response, JSON_PRETTY_PRINT); ``` ### Community Models ```php theme={"theme":{"light":"github-light","dark":"github-dark"}} 'flux', 'prompt' => 'Portrait of a woman, oil painting style, renaissance', 'negative_prompt' => 'modern, photo, blurry', 'width' => 512, 'height' => 768, 'samples' => 1, 'num_inference_steps' => 30, 'guidance_scale' => 7.5 ]); $response = $modelslab->community()->textToImage($image); echo json_encode($response, JSON_PRETTY_PRINT); ``` *** ## Video Generation ### Text to Video ```php theme={"theme":{"light":"github-light","dark":"github-dark"}} 'A spaceship flying through an asteroid field, cinematic, 4K', 'negative_prompt' => 'low quality, blurry, static', 'model_id' => 'cogvideox', 'width' => 512, 'height' => 512, 'num_frames' => 25, 'num_inference_steps' => 20, 'guidance_scale' => 7 ]); $response = $modelslab->video()->textToVideo($video); // Video generation is async if ($response['status'] === 'processing') { echo "Processing, request ID: " . $response['id']; echo "ETA: " . $response['eta'] . " seconds"; } ``` ### Image to Video ```php theme={"theme":{"light":"github-light","dark":"github-dark"}} 'https://example.com/landscape.jpg', 'prompt' => 'Clouds moving slowly, birds flying in the distance', 'model_id' => 'cogvideox', 'num_frames' => 25, 'num_inference_steps' => 20 ]); $response = $modelslab->video()->imageToVideo($video); echo json_encode($response, JSON_PRETTY_PRINT); ``` *** ## Audio Generation ### Text to Speech ```php theme={"theme":{"light":"github-light","dark":"github-dark"}} 'Hello! Welcome to ModelsLab. This is a sample of our text-to-speech API.', 'voice_id' => 'madison', 'language' => 'english' ]); $response = $modelslab->audio()->textToSpeech($tts); echo "Audio URL: " . $response['output'][0]; ``` ### Music Generation ```php theme={"theme":{"light":"github-light","dark":"github-dark"}} 'Upbeat electronic dance music with heavy bass drops', 'duration' => 30 ]); $response = $modelslab->audio()->musicGen($music); echo json_encode($response, JSON_PRETTY_PRINT); ``` ### Voice to Voice (Voice Cloning) ```php theme={"theme":{"light":"github-light","dark":"github-dark"}} 'https://example.com/source-speech.mp3', 'target_audio' => 'https://example.com/voice-to-clone.mp3' ]); $response = $modelslab->audio()->voice2Voice($voice); echo json_encode($response, JSON_PRETTY_PRINT); ``` ### Sound Effects (SFX) ```php theme={"theme":{"light":"github-light","dark":"github-dark"}} 'Thunder rolling in the distance with heavy rain', 'duration' => 10 ]); $response = $modelslab->audio()->sfxGen($sfx); echo json_encode($response, JSON_PRETTY_PRINT); ``` *** ## Image Editing ### Background Removal ```php theme={"theme":{"light":"github-light","dark":"github-dark"}} 'https://example.com/photo.jpg' ]); $response = $modelslab->imageEditing()->backgroundRemover($bgRemover); echo "Image without background: " . $response['output'][0]; ``` ### Super Resolution (Upscale) ```php theme={"theme":{"light":"github-light","dark":"github-dark"}} 'https://example.com/low-res-image.jpg', 'scale' => 4 // 2x or 4x ]); $response = $modelslab->imageEditing()->superResolution($upscale); echo json_encode($response, JSON_PRETTY_PRINT); ``` ### Object Removal ```php theme={"theme":{"light":"github-light","dark":"github-dark"}} 'https://example.com/photo.jpg', 'mask_image' => 'https://example.com/mask.png' ]); $response = $modelslab->imageEditing()->objectRemover($removal); echo json_encode($response, JSON_PRETTY_PRINT); ``` *** ## 3D Model Generation ### Text to 3D ```php theme={"theme":{"light":"github-light","dark":"github-dark"}} 'A medieval sword with ornate handle', 'num_inference_steps' => 50 ]); $response = $modelslab->threeD()->textTo3D($model); echo json_encode($response, JSON_PRETTY_PRINT); ``` *** ## Interior Design ### Interior Redesign ```php theme={"theme":{"light":"github-light","dark":"github-dark"}} 'https://example.com/room-photo.jpg', 'prompt' => 'Modern minimalist living room with Scandinavian furniture' ]); $response = $modelslab->interior()->interior($interior); echo json_encode($response, JSON_PRETTY_PRINT); ``` *** ## Error Handling The SDK throws exceptions for various error conditions: ```php theme={"theme":{"light":"github-light","dark":"github-dark"}} 'Hello world', 'voice_id' => 'madison', 'language' => 'english' ]); $response = $modelslab->audio()->textToSpeech($tts); if ($response['status'] === 'success') { echo "Audio URL: " . $response['output'][0]; } elseif ($response['status'] === 'processing') { echo "Processing, check back later with ID: " . $response['id']; } elseif ($response['status'] === 'error') { echo "API Error: " . $response['message']; } } catch (InvalidArgumentException $e) { // Invalid API key or parameters echo "Invalid argument: " . $e->getMessage(); } catch (RuntimeException $e) { // Network or API errors echo "Request failed: " . $e->getMessage(); } ``` *** ## Async Processing Pattern For long-running operations, poll for results: ```php theme={"theme":{"light":"github-light","dark":"github-dark"}} $prompt, 'model_id' => 'cogvideox', 'width' => 512, 'height' => 512, 'num_frames' => 25 ]); $response = $modelslab->video()->textToVideo($video); if ($response['status'] === 'success') { return $response['output'][0]; } if ($response['status'] !== 'processing') { throw new Exception($response['message'] ?? 'Generation failed'); } $requestId = $response['id']; $startTime = time(); while (time() - $startTime < $timeout) { sleep(5); // Wait 5 seconds between polls // Use fetch endpoint to check status // Return URL when complete // Throw exception if failed } throw new Exception('Timeout waiting for video generation'); } ``` *** ## Available APIs Summary | API | Methods | | ---------------- | ------------------------------------------------------------------------------ | | **Realtime** | `textToImage()`, `imageToImage()` | | **Community** | `textToImage()`, `imageToImage()`, `inpainting()`, `controlnet()` | | **Video** | `textToVideo()`, `imageToVideo()` | | **Audio** | `textToSpeech()`, `musicGen()`, `voice2Voice()`, `sfxGen()`, `speechToText()` | | **ImageEditing** | `backgroundRemover()`, `superResolution()`, `objectRemover()`, `outpainting()` | | **ThreeD** | `textTo3D()`, `imageTo3D()` | | **Interior** | `interior()`, `roomDecorator()`, `exterior()` | *** ## Next Steps Explore all API endpoints Browse available models Set up async notifications Handle errors properly # Python SDK Source: https://docs.modelslab.com/sdk/python Official Python client for the ModelsLab API - generate images, videos, audio, and more. ## Overview The ModelsLab Python SDK provides a simple, type-safe interface to interact with all ModelsLab APIs. It handles authentication, request formatting, and response parsing automatically. View on PyPI Source code and issues ## Installation ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} pip install modelslab_py ``` Requires Python 3.7 or higher. ## Quick Start Here's a complete example to generate your first image: ```python theme={"theme":{"light":"github-light","dark":"github-dark"}} from modelslab_py.core.client import Client from modelslab_py.core.apis.realtime import Realtime from modelslab_py.schemas.realtime import RealtimeText2ImageSchema # Initialize the client client = Client(api_key="your_api_key") # Create the API instance api = Realtime(client=client, enterprise=False) # Define the generation parameters schema = RealtimeText2ImageSchema( prompt="A majestic lion in a savanna at sunset, photorealistic, 8k", negative_prompt="blurry, low quality, distorted", width=512, height=512, samples=1, num_inference_steps=30, guidance_scale=7.5 ) # Generate the image response = api.text_to_image(schema) # Handle the response if response.get("status") == "success": print(f"Image URL: {response['output'][0]}") elif response.get("status") == "processing": print(f"Request ID: {response['id']} - Check back later") else: print(f"Error: {response.get('message')}") ``` ## Client Configuration ### Basic Setup ```python theme={"theme":{"light":"github-light","dark":"github-dark"}} from modelslab_py.core.client import Client # Standard API access client = Client(api_key="your_api_key") ``` ### Enterprise Setup ```python theme={"theme":{"light":"github-light","dark":"github-dark"}} from modelslab_py.core.client import Client from modelslab_py.core.apis.realtime import Realtime client = Client(api_key="your_enterprise_api_key") # Set enterprise=True for enterprise endpoints api = Realtime(client=client, enterprise=True) ``` ## Available APIs * **Realtime** - Fast image generation with FLUX and other models * **Community** - Access community fine-tuned models * **Image\_editing** - Edit, enhance, and transform images * **Video** - Generate videos from text or images * **Audio** - Text-to-speech, voice cloning, music generation * **Interior** - Interior design and room transformation * **Three\_D** - Generate 3D models from text or images *** ## Image Generation ### Text to Image (Realtime) Generate images from text prompts using the fastest models: ```python theme={"theme":{"light":"github-light","dark":"github-dark"}} from modelslab_py.core.client import Client from modelslab_py.core.apis.realtime import Realtime from modelslab_py.schemas.realtime import RealtimeText2ImageSchema client = Client(api_key="your_api_key") api = Realtime(client=client, enterprise=False) schema = RealtimeText2ImageSchema( prompt="A cyberpunk city at night, neon lights, rain, cinematic", negative_prompt="blurry, low quality, distorted, deformed", width=1024, height=1024, samples=1, num_inference_steps=30, guidance_scale=7.5, seed=12345 # Optional: for reproducible results ) response = api.text_to_image(schema) print(response) ``` ### Image to Image (Realtime) Transform existing images with a text prompt: ```python theme={"theme":{"light":"github-light","dark":"github-dark"}} from modelslab_py.core.apis.realtime import Realtime from modelslab_py.schemas.realtime import RealtimeImage2ImageSchema api = Realtime(client=client, enterprise=False) schema = RealtimeImage2ImageSchema( init_image="https://example.com/your-image.jpg", prompt="Transform into a watercolor painting style", negative_prompt="photo, realistic", width=512, height=512, strength=0.7, # How much to change the image (0-1) num_inference_steps=30, guidance_scale=7.5 ) response = api.image_to_image(schema) print(response) ``` ### Community Models Use fine-tuned community models for specific styles: ```python theme={"theme":{"light":"github-light","dark":"github-dark"}} from modelslab_py.core.client import Client from modelslab_py.core.apis.community import Community from modelslab_py.schemas.community import Text2Image, Image2Image, Inpainting, ControlNet client = Client(api_key="your_api_key") api = Community(client=client, enterprise=False) # Text to Image with a specific model schema = Text2Image( model_id="flux", # or any community model ID prompt="Portrait of a woman, oil painting style, renaissance", negative_prompt="modern, photo, blurry", width=512, height=768, samples=1, num_inference_steps=30, guidance_scale=7.5 ) response = api.text_to_image(schema) # Image to Image schema = Image2Image( model_id="flux", init_image="https://example.com/image.jpg", prompt="Add autumn colors to the scene", strength=0.6, width=512, height=512 ) response = api.image_to_image(schema) # Inpainting (edit specific areas) schema = Inpainting( model_id="flux", init_image="https://example.com/image.jpg", mask_image="https://example.com/mask.png", # White = edit, Black = keep prompt="A red sports car", width=512, height=512 ) response = api.inpainting(schema) # ControlNet (guided generation) schema = ControlNet( model_id="flux", controlnet_model="canny", # canny, depth, pose, etc. controlnet_image="https://example.com/control-image.jpg", prompt="A beautiful house, photorealistic", width=512, height=512 ) response = api.controlnet(schema) ``` *** ## Image Editing ### Background Removal ```python theme={"theme":{"light":"github-light","dark":"github-dark"}} from modelslab_py.core.client import Client from modelslab_py.core.apis.image_editing import Image_editing from modelslab_py.schemas.image_editing import BackgroundRemoverSchema client = Client(api_key="your_api_key") api = Image_editing(client=client, enterprise=False) schema = BackgroundRemoverSchema( image="https://example.com/photo.jpg" ) response = api.background_remover(schema) print(f"Image without background: {response['output'][0]}") ``` ### Super Resolution (Upscale) ```python theme={"theme":{"light":"github-light","dark":"github-dark"}} from modelslab_py.schemas.image_editing import SuperResolutionSchema schema = SuperResolutionSchema( image="https://example.com/low-res-image.jpg", scale=4 # 2x or 4x upscale ) response = api.super_resolution(schema) print(f"Upscaled image: {response['output'][0]}") ``` ### Object Removal ```python theme={"theme":{"light":"github-light","dark":"github-dark"}} from modelslab_py.schemas.image_editing import ObjectRemovalSchema schema = ObjectRemovalSchema( image="https://example.com/photo.jpg", mask_image="https://example.com/mask.png" # White areas will be removed ) response = api.object_remover(schema) print(response) ``` ### Outpainting (Extend Images) ```python theme={"theme":{"light":"github-light","dark":"github-dark"}} from modelslab_py.schemas.image_editing import OutpaintingSchema schema = OutpaintingSchema( image="https://example.com/photo.jpg", prompt="Continue the landscape with mountains and trees", width=1024, # New width (larger than original) height=768 # New height ) response = api.outpainting(schema) print(response) ``` ### AI Headshots ```python theme={"theme":{"light":"github-light","dark":"github-dark"}} from modelslab_py.schemas.image_editing import HeadshotSchema, FluxHeadshotSchema # Standard headshot schema = HeadshotSchema( image="https://example.com/selfie.jpg", prompt="Professional headshot, studio lighting, business attire" ) response = api.headshot(schema) # FLUX-powered headshot (higher quality) schema = FluxHeadshotSchema( image="https://example.com/selfie.jpg", prompt="Professional LinkedIn headshot, neutral background" ) response = api.flux_headshot(schema) ``` ### Face Generation ```python theme={"theme":{"light":"github-light","dark":"github-dark"}} from modelslab_py.schemas.image_editing import FacegenSchema schema = FacegenSchema( image="https://example.com/portrait.jpg", prompt="Make the person look 10 years younger" ) response = api.facegen(schema) print(response) ``` ### Fashion / Virtual Try-On ```python theme={"theme":{"light":"github-light","dark":"github-dark"}} from modelslab_py.schemas.image_editing import FashionSchema schema = FashionSchema( model_image="https://example.com/person.jpg", cloth_image="https://example.com/shirt.jpg" ) response = api.fashion(schema) print(response) ``` *** ## Video Generation ### Text to Video ```python theme={"theme":{"light":"github-light","dark":"github-dark"}} from modelslab_py.core.client import Client from modelslab_py.core.apis.video import Video from modelslab_py.schemas.video import Text2Video client = Client(api_key="your_api_key") api = Video(client=client, enterprise=False) schema = Text2Video( model_id="cogvideox", prompt="A spaceship flying through an asteroid field, cinematic, 4K", negative_prompt="low quality, blurry, static", width=512, height=512, num_frames=25, num_inference_steps=20, guidance_scale=7 ) response = api.text_to_video(schema) # Video generation is async - you'll get a request ID if response.get("status") == "processing": print(f"Video processing, request ID: {response['id']}") print(f"ETA: {response.get('eta')} seconds") ``` ### Image to Video Animate a static image: ```python theme={"theme":{"light":"github-light","dark":"github-dark"}} from modelslab_py.schemas.video import Image2Video schema = Image2Video( model_id="cogvideox", init_image="https://example.com/landscape.jpg", prompt="The clouds moving slowly, birds flying in the distance", num_frames=25, num_inference_steps=20 ) response = api.image_to_video(schema) print(response) ``` *** ## Audio Generation ### Text to Speech ```python theme={"theme":{"light":"github-light","dark":"github-dark"}} from modelslab_py.core.client import Client from modelslab_py.core.apis.audio import Audio from modelslab_py.schemas.audio import Text2Speech client = Client(api_key="your_api_key") api = Audio(client=client, enterprise=False) schema = Text2Speech( text="Hello, welcome to ModelsLab! This is a sample audio generation.", voice_id="alloy", # Choose from available voices language="en" ) response = api.text_to_speech(schema) print(f"Audio URL: {response['output'][0]}") ``` ### Voice Cloning (Voice to Voice) ```python theme={"theme":{"light":"github-light","dark":"github-dark"}} from modelslab_py.schemas.audio import Voice2Voice schema = Voice2Voice( init_audio="https://example.com/source-voice.mp3", target_audio="https://example.com/target-voice.mp3" # Voice to clone ) response = api.voice2voice(schema) print(response) ``` ### Music Generation ```python theme={"theme":{"light":"github-light","dark":"github-dark"}} from modelslab_py.schemas.audio import MusicGenSchema schema = MusicGenSchema( prompt="Upbeat electronic dance music with heavy bass drops", duration=30 # Duration in seconds ) response = api.music_gen(schema) print(response) ``` ### Song Generation ```python theme={"theme":{"light":"github-light","dark":"github-dark"}} from modelslab_py.schemas.audio import SongGenerator schema = SongGenerator( prompt="A pop song about summer love", lyrics="optional custom lyrics here" ) response = api.song_generator(schema) print(response) ``` ### Lyrics Generation ```python theme={"theme":{"light":"github-light","dark":"github-dark"}} from modelslab_py.schemas.audio import LyricsGenerator schema = LyricsGenerator( prompt="Write lyrics for a country song about road trips" ) response = api.lyrics_gen(schema) print(response) ``` ### Sound Effects (SFX) ```python theme={"theme":{"light":"github-light","dark":"github-dark"}} from modelslab_py.schemas.audio import SFX schema = SFX( prompt="Thunder rolling in the distance, heavy rain", duration=10 ) response = api.sfx_gen(schema) print(response) ``` ### Speech to Text ```python theme={"theme":{"light":"github-light","dark":"github-dark"}} from modelslab_py.schemas.audio import Speech2Text schema = Speech2Text( audio="https://example.com/speech.mp3", language="en" ) response = api.speech_to_text(schema) print(f"Transcription: {response['text']}") ``` *** ## Interior Design ### Interior Redesign ```python theme={"theme":{"light":"github-light","dark":"github-dark"}} from modelslab_py.core.client import Client from modelslab_py.core.apis.interior import Interior from modelslab_py.schemas.interior import InteriorSchema client = Client(api_key="your_api_key") api = Interior(client=client, enterprise=False) schema = InteriorSchema( init_image="https://example.com/room-photo.jpg", prompt="Modern minimalist living room with Scandinavian furniture" ) response = api.interior(schema) print(response) ``` ### Room Decorator ```python theme={"theme":{"light":"github-light","dark":"github-dark"}} from modelslab_py.schemas.interior import RoomDecoratorSchema schema = RoomDecoratorSchema( init_image="https://example.com/empty-room.jpg", prompt="Cozy bedroom with warm lighting and plants" ) response = api.room_decorator(schema) print(response) ``` ### Exterior Restoration ```python theme={"theme":{"light":"github-light","dark":"github-dark"}} from modelslab_py.schemas.interior import ExteriorSchema schema = ExteriorSchema( init_image="https://example.com/house-exterior.jpg", prompt="Modern exterior with landscaping and new paint" ) response = api.exterior_restorer(schema) print(response) ``` ### Floor Planning ```python theme={"theme":{"light":"github-light","dark":"github-dark"}} from modelslab_py.schemas.interior import FloorSchema schema = FloorSchema( init_image="https://example.com/floor-plan.jpg", prompt="Open concept kitchen and living area" ) response = api.floor(schema) print(response) ``` *** ## 3D Model Generation ### Text to 3D ```python theme={"theme":{"light":"github-light","dark":"github-dark"}} from modelslab_py.core.client import Client from modelslab_py.core.apis.three_d import Three_D from modelslab_py.schemas.threed import Text23D, Image23D client = Client(api_key="your_api_key") api = Three_D(client=client, enterprise=False) schema = Text23D( prompt="A medieval sword with ornate handle", num_inference_steps=50 ) response = api.text_to_3d(schema) print(response) ``` ### Image to 3D ```python theme={"theme":{"light":"github-light","dark":"github-dark"}} schema = Image23D( image="https://example.com/product-photo.jpg" ) response = api.image_to_3d(schema) print(response) ``` *** ## Working with Base64 Images For local images, convert them to base64: ```python theme={"theme":{"light":"github-light","dark":"github-dark"}} from modelslab_py.core.client import Client from modelslab_py.core.apis.image_editing import Image_editing from modelslab_py.schemas.image_editing import BackgroundRemoverSchema from modelslab_py.utils.image_utils import read_image_from_file, image_to_base64 client = Client(api_key="your_api_key") api = Image_editing(client=client, enterprise=False) # Read local image and convert to base64 image_pil = read_image_from_file("local-image.png") image_base64 = image_to_base64(image_pil) schema = BackgroundRemoverSchema( image=image_base64, base64=True # Important: set this to True for base64 images ) response = api.background_remover(schema) print(response) ``` *** ## Error Handling Always handle potential errors in production code: ```python theme={"theme":{"light":"github-light","dark":"github-dark"}} from modelslab_py.core.client import Client from modelslab_py.core.apis.realtime import Realtime from modelslab_py.schemas.realtime import RealtimeText2ImageSchema def generate_image(prompt: str, api_key: str) -> str: """Generate an image and return the URL.""" try: client = Client(api_key=api_key) api = Realtime(client=client, enterprise=False) schema = RealtimeText2ImageSchema( prompt=prompt, width=512, height=512, samples=1, num_inference_steps=30 ) response = api.text_to_image(schema) if response.get("status") == "success": return response["output"][0] elif response.get("status") == "processing": # Handle async processing return f"Processing... Request ID: {response['id']}" else: raise Exception(f"API Error: {response.get('message', 'Unknown error')}") except Exception as e: print(f"Error generating image: {e}") raise # Usage try: image_url = generate_image("A sunset over mountains", "your_api_key") print(f"Generated: {image_url}") except Exception as e: print(f"Failed: {e}") ``` *** ## Async Processing Pattern For long-running operations (videos, training), poll for results: ```python theme={"theme":{"light":"github-light","dark":"github-dark"}} import time from modelslab_py.core.client import Client from modelslab_py.core.apis.video import Video from modelslab_py.schemas.video import Text2Video def generate_video_with_polling(prompt: str, api_key: str, timeout: int = 300): """Generate a video and wait for completion.""" client = Client(api_key=api_key) api = Video(client=client, enterprise=False) schema = Text2Video( model_id="cogvideox", prompt=prompt, width=512, height=512, num_frames=25 ) response = api.text_to_video(schema) if response.get("status") == "success": return response["output"][0] if response.get("status") != "processing": raise Exception(f"Error: {response.get('message')}") request_id = response["id"] start_time = time.time() while time.time() - start_time < timeout: # Use the fetch endpoint (implement based on your needs) # This is a simplified example time.sleep(5) # Check status... # If complete, return URL # If failed, raise exception raise Exception("Timeout waiting for video generation") ``` *** ## Next Steps Explore all API endpoints Browse available models Set up async notifications Handle errors properly # TypeScript SDK Source: https://docs.modelslab.com/sdk/typescript Official TypeScript/JavaScript client for the ModelsLab API - generate images, videos, audio, and more. ## Overview The ModelsLab TypeScript SDK provides a type-safe interface to interact with all ModelsLab APIs. It works with both Node.js and browser environments. View on npm Source code and issues ## Installation ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} npm install modelslab ``` Or with yarn: ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} yarn add modelslab ``` ## Quick Start Generate your first AI image in just a few lines: ```javascript theme={"theme":{"light":"github-light","dark":"github-dark"}} import { Client, Community } from "modelslab"; const client = new Client("your-api-key"); const community = new Community(client.key); const result = await community.textToImage({ key: client.key, prompt: "A beautiful sunset over mountains, photorealistic, 8k", model_id: "flux", width: 512, height: 512, samples: 1, num_inference_steps: 30, guidance_scale: 7.5 }); if (result.status === "success") { console.log("Generated image:", result.output[0]); } else if (result.status === "processing") { console.log("Processing, request ID:", result.id); } ``` ## Client Configuration ### Basic Setup ```javascript theme={"theme":{"light":"github-light","dark":"github-dark"}} import { Client } from "modelslab"; // Method 1: Direct API key const client = new Client("your-api-key"); // Method 2: Environment variable // Reads from process.env.API_KEY when called without args const clientFromEnv = new Client(); // Method 3: With custom settings // new Client(apiKey, retries, timeoutSeconds) const clientCustom = new Client("your-api-key", 5, 10); ``` ### Client Properties ```javascript theme={"theme":{"light":"github-light","dark":"github-dark"}} console.log(client.baseUrl); // API base URL console.log(client.fetchRetry); // Number of retries console.log(client.fetchTimeout); // Timeout in seconds ``` ## Available APIs ```javascript theme={"theme":{"light":"github-light","dark":"github-dark"}} import { Community, Audio, Video, ImageEditing } from "modelslab"; // Create instances with your API key const community = new Community(client.key); const audio = new Audio(client.key); const video = new Video(client.key); const imageEditing = new ImageEditing(client.key); ``` ### Enterprise Mode For enterprise/dedicated endpoints: ```javascript theme={"theme":{"light":"github-light","dark":"github-dark"}} // Pass true as second argument for enterprise mode const enterpriseCommunity = new Community(client.key, true); // Uses endpoints like: https://modelslab.com/api/v1/enterprise/images/ ``` *** ## Image Generation (Community API) ### Text to Image ```javascript theme={"theme":{"light":"github-light","dark":"github-dark"}} import { Client, Community } from "modelslab"; const client = new Client("your-api-key"); const community = new Community(client.key); const result = await community.textToImage({ key: client.key, prompt: "A cyberpunk city at night, neon lights, rain, cinematic", negative_prompt: "blurry, low quality, distorted", model_id: "flux", width: 1024, height: 1024, samples: 1, num_inference_steps: 30, guidance_scale: 7.5, seed: 12345 // Optional: for reproducible results }); console.log("Generated image:", result.output[0]); ``` ### Image to Image Transform existing images with a text prompt: ```javascript theme={"theme":{"light":"github-light","dark":"github-dark"}} const result = await community.imageToImage({ key: client.key, prompt: "Transform into a watercolor painting style", negative_prompt: "photo, realistic", init_image: "https://example.com/your-image.jpg", model_id: "flux", strength: 0.7, // How much to change (0-1) width: 512, height: 512, num_inference_steps: 30, guidance_scale: 7.5 }); console.log("Transformed image:", result.output[0]); ``` ### Inpainting Edit specific areas of an image: ```javascript theme={"theme":{"light":"github-light","dark":"github-dark"}} const result = await community.inpainting({ key: client.key, prompt: "A red sports car", init_image: "https://example.com/image.jpg", mask_image: "https://example.com/mask.png", // White = edit, Black = keep model_id: "flux", width: 512, height: 512, num_inference_steps: 30, guidance_scale: 7.5 }); console.log("Inpainted image:", result.output[0]); ``` ### ControlNet Guided generation with reference images: ```javascript theme={"theme":{"light":"github-light","dark":"github-dark"}} const result = await community.controlnet({ key: client.key, prompt: "A beautiful house, photorealistic, sunny day", controlnet_model: "canny", // canny, depth, pose, etc. controlnet_image: "https://example.com/edges.jpg", controlnet_conditioning_scale: 1.0, model_id: "flux", width: 512, height: 512, num_inference_steps: 30, guidance_scale: 7.5 }); console.log("ControlNet result:", result.output[0]); ``` *** ## Audio API ### Text to Audio Generate audio from text descriptions: ```javascript theme={"theme":{"light":"github-light","dark":"github-dark"}} import { Client, Audio } from "modelslab"; const client = new Client("your-api-key"); const audio = new Audio(client.key); const result = await audio.textToAudio({ key: client.key, prompt: "A calm piano melody with soft strings in the background", duration: 30 // Duration in seconds }); console.log("Audio URL:", result.output[0]); ``` ### Text to Speech Convert text to natural speech: ```javascript theme={"theme":{"light":"github-light","dark":"github-dark"}} const result = await audio.textToSpeech({ key: client.key, text: "Hello! Welcome to ModelsLab. This is a sample of our text-to-speech API.", voice_id: "alloy", // Choose from available voices language: "en" }); console.log("Speech URL:", result.output[0]); ``` ### Voice to Voice (Voice Cloning) Clone a voice from a reference audio: ```javascript theme={"theme":{"light":"github-light","dark":"github-dark"}} const result = await audio.voice2voice({ key: client.key, init_audio: "https://example.com/source-speech.mp3", target_audio: "https://example.com/voice-to-clone.mp3" }); console.log("Cloned voice URL:", result.output[0]); ``` ### Voice Cover Create AI covers with different voices: ```javascript theme={"theme":{"light":"github-light","dark":"github-dark"}} const result = await audio.voiceCover({ key: client.key, init_audio: "https://example.com/song.mp3", voice_id: "celebrity-voice-id" }); console.log("Voice cover URL:", result.output[0]); ``` ### Music Generation Generate music from text prompts: ```javascript theme={"theme":{"light":"github-light","dark":"github-dark"}} const result = await audio.musicGen({ key: client.key, prompt: "Upbeat electronic dance music with heavy bass drops and synth melodies", duration: 30 }); console.log("Generated music:", result.output[0]); ``` ### Lyrics Generation Generate song lyrics: ```javascript theme={"theme":{"light":"github-light","dark":"github-dark"}} const result = await audio.lyricsGen({ key: client.key, prompt: "Write lyrics for a pop song about summer love and road trips" }); console.log("Generated lyrics:", result.output); ``` ### Song Generation Generate complete songs with vocals: ```javascript theme={"theme":{"light":"github-light","dark":"github-dark"}} const result = await audio.songGenerator({ key: client.key, prompt: "A country ballad about hometown memories", lyrics: "Optional: your custom lyrics here" }); console.log("Generated song:", result.output[0]); ``` ### Speech to Text Transcribe audio to text: ```javascript theme={"theme":{"light":"github-light","dark":"github-dark"}} const result = await audio.speechToText({ key: client.key, audio: "https://example.com/speech.mp3", language: "en" }); console.log("Transcription:", result.text); ``` ### Sound Effects (SFX) Generate sound effects: ```javascript theme={"theme":{"light":"github-light","dark":"github-dark"}} const result = await audio.sfxGen({ key: client.key, prompt: "Thunder rolling in the distance with heavy rain on a metal roof", duration: 10 }); console.log("Sound effect URL:", result.output[0]); ``` *** ## Video API ### Text to Video Generate videos from text descriptions: ```javascript theme={"theme":{"light":"github-light","dark":"github-dark"}} import { Client, Video } from "modelslab"; const client = new Client("your-api-key"); const video = new Video(client.key); const result = await video.textToVideo({ key: client.key, model_id: "cogvideox", prompt: "A spaceship flying through an asteroid field, cinematic, 4K", negative_prompt: "low quality, blurry, static", width: 512, height: 512, num_frames: 25, num_inference_steps: 20, guidance_scale: 7 }); // Video generation is async if (result.status === "processing") { console.log("Processing, request ID:", result.id); console.log("ETA:", result.eta, "seconds"); } else if (result.status === "success") { console.log("Video URL:", result.output[0]); } ``` ### Image to Video Animate a static image: ```javascript theme={"theme":{"light":"github-light","dark":"github-dark"}} const result = await video.imageToVideo({ key: client.key, model_id: "cogvideox", init_image: "https://example.com/landscape.jpg", prompt: "Clouds moving slowly, birds flying in the distance", num_frames: 25, num_inference_steps: 20, guidance_scale: 7 }); console.log("Result:", result); ``` *** ## Image Editing API ### Background Removal ```javascript theme={"theme":{"light":"github-light","dark":"github-dark"}} import { Client, ImageEditing } from "modelslab"; const client = new Client("your-api-key"); const imageEditing = new ImageEditing(client.key); const result = await imageEditing.backgroundRemover({ key: client.key, image: "https://example.com/photo.jpg" }); console.log("Image without background:", result.output[0]); ``` ### Super Resolution (Upscale) ```javascript theme={"theme":{"light":"github-light","dark":"github-dark"}} const result = await imageEditing.superResolution({ key: client.key, image: "https://example.com/low-res-image.jpg", scale: 4 // 2x or 4x upscale }); console.log("Upscaled image:", result.output[0]); ``` ### Outpainting (Extend Images) ```javascript theme={"theme":{"light":"github-light","dark":"github-dark"}} const result = await imageEditing.outpainting({ key: client.key, image: "https://example.com/photo.jpg", prompt: "Continue the landscape with mountains and trees", width: 1024, // New width (larger than original) height: 768 // New height }); console.log("Extended image:", result.output[0]); ``` ### Object Removal ```javascript theme={"theme":{"light":"github-light","dark":"github-dark"}} const result = await imageEditing.objectRemover({ key: client.key, image: "https://example.com/photo.jpg", mask_image: "https://example.com/mask.png" // White areas will be removed }); console.log("Object removed:", result.output[0]); ``` ### Fashion / Virtual Try-On ```javascript theme={"theme":{"light":"github-light","dark":"github-dark"}} const result = await imageEditing.fashion({ key: client.key, model_image: "https://example.com/person.jpg", cloth_image: "https://example.com/shirt.jpg" }); console.log("Virtual try-on result:", result.output[0]); ``` ### Face Generation ```javascript theme={"theme":{"light":"github-light","dark":"github-dark"}} const result = await imageEditing.facegen({ key: client.key, image: "https://example.com/portrait.jpg", prompt: "Make the person look 10 years younger" }); console.log("Face generation result:", result.output[0]); ``` ### Inpainting ```javascript theme={"theme":{"light":"github-light","dark":"github-dark"}} const result = await imageEditing.inpainting({ key: client.key, image: "https://example.com/photo.jpg", mask_image: "https://example.com/mask.png", prompt: "A beautiful garden with flowers" }); console.log("Inpainting result:", result.output[0]); ``` ### AI Headshots ```javascript theme={"theme":{"light":"github-light","dark":"github-dark"}} // Standard headshot const result = await imageEditing.headshot({ key: client.key, image: "https://example.com/selfie.jpg", prompt: "Professional headshot, studio lighting, business attire" }); console.log("Headshot:", result.output[0]); // FLUX-powered headshot (higher quality) const fluxResult = await imageEditing.fluxHeadshot({ key: client.key, image: "https://example.com/selfie.jpg", prompt: "Professional LinkedIn headshot, neutral background" }); console.log("FLUX Headshot:", fluxResult.output[0]); ``` *** ## Error Handling Always handle potential errors in production: ```javascript theme={"theme":{"light":"github-light","dark":"github-dark"}} import { Client, Community } from "modelslab"; async function generateImage(prompt, apiKey) { try { const client = new Client(apiKey); const community = new Community(client.key); const result = await community.textToImage({ key: client.key, prompt: prompt, model_id: "flux", width: 512, height: 512, samples: 1 }); if (result.status === "success") { return result.output[0]; } else if (result.status === "processing") { return { requestId: result.id, eta: result.eta }; } else { throw new Error(result.message || "Unknown error"); } } catch (error) { console.error("Error generating image:", error.message); throw error; } } // Usage try { const imageUrl = await generateImage("A sunset over mountains", "your-api-key"); console.log("Generated:", imageUrl); } catch (error) { console.error("Failed:", error.message); } ``` *** ## Async Processing Pattern For long-running operations, poll for results: ```javascript theme={"theme":{"light":"github-light","dark":"github-dark"}} async function generateVideoWithPolling(prompt, apiKey, timeout = 300000) { const client = new Client(apiKey); const video = new Video(client.key); const result = await video.textToVideo({ key: client.key, model_id: "cogvideox", prompt: prompt, width: 512, height: 512, num_frames: 25 }); if (result.status === "success") { return result.output[0]; } if (result.status !== "processing") { throw new Error(result.message || "Generation failed"); } const requestId = result.id; const startTime = Date.now(); while (Date.now() - startTime < timeout) { // Poll the fetch endpoint await new Promise(resolve => setTimeout(resolve, 5000)); // Check status using fetch endpoint // If complete, return URL // If failed, throw error } throw new Error("Timeout waiting for video generation"); } ``` *** ## Next Steps Explore all API endpoints Browse available models Set up async notifications Handle errors properly # Base64 to URL Source: https://docs.modelslab.com/video-api/base64-to-url POST /video/base64_to_url Upload a video in base64 format and retrieve it as a URL. ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v6/video/base64_to_url' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key":"your_api_key", "init_obj":"data:video/mp4;base64," } ``` # Fetch Video Source: https://docs.modelslab.com/video-api/fetch-video POST /video/fetch/{id} Retrieve queued videos using the Fetch Queued Video API. ## Request Send a `POST` request to below endpoint to return the corresponding queued videos. Where `{id}` is the ID returned together with the URL in the response upon its generation. This endpoint does not generate new video, it returns already generated/queued videos. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v6/video/fetch/{id}' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key" } ``` # Image to Video Ultra Source: https://docs.modelslab.com/video-api/image-to-video-ultra POST /video/img2video_ultra Generate high-definition videos from images using the Image to Video Ultra API. Supported model_id are `wan2.2` and `ltx-2.3`. Any other models passed will be ignored and defauted to `wan2.2` ![Image to Video Ultra Example](https://assets.modelslab.ai/generations/bca7a1e0-bf10-4d15-8437-1c4c78060f29.png) ## Request Make a `POST` request to below endpoint and pass the required parameters in the request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v6/video/img2video_ultra' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key":"your_api_key", "init_image":"https://assets.modelslab.ai/generations/91c519f4-20fe-4834-ac47-fe5c39c44b34", "prompt":"moving character", "model_id": "wan2.2", "negative_prompt":"low quality", "resolution":480, "num_frames": 92, "num_inference_steps":8, "guidance_scale":1.0, "webhook": null, "track_id":null } ``` **Resolution Limits:** * **wan2.2**: Maximum resolution is **720p** # Image to Video Source: https://docs.modelslab.com/video-api/img-to-video POST /video/img2video Generate videos from images using the Image to Video API. Supported model_id are `wan2.2` and `ltx-2.3`. Any other models passed will be ignored and defauted to `wan2.2` ### Image to Video Generate videos from images. ![Image to Video Example](https://assets.modelslab.ai/generations/92f1f218-f354-48d7-96ec-afe262e76c93.png) ## Request Make a `POST` request to below endpoint and pass the required parameters in the request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v6/video/img2video' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key":"your_api_key", "init_image": "https://imagedelivery.net/PP4qZJxMlvGLHJQBm3ErNg/e2f9cb8e-cb87-4143-dd81-a9e77e3bb800/768", "model_id": "wan2.2", "height":512, "width":512, "num_frames":25, "num_inference_steps":20, "min_guidance_scale":1, "max_guidance_scale":3, "motion_bucket_id":20, "noise_aug_strength":0.02, "webhook":null, "track_id":null } ``` # Video Generation API Source: https://docs.modelslab.com/video-api/overview Generate and edit AI videos from text prompts and images. Supports text-to-video, image-to-video, and video-to-video via ModelsLab API. ### Endpoints Remove watermarks from videos using AI-powered processing Generate videos from text descriptions using the Text to Video API. Generate videos from images using the Image to Video API. Generate high-definition videos from text descriptions using the Text to Video Ultra API. Generate high-definition videos from images using the Image to Video Ultra API. Upload a video in base64 format and retrieve it as a URL. # Text to Video Source: https://docs.modelslab.com/video-api/text-to-video POST /video/text2video Generate videos from text descriptions using AI video generation models. Supported model_id are `wan2.2` and `ltx-2.3`. Any other models passed will be ignored and defauted to `wan2.2` ![Text to Video Example](https://assets.modelslab.ai/generations/9a4d8540-68e9-4e26-b5de-f887d2e38f2a.png) ## Request Make a `POST` request to the endpoint below with the required parameters. ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} POST https://modelslab.com/api/v6/video/text2video ``` # Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key", "prompt": "A majestic space station orbiting Earth, with the sun rising behind it, cinematic, 4K", "negative_prompt": "low quality, blurry, static", "model_id": "wan2.2", "height": 512, "width": 512, "num_frames": 25, "num_inference_steps": 20, "guidance_scale": 7, "output_type": "mp4", "webhook": null, "track_id": null } ``` ## Async Pattern Since video generation takes time, use this pattern: ```python theme={"theme":{"light":"github-light","dark":"github-dark"}} import requests import time def generate_video(prompt, api_key): # 1. Submit the request response = requests.post( "https://modelslab.com/api/v6/video/text2video", json={ "key": api_key, "prompt": prompt, "num_frames": 25 } ) data = response.json() if data["status"] == "error": raise Exception(data["message"]) request_id = data["id"] # 2. Poll for results while True: fetch = requests.post( f"https://modelslab.com/api/v6/video/fetch/{request_id}", json={"key": api_key} ) result = fetch.json() if result["status"] == "success": return result["output"][0] elif result["status"] == "failed": raise Exception(result.get("message", "Generation failed")) # Still processing, wait and retry time.sleep(5) # Usage video_url = generate_video("A sunset over the ocean", "your_api_key") print(f"Video ready: {video_url}") ``` ## Tips for Better Videos Unlike images, videos need motion descriptions: * ❌ "A cat" * ✅ "A cat walking across a sunny room, tail swaying" Video models work best with clear, focused prompts. Avoid overly complex scenes. Generate at 512x512 then use upscale parameters for higher resolution output. * **MP4**: Best for most uses, smaller file size * **GIF**: Good for short loops, works everywhere # Text to Video Ultra Source: https://docs.modelslab.com/video-api/text-to-video-ultra POST /video/text2video_ultra Generate high-definition videos from text descriptions using the Text to Video Ultra API. Supported model_id are `wan2.2` and `ltx-2.3`. Any other models passed will be ignored and defauted to `wan2.2` ### Text to Video Ultra Generate HD videos from text descriptions. ![Text to Video Ultra Example](https://assets.modelslab.ai/generations/cfb0211d-cc6f-4835-ab2a-41acc498bb8a.png) ## Request Make a `POST` request to below endpoint and pass the required parameters in the request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v6/video/text2video_ultra' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key":"your_api_key", "prompt":"Space Station in space", "negative_prompt":"low quality", "model_id": "wan2.2", "resolution":480, "num_frames":92, "num_inference_steps":8, "guidance_scale": 1.0, "shift_sample":3, "fps":18, "webhook": null, "track_id":null } ``` # Watermark Remover Source: https://docs.modelslab.com/video-api/watermark-remover POST /video/watermark_remover This endpoint helps to remove watermarks from videos. ![Watermark Remover](https://assets.modelslab.ai/generations/42a8971d-ed6b-4fab-8cab-1fe294e0ce62.webp) ## Request Make a `POST` request to below endpoint and pass the required parameters in the request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v6/video/watermark_remover' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key", "init_video": "https://assets.modelslab.ai/generations/ee2c3b2c-7d68-4e71-900a-8566b0b05fe9.mp4", "webhook": null, "track_id": null } ``` # Base64 to URL Source: https://docs.modelslab.com/voice-cloning/base64-to-url POST /voice/base64_to_url The Base64 to URL endpoint allows you to upload audio in base64 format and retrieve it as a URL. ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v6/voice/base64_to_url' \ ``` ### Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key":"your_api_key", "init_audio":"data:audio/wav;base64," } ``` # Create Dubbing Source: https://docs.modelslab.com/voice-cloning/create-dubbing POST /voice/create_dubbing The endpoint enables automatic dubbing of videos from one language to another ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v6/voice/create_dubbing' \ ``` You can find all voice\_id [here](https://modelslab.com/trained-voice-lists). ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key", "init_video": "https://assets.modelslab.ai/generations/61cf206f-8bbe-498d-9514-a521c2833547.mp4", "source_lang": "hi", "output_lang": "en-us", "voice_id":"henry", "speed": 1.0, "file_prefix": "spanish_dub", "base64": false, "webhook": null, "track_id": null } ``` # Fetch Queued Voice Source: https://docs.modelslab.com/voice-cloning/fetch-voice POST /voice/fetch/{id} Fetches the output of a queued voice generation request by its ID. ## Request Make a `POST` request to the endpoint below and pass the required parameters in the request body. Replace `{id}` in the URL with the actual ID returned from the initial voice generation request. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v6/voice/fetch/{id}' \ ``` ### Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key" } ``` # Lyrics Generator Source: https://docs.modelslab.com/voice-cloning/lyrics-generator POST /voice/lyrics_generator Generate song lyrics from a text prompt. ## Overview Generate structured song lyrics from a simple text prompt. Great for quickly scaffolding lyrics before feeding them into the [Song Generator](/voice-cloning/song-generator). Describe the song topic, mood, or theme : e.g. `"tokyo"` or `"a rainy night in Mumbai"`. Set `length` to `"short"` for a quick verse or `"long"` for full multi-section lyrics. The API returns structured lyrics ready to use in your song generation workflow. Lyrics are generated in **English** only. *** ## Request ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v6/voice/lyrics_generator' \ ``` *** ## Body Parameters Your API key. Topic or theme for the lyrics. E.g. `"tokyo"`, `"heartbreak"`, `"summer road trip"`. Length of the generated lyrics. `"short"` for a single verse, `"long"` for full multi-section lyrics. URL to receive a POST callback when generation completes. Custom ID sent with the webhook payload for request correlation. *** ## Example Request ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key", "prompt": "tokyo", "length": "short", "webhook": null, "track_id": null } ``` # MusicGen Source: https://docs.modelslab.com/voice-cloning/music-gen POST /voice/music_gen Generate music based on textual prompts and optional conditioning melodies. ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v6/voice/music_gen' ``` ## Body Without `init_audio`: ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key":"your_api_key", "prompt":"marimba, percussion, bass, tropical house, melodic riff, G# minor, 96 bpm", "duration": 30, "output_format": "wav", "bitrate": "320k", "base64":false, "temp": false, "webhook": null, "track_id": null } ``` With `init_audio`: ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key":"your_api_key", "prompt":"marimba, percussion, bass, tropical house, melodic riff, G# minor, 96 bpm", "init_audio":"https://youtu.be/7Nm6uTHbB-Y?si=ORk1LOQ8J34Z0Lpm", "duration": 30, "output_format": "wav", "bitrate": "320k", "base64":false, "temp": false, "webhook": null, "track_id": null } ``` # Voice & Audio API Source: https://docs.modelslab.com/voice-cloning/overview Text-to-speech, voice cloning, speech-to-text, sound effects, music generation, song creation, and vocal isolation via ModelsLab's Audio API. ### Endpoints NEW Create complete songs with vocals in 50+ languages using ACE-Step v1.5 Generate creative song lyrics using AI-powered text generation Transform text content into high-quality speech using advanced TTS technology Clone and replicate voices from target audio files with precision Convert audio recordings into accurate written transcriptions Extract and isolate vocal tracks from music and audio files Extract and isolate vocal tracks from music and audio files Create professional dubbing for videos with synchronized voice replacement Generate cover versions of songs using AI voice synthesis technology Create custom sound effects and audio elements for multimedia projects Generate original music compositions based on textual prompts and styles Design and generate custom voices using text prompts and voice descriptions # Sound Effects (SFX) Source: https://docs.modelslab.com/voice-cloning/sfx POST /voice/sfx Generate lifelike Sound effects using text prompts. ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v6/voice/sfx' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key":"", "prompt":"Thunderstorm with rain", "duration": 10, "temp": false, "webhook": null, "track_id": null } ``` # Song Generator Source: https://docs.modelslab.com/voice-cloning/song-generator POST /voice/song_generator Generate full songs in 50+ languages by providing lyrics and a reference audio style using the ACE-Step v1.5 model. ## Overview The Song Generator API lets you create complete, production-quality songs by combining your lyrics with a reference audio file that defines the style, mood, and instrumentation. You can also skip writing lyrics entirely and let the model generate them automatically from a prompt. Provide your lyrics directly or enable auto-generation with a `prompt`. Supply a `caption` describing the musical style : genre, instruments, vocal type, and mood. Optionally attach a reference audio via `init_audio` to influence the style further. Set the `duration` between 30 and 480 seconds. The API returns a hosted audio URL once generation is complete, or fires a webhook to your endpoint if provided. *** ## Request Make a `POST` request to the endpoint below and pass the required parameters as a JSON body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v6/voice/song_generator' \ ``` *** ## Body Parameters Your API key. Set to `true` to auto-generate lyrics from `prompt`. When `false`, provide `lyrics` directly. Song lyrics with section tags like `[Verse 1]`, `[Chorus]`, `[Bridge]`. Required if `lyrics_generation` is `false`. Topic or description for auto lyrics generation. Required if `lyrics_generation` is `true`. Musical style descriptor : genre, instruments, vocal type, tempo, mood. E.g. `"female vocal, pop, piano, slow, emotional"`. URL to a reference audio file (MP3/WAV) to influence the song's style. Song length in seconds. Range: **30–480** (0.5–8 minutes). Language code for lyrics and vocals. Defaults to auto-detection. See table below. Set to `true` to generate a vocals-free instrumental track. URL to receive a POST callback when generation completes. Custom ID sent with the webhook payload for request correlation. *** ## Example Requests * Song duration must be between **30 and 480 seconds** (0.5–8 minutes) * If you don't have lyrics, set `lyrics_generation: true` and provide a `prompt` and `caption` instead * Set `instrumental: true` to generate a vocals-free track * 50+ languages are supported : see the table below With manual lyrics (`lyrics_generation: false`) ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key", "lyrics_generation": false, "lyrics": "[Verse 1]\nYour eyes hypnotize me, make me sigh\nYour lips call to me, I can't escape\n\n[Chorus]\nTonight I'll give you everything\nIn your arms I'll stay", "caption": "female vocal, reggaeton, deep bass, drum machine, reverb", "duration": 120, "webhook": null, "track_id": null } ``` With auto lyrics generation (`lyrics_generation: true`) ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key", "lyrics_generation": true, "prompt": "A Cantopop track with layered female vocals and synth keys", "caption": "female vocal, Cantopop, synth keys, mid-tempo, ethereal", "duration": 180, "webhook": null, "track_id": null } ``` *** ## Supported Languages | Language | Code | | -------------- | ---- | | Arabic | ar | | Azerbaijani | az | | Bulgarian | bg | | Bengali | bn | | Catalan | ca | | Czech | cs | | Danish | da | | German | de | | Greek | el | | English | en | | Spanish | es | | Persian | fa | | Finnish | fi | | French | fr | | Hebrew | he | | Hindi | hi | | Croatian | hr | | Haitian Creole | ht | | Hungarian | hu | | Indonesian | id | | Icelandic | is | | Italian | it | | Japanese | ja | | Korean | ko | | Latin | la | | Lithuanian | lt | | Malay | ms | | Nepali | ne | | Dutch | nl | | Norwegian | no | | Punjabi | pa | | Polish | pl | | Portuguese | pt | | Romanian | ro | | Russian | ru | | Sanskrit | sa | | Slovak | sk | | Serbian | sr | | Swedish | sv | | Swahili | sw | | Tamil | ta | | Telugu | te | | Thai | th | | Tagalog | tl | | Turkish | tr | | Ukrainian | uk | | Urdu | ur | | Vietnamese | vi | | Cantonese | yue | | Chinese | zh | # Speech To Text Source: https://docs.modelslab.com/voice-cloning/speech-to-text POST /voice/speech_to_text Speech-to-Text allow to convert audio into written transcription in multiple languages. ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v6/voice/speech_to_text' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key", "init_audio": "https://assets.modelslab.ai/generations/9ab0c784-65ec-41b3-a646-99dfe16b053b.mp3", "language": "en", "timestamp_level": null, "webhook": null, "track_id": null } ``` **Timestamp Level Accuracy:** Sentence-level timestamps work well and provide reliable results. However, word-level timestamps may not be accurate and may provide less reliable results. ### Languages Supported Whisper supports several languages, but performance may vary due to factors like limited training data, script complexity, and regional dialects, potentially affecting transcription accuracy. ``` "Afrikaans": "af", "Arabic": "ar", "Belarusian": "be", "Bengali": "bn", "Bulgarian": "bg", "Chinese": "zh", "Czech": "cs", "Danish": "da", "Dutch": "nl", "English": "en", "Finnish": "fi", "French": "fr", "German": "de", "Greek": "el", "Hebrew": "he", "Hindi": "hi", "Hungarian": "hu", "Indonesian": "id", "Italian": "it", "Japanese": "ja", "Kannada": "kn", "Korean": "ko", "Malayalam": "ml", "Marathi": "mr", "Nepali": "ne", "Panjabi": "pa", "Persian": "fa", "Polish": "pl", "Portuguese": "pt", "Romanian": "ro", "Russian": "ru", "Serbian": "sr", "Spanish": "es", "Swedish": "sv", "Tagalog": "tl", "Tamil": "ta", "Telugu": "te", "Thai": "th", "Turkish": "tr", "Ukrainian": "uk", "Urdu": "ur", "Vietnamese": "vi", "Welsh": "cy" ``` # Text to Speech Source: https://docs.modelslab.com/voice-cloning/text-to-speech POST /voice/text_to_speech Generate Speech by providing a text input along with a pre trained voice. ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v6/voice/text_to_speech' \ ``` ## Emotion Support Emotion support is currently only available in English (`en`) language. When emotion is enabled, you can use special tags in your text prompt to add expressive elements to the generated speech. ### Available Emotion-Supported Voices #### Female Voices * Tara * Leah * Jess * Mia * Zoe #### Male Voices * Leo * Dan * Zac #### Supported Emotion Tags The following emotion tags can be added to speech prompts to enhance expressiveness: | Tag | Description | | ----------- | ---------------------------------------------------- | | `` | Adds a laughing effect | | `` | A soft chuckle for a subtle humorous tone | | `` | Expresses disappointment, relief, or tiredness | | `` | Simulates a short cough | | `` | Mimics a sniffle, indicating sadness or a cold | | `` | Adds a groaning effect for frustration or discomfort | | `` | Simulates yawning to express boredom or tiredness | | `` | Expresses shock or surprise | ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key", "prompt":"Build next-generation AI products without worrying about GPUs", "language":"american english", "voice_id":"madison", "speed":1, "emotion":false } ``` # Voice Upload Source: https://docs.modelslab.com/voice-cloning/upload-voice POST /voice/voice_upload Upload an audio file and retrieve a `voice_id` for use with the [Voice-cloning](/voice-cloning/voice-cloning) endpoint. ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v6/voice/voice_upload' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key":"", "name":"Jacob", "init_audio":"https://assets.modelslab.ai/generations/5c3eef10-0eb4-4db8-8b12-fc4eedbf30b9.mp3", "language":"english" } ``` # Vocal Isolator Source: https://docs.modelslab.com/voice-cloning/vocal-isolator POST /voice/vocal_isolator Separates the vocals from the background music of a video and audio file ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v6/voice/vocal_isolator' \ ``` ## Body Either `init_video` or `init_audio` is required. If both are provided, the `init_video` takes precedence. ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key", "init_video": "https://assets.modelslab.ai/generations/a85db55c-dca2-415c-97a5-51192916e61b.mp3", "seed":234322, "base64": false, "webhook": null, "track_id": null } ``` # Voice Cloning Source: https://docs.modelslab.com/voice-cloning/voice-cloning POST /voice/text_to_audio Generate audio from text by cloning a provided audio URL or a selected voice ID. ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body. `init_audio` is required for voice cloning. You can also pass `voice_id` to select a voice from the available voice list. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v6/voice/text_to_audio' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key", "prompt":"Narrative voices capable of pronouncing terminologies & acronyms in training and ai learning materials.", "init_audio":"https://assets.modelslab.ai/generations/5c3eef10-0eb4-4db8-8b12-fc4eedbf30b9.mp3", "voice_id": "your_voice_id", "language":"english", "webhook": null, "track_id": null } ``` # Song Cover Source: https://docs.modelslab.com/voice-cloning/voice-cover POST /voice/voice_cover Transform a song into a different voice using a provided model. Find all available voice models, [HERE](https://modelslab.com/voice-cover). ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v6/voice/voice_cover' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key", "init_audio": "https://www.youtube.com/watch?v=ixkoVwKQaJg", "model_id": "zoro", "pitch": "none", "rate": 0.5, "radius": 3, "mix": 0.25, "algorithm": "rmvpe", "hop_length": 128, "originality": 0.5, "lead_voice_volume_delta": "+1", "backup_voice_volume_delta": "-2", "instrument_volume_delta":"+2", "reverb_size": 0.15, "wetness": 0.2, "dryness": 0.8, "damping": 0.7, "base64": false, "temp": false, "webhook": null, "track_id" : null } ``` # Voice Design Source: https://docs.modelslab.com/voice-cloning/voice-design POST /voice/voice_design Design and generate custom voices using text prompts and voice descriptions. ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v6/voice/voice_design' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "your_api_key", "prompt": "Greetings, my friend. What brings you to Mount Olympus today? Here to gaze at my beautiful muscles again?", "voice_description": "The friendly mythical God, Zeus, with a huge deep powerful voice. Charming, proud, strong and theatrical.", "language": "english", "webhook": null, "track_id": null } ``` Both `prompt` and `voice_description` have a maximum limit of 1000 characters each. ## Supported Languages | Language | Value | | ---------- | ------------ | | Chinese | `chinese` | | English | `english` | | Japanese | `japanese` | | Korean | `korean` | | German | `german` | | French | `french` | | Russian | `russian` | | Portuguese | `portuguese` | | Spanish | `spanish` | | Italian | `italian` | # Get Uploaded Voices Source: https://docs.modelslab.com/voice-cloning/voice-list POST /voice/voice_list Allows you to get list of all uploaded voices. ## Request Send a `POST` request to below endpoint to return all uploaded voices. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v6/voice/voice_list' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key": "" } ``` # Voice changer Source: https://docs.modelslab.com/voice-cloning/voice-to-voice POST /voice/voice_to_voice Change voice from one to another. This endpoint will be deprecated and discontinued on July 31, 2026 (UTC). ## Request Make a `POST` request to below endpoint and pass the required parameters as a request body. ```curl curl theme={"theme":{"light":"github-light","dark":"github-dark"}} --request POST 'https://modelslab.com/api/v6/voice/voice_to_voice' \ ``` ## Body ```json json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "key":"", "init_audio":"https://assets.modelslab.ai/generations/a9823a38-6c67-43f7-80a3-11e7eea504c0", "target_audio":"https://assets.modelslab.ai/generations/a9823a38-6c67-43f7-80a3-11e7eea504c0", "temp":false, "base64":false, "webhook":null, "track_id":null } ``` # Webhooks Source: https://docs.modelslab.com/webhooks Configure webhooks to receive real-time notifications when ModelsLab API requests complete. Set up callback URLs for async image, video, and audio generation. ## Overview Webhooks allow you to receive real-time notifications when your API requests complete processing. Instead of polling the fetch endpoint repeatedly, ModelsLab will send the results directly to your server. **Best for**: Long-running operations like video generation, model training, and batch image processing where you don't want to keep polling for results. ## How Webhooks Work Add the `webhook` parameter to your API request with your endpoint URL. ModelsLab processes your request asynchronously. When complete, ModelsLab sends a POST request to your webhook URL with the results. ## Using Webhooks Add the `webhook` parameter to any API request that supports async processing: ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}} import requests response = requests.post( "https://modelslab.com/api/v6/video/text2video", json={ "key": "your_api_key", "model_id": "cogvideox", "prompt": "A spaceship flying through an asteroid field", "width": 512, "height": 512, "num_frames": 25, "webhook": "https://your-server.com/webhook/modelslab", "track_id": "video_001" # Optional: your own identifier } ) # You'll get an immediate response with the request ID data = response.json() print(f"Request ID: {data['id']}") # Results will be sent to your webhook URL when ready ``` ```javascript JavaScript theme={"theme":{"light":"github-light","dark":"github-dark"}} const response = await fetch("https://modelslab.com/api/v6/video/text2video", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ key: "your_api_key", model_id: "cogvideox", prompt: "A spaceship flying through an asteroid field", width: 512, height: 512, num_frames: 25, webhook: "https://your-server.com/webhook/modelslab", track_id: "video_001" }) }); const data = await response.json(); console.log(`Request ID: ${data.id}`); // Results will be sent to your webhook URL when ready ``` ```bash cURL theme={"theme":{"light":"github-light","dark":"github-dark"}} curl -X POST "https://modelslab.com/api/v6/video/text2video" \ -H "Content-Type: application/json" \ -d '{ "key": "your_api_key", "model_id": "cogvideox", "prompt": "A spaceship flying through an asteroid field", "width": 512, "height": 512, "num_frames": 25, "webhook": "https://your-server.com/webhook/modelslab", "track_id": "video_001" }' ``` ## Webhook Payload When your request completes, ModelsLab sends a POST request to your webhook URL with this payload: ### Success Payload ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "status": "success", "id": "abc123-def456", "output": [ "https://pub-3626123a908346a7a8be8d9295f44e26.r2.dev/generations/abc123.mp4" ], "generationTime": 45.2, "track_id": "video_001", "meta": { "prompt": "A spaceship flying through an asteroid field", "model_id": "cogvideox", "width": 512, "height": 512 } } ``` ### Failure Payload ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "status": "failed", "id": "abc123-def456", "message": "Processing failed: Invalid input dimensions", "track_id": "video_001" } ``` ### Workflow Webhook Payload For Workflows API, the payload structure includes additional workflow information: ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "event": "workflow.completed", "workflow": { "id": "wf_abc123", "name": "My Image Pipeline", "user_id": 12345 }, "execution": { "id": "exec_xyz789", "status": "completed", "started_at": "2026-01-02T10:30:00Z", "completed_at": "2026-01-02T10:30:45Z", "execution_time": 45.2, "input_data": { "prompt": "A beautiful sunset" }, "output_data": { "images": ["https://..."] } } } ``` ## Setting Up Your Webhook Endpoint Create an endpoint on your server to receive webhook notifications: ```python Python (Flask) theme={"theme":{"light":"github-light","dark":"github-dark"}} from flask import Flask, request, jsonify app = Flask(__name__) @app.route('/webhook/modelslab', methods=['POST']) def handle_webhook(): data = request.json if data.get('status') == 'success': # Process successful generation output_urls = data.get('output', []) track_id = data.get('track_id') print(f"Generation {track_id} completed!") print(f"Output URLs: {output_urls}") # Your logic here: save to database, notify user, etc. elif data.get('status') == 'failed': # Handle failure error_message = data.get('message') track_id = data.get('track_id') print(f"Generation {track_id} failed: {error_message}") return jsonify({'received': True}), 200 if __name__ == '__main__': app.run(port=5000) ``` ```javascript JavaScript (Express) theme={"theme":{"light":"github-light","dark":"github-dark"}} const express = require('express'); const app = express(); app.use(express.json()); app.post('/webhook/modelslab', (req, res) => { const data = req.body; if (data.status === 'success') { // Process successful generation const outputUrls = data.output || []; const trackId = data.track_id; console.log(`Generation ${trackId} completed!`); console.log(`Output URLs: ${outputUrls}`); // Your logic here: save to database, notify user, etc. } else if (data.status === 'failed') { // Handle failure const errorMessage = data.message; const trackId = data.track_id; console.log(`Generation ${trackId} failed: ${errorMessage}`); } res.json({ received: true }); }); app.listen(5000, () => { console.log('Webhook server running on port 5000'); }); ``` ```php PHP theme={"theme":{"light":"github-light","dark":"github-dark"}} true]); ?> ``` ## Webhook Requirements Your webhook URL must use HTTPS for security. Return a 2xx status code within 30 seconds to acknowledge receipt. Webhooks may be sent multiple times. Use `id` or `track_id` for idempotency. Your webhook endpoint must be publicly accessible. ## The `track_id` Parameter Use `track_id` to correlate webhook responses with your internal records: ```python theme={"theme":{"light":"github-light","dark":"github-dark"}} # When making the request response = requests.post(url, json={ "key": "your_api_key", "prompt": "A sunset", "webhook": "https://your-server.com/webhook", "track_id": "order_12345" # Your internal order ID }) # In your webhook handler def handle_webhook(data): track_id = data.get('track_id') # "order_12345" # Update your order with the generated content update_order(track_id, data['output']) ``` ## Retry Policy If your webhook endpoint is unreachable or returns a non-2xx status: * **Workflow webhooks**: Retried up to 3 times with exponential backoff * **Generation webhooks**: Best-effort delivery, use fetch endpoint as fallback Always implement the fetch endpoint as a fallback. If you don't receive a webhook within the expected time, poll the fetch endpoint. ## Testing Webhooks Locally Use a tunneling service to test webhooks during development: ### Using ngrok ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} # Install ngrok brew install ngrok # macOS # Start your local server python app.py # Running on port 5000 # In another terminal, start ngrok ngrok http 5000 # Use the ngrok URL as your webhook # https://abc123.ngrok.io/webhook/modelslab ``` ### Using localtunnel ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} # Install localtunnel npm install -g localtunnel # Start tunnel lt --port 5000 # Use the provided URL as your webhook ``` ## Best Practices Return a 200 or 202 status code immediately to acknowledge receipt. Do heavy processing asynchronously. Store the `id` or `track_id` and check before processing to handle duplicate deliveries. Log all incoming webhook payloads for debugging and audit purposes. For production systems, push webhook data to a queue (Redis, SQS, etc.) and process asynchronously. Monitor your webhook endpoint for failures and response times. ## Endpoints Supporting Webhooks The `webhook` parameter is supported by these API endpoints: | Category | Endpoints | | -------------------- | --------------------------------------------------------------- | | **Image Generation** | text2img, img2img, inpaint, controlnet | | **Video** | text2video, img2video, text2video\_ultra, img2video\_ultra | | **Audio** | text\_to\_speech, voice\_to\_voice, music\_gen, song\_generator | | **3D** | text\_to\_3d, image\_to\_3d | | **Image Editing** | All editing endpoints | | **Training** | fine\_tune, lora\_fine\_tune | | **Workflows** | run (workflow execution) | ## Troubleshooting 1. Verify your URL is publicly accessible (test with curl from outside your network) 2. Check your server logs for incoming requests 3. Ensure your endpoint returns 2xx within 30 seconds 4. Use the fetch endpoint to check if the request completed This is expected behavior for reliability. Implement idempotency using the request `id` or your `track_id`. If your processing takes too long: 1. Return 200 immediately 2. Process the webhook payload asynchronously 3. Use a message queue for heavy processing ## Next Steps Generate videos with webhook notifications Create complex pipelines with webhooks # Cancel Execution Source: https://docs.modelslab.com/workflows-api/cancel-execution POST https://modelslab.com/api/v1/workflows/{workflow_id}/runs/{execution_id}/cancel Cancels a running or pending workflow execution. ### Path Parameters The workflow UUID The execution ID ### Response ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "status": "success", "message": "Execution cancelled." } ``` ### Error Responses * `400 Bad Request` - Cannot cancel execution in current state (already completed/failed) * `404 Not Found` - Execution not found # Examples Source: https://docs.modelslab.com/workflows-api/examples Code examples for running workflows and handling results. ## Run Workflow and Poll for Results ### Python ```python theme={"theme":{"light":"github-light","dark":"github-dark"}} import requests import time API_KEY = "YOUR_API_KEY" WORKFLOW_ID = "YOUR_WORKFLOW_ID" BASE_URL = "https://modelslab.com/api/v1/workflows" headers = { "Content-Type": "application/json", "key": API_KEY } # Run the workflow response = requests.post( f"{BASE_URL}/{WORKFLOW_ID}/run", headers=headers, json={ "prompt": "A beautiful sunset over mountains", "width": 1024, "height": 1024 } ) result = response.json() execution_id = result["execution_id"] print(f"Execution started: {execution_id}") # Poll for results while True: status_response = requests.get( f"{BASE_URL}/{WORKFLOW_ID}/runs/{execution_id}", headers=headers ) status = status_response.json() if status["execution"]["status"] == "completed": print("Output:", status["output"]) break elif status["execution"]["status"] == "failed": print("Error:", status["error"]) break else: print(f"Status: {status['execution']['status']}") time.sleep(2) ``` ### JavaScript/Node.js ```javascript theme={"theme":{"light":"github-light","dark":"github-dark"}} const API_KEY = "YOUR_API_KEY"; const WORKFLOW_ID = "YOUR_WORKFLOW_ID"; const BASE_URL = "https://modelslab.com/api/v1/workflows"; async function runWorkflow() { // Run the workflow const runResponse = await fetch(`${BASE_URL}/${WORKFLOW_ID}/run`, { method: "POST", headers: { "Content-Type": "application/json", key: API_KEY, }, body: JSON.stringify({ prompt: "A beautiful sunset over mountains", width: 1024, height: 1024, }), }); const { execution_id } = await runResponse.json(); console.log(`Execution started: ${execution_id}`); // Poll for results while (true) { const statusResponse = await fetch( `${BASE_URL}/${WORKFLOW_ID}/runs/${execution_id}`, { headers: { key: API_KEY } } ); const status = await statusResponse.json(); if (status.execution.status === "completed") { console.log("Output:", status.output); break; } else if (status.execution.status === "failed") { console.log("Error:", status.error); break; } else { console.log(`Status: ${status.execution.status}`); await new Promise((resolve) => setTimeout(resolve, 2000)); } } } runWorkflow(); ``` ### cURL ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}} # Run a workflow curl -X POST "https://modelslab.com/api/v1/workflows/YOUR_WORKFLOW_ID/run" \ -H "Content-Type: application/json" \ -H "key: YOUR_API_KEY" \ -d '{ "prompt": "A beautiful sunset over mountains", "width": 1024, "height": 1024 }' # Check execution status curl "https://modelslab.com/api/v1/workflows/YOUR_WORKFLOW_ID/runs/12345" \ -H "key: YOUR_API_KEY" ``` # Get Execution Status Source: https://docs.modelslab.com/workflows-api/get-execution-status GET https://modelslab.com/api/v1/workflows/{workflow_id}/runs/{execution_id} Returns the status and results of a workflow execution. ### Path Parameters The workflow UUID The execution ID ### Response (Pending/Running) ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "status": "success", "execution": { "id": 12345, "workflow_id": "uuid-string", "status": "running", "started_at": "2024-01-15T10:30:00Z", "completed_at": null, "execution_time": null }, "steps": [ { "name": "Text to Image", "status": "completed", "started_at": "2024-01-15T10:30:00Z", "completed_at": "2024-01-15T10:30:05Z" }, { "name": "Image Upscaler", "status": "running", "started_at": "2024-01-15T10:30:05Z", "completed_at": null } ] } ``` ### Response (Completed) ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "status": "success", "execution": { "id": 12345, "workflow_id": "uuid-string", "status": "completed", "started_at": "2024-01-15T10:30:00Z", "completed_at": "2024-01-15T10:30:15Z", "execution_time": 15.234 }, "output": { "output": ["https://cdn.modelslab.com/generated/image1.png"], "proxy_links": ["https://cdn.modelslab.com/proxy/image1.png"], "status": "success" }, "steps": [ { "name": "Text to Image", "status": "completed", "started_at": "2024-01-15T10:30:00Z", "completed_at": "2024-01-15T10:30:05Z" }, { "name": "Image Upscaler", "status": "completed", "started_at": "2024-01-15T10:30:05Z", "completed_at": "2024-01-15T10:30:15Z" } ] } ``` ### Response (Failed) ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "status": "success", "execution": { "id": 12345, "workflow_id": "uuid-string", "status": "failed", "started_at": "2024-01-15T10:30:00Z", "completed_at": "2024-01-15T10:30:05Z", "execution_time": 5.123 }, "error": "Image generation failed: Invalid prompt", "steps": [ { "name": "Text to Image", "status": "failed", "started_at": "2024-01-15T10:30:00Z", "completed_at": "2024-01-15T10:30:05Z" } ] } ``` ### Execution Statuses | Status | Description | | --------- | ----------------------------------- | | pending | Execution is queued | | running | Execution is in progress | | completed | Execution finished successfully | | failed | Execution encountered an error | | cancelled | Execution was cancelled by the user | # Get Workflow Schema Source: https://docs.modelslab.com/workflows-api/get-workflow-schema GET https://modelslab.com/api/v1/workflows/{workflow_id} Returns the workflow details including its parameters and configuration. ### Path Parameters The workflow UUID ### Response ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "status": "success", "workflow": { "id": "uuid-string", "name": "Image Generator", "description": "Generates images using Stable Diffusion", "rate_limit": 10, "webhook_url": "https://your-webhook.com/callback" }, "parameters": [ { "key": "prompt", "type": "string", "required": true, "node_id": "node-1", "node_name": "Text to Image" }, { "key": "negative_prompt", "type": "string", "required": false, "node_id": "node-1", "node_name": "Text to Image" }, { "key": "width", "type": "number", "required": false, "node_id": "node-1", "node_name": "Text to Image" } ], "endpoints": { "run": "https://modelslab.com/api/v1/workflows/uuid-string/run", "status": "https://modelslab.com/api/v1/workflows/uuid-string/runs/{id}" } } ``` # List Workflows Source: https://docs.modelslab.com/workflows-api/list-workflows GET https://modelslab.com/api/v1/workflows Returns a list of your API-enabled workflows. ### Response ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "status": "success", "workflows": [ { "id": "uuid-string", "name": "My Workflow", "description": "Generates images with custom prompts", "rate_limit": 10, "call_count": 150, "last_called_at": "2024-01-15T10:30:00Z", "created_at": "2024-01-01T00:00:00Z", "updated_at": "2024-01-15T10:30:00Z" } ] } ``` # Workflows API Source: https://docs.modelslab.com/workflows-api/overview Build and run multi-step AI workflows. List available workflows, execute them with custom parameters, and monitor execution status. The Workflows API allows you to execute your custom workflows programmatically. Each workflow you create can be enabled as an API endpoint with its own unique parameters and responses. ## Base URL ``` https://modelslab.com/api/v1/workflows ``` ## Authentication All Workflows API requests require authentication using your ModelsLab API key. Include your API key in the request header: ``` key: YOUR_API_KEY ``` You can find your API key in your [dashboard settings](https://modelslab.com/dashboard/api-keys). ## Rate Limiting Each workflow has its own configurable rate limit (default: 10 requests per minute per user). When you exceed the rate limit, you'll receive a `429 Too Many Requests` response with a `retry_after` field indicating when you can retry. ## Webhooks If your workflow has a webhook URL configured, execution results will be automatically sent to that URL when the workflow completes or fails. **Webhook Payload:** ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "event": "workflow.completed", "execution_id": 12345, "workflow_id": "uuid-string", "status": "completed", "output": { "output": ["https://cdn.modelslab.com/generated/image1.png"] }, "completed_at": "2024-01-15T10:30:15Z" } ``` # Run Workflow Source: https://docs.modelslab.com/workflows-api/run-workflow POST https://modelslab.com/api/v1/workflows/{workflow_id}/run Executes a workflow with the provided parameters. Workflow execution is asynchronous - you'll receive an execution ID that you can use to poll for results. ### Path Parameters The workflow UUID ### Request Body The request body should contain the workflow parameters. Each workflow has different parameters based on its configuration. Use the [Get Workflow Schema](/workflows-api/get-workflow-schema) endpoint to discover available parameters. ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "prompt": "A beautiful sunset over mountains", "negative_prompt": "blurry, low quality", "width": 1024, "height": 1024 } ``` ### Response (202 Accepted) ```json theme={"theme":{"light":"github-light","dark":"github-dark"}} { "status": "success", "message": "Workflow execution started.", "execution_id": 12345, "workflow_id": "uuid-string", "status_url": "https://modelslab.com/api/v1/workflows/uuid-string/runs/12345", "webhook_url": "https://your-webhook.com/callback" } ``` ### Error Responses * `404 Not Found` - Workflow not found or API not enabled * `422 Unprocessable Entity` - Validation failed (missing required parameters) * `429 Too Many Requests` - Rate limit exceeded