How to Build a White-Label AI SaaS Using a Multi-Model API & Per-Tenant Key Scoping (2026 Guide)

Architect a white-label multimodal AI SaaS with per-tenant API keys, OpenAI-compatible routing, async webhook callbacks, error sanitization, and MCP integration.

L
LumozAI Team Explore Models
8 min read · Nov 25, 2026 · 3 views

Building a white-label AI SaaS product—whether an agency creative portal, an e-commerce visual studio, or a vertical B2B copilot—quickly hits an infrastructure wall. Teams often start by wrapping one LLM provider, then add separate accounts for image generation, upscaling, background removal, and speech synthesis. Soon your backend is juggling five SDKs, mismatched webhook schemas, and raw upstream errors that expose your vendors to paying customers.

This guide explains how to architect a white-label, multi-tenant AI SaaS backend on LumozAI's unified API. You will learn how to isolate tenant spend with scoped keys in the LumozAI panel, route across speed and quality tiers with SDXL Lightning, Flux 1.1 Pro, Photon, and Crisp Upscale, scrub vendor leaks, and expose tools over Lumoz MCP.

Why White-Label AI Wrappers Leak Upstream Vendors

A white-label AI product breaks trust the moment an end user sees an underlying vendor. In production, leaks happen in three places:

  • Unsanitized Error Messages: Raw HTTP 429 or 500 responses from upstream providers often expose vendor names, repository slugs, or quota URLs. Forwarding those directly to your UI breaks the white-label illusion.
  • Exposed Asset Domains: Returning raw third-party CDN URLs for generated images, transparent cutouts, or audio lets any user inspect the network tab and trace your inference stack.
  • Shared Credential Blind Spots: Routing every customer through one global API key makes per-client margin tracking brittle and prevents instant revocation for a single noisy tenant.

Core Architecture of a Multi-Tenant White-Label AI Backend

A production-ready white-label AI platform separates tenant identity, model routing, and asset delivery into clean boundaries. Below is the three-part architecture used by teams building custom AI SaaS applications on top of a unified pay-as-you-go backend.

1. Per-Tenant API Key Scoping and Cost Attribution

Instead of routing all tenant traffic through a single credential, create dedicated named API keys per customer workspace, product tier, or environment inside the LumozAI panel. LumozAI tracks request counts and spend on a per-key basis—reporting today's requests, current-month spend, prior-month spend, and per-key usage history logs.

In your own SaaS database, map each internal tenant_id to its assigned LumozAI API key reference (encrypted at rest via KMS or Laravel/Node secret vaults) alongside your tenant's credit balance and rate-limit tier. This gives you two immediate advantages:

  • Exact Wholesale Margin Reconciliation: You can compare each tenant's retail subscription or credit pack revenue against exact per-key inference cost at the end of every billing cycle—no guesswork required. Check current model rates anytime on the LumozAI pricing page.
  • Instant Tenant Isolation and Revocation: If a single client workspace experiences credential abuse or spikes unexpectedly, you can rotate or disable that tenant's scoped key without interrupting any other customer on your platform.

2. Tiered Model Routing Across Draft, Studio, and Upscale Workloads

White-label SaaS margins depend on matching each user action to the right compute tier instead of sending every request to the heaviest flagship model. By routing through LumozAI's unified model catalog, your backend can expose clean semantic presets (such as Draft, Studio, and Print-Ready) in your branded UI while dynamically selecting the optimal underlying model:

  • Rapid Previews and Wireframe Iterations: Route interactive thumbnails and multi-variant brainstorming to SDXL Lightning, which generates 1024x1024 outputs in 4 steps for low-latency UI responsiveness.
  • Flagship Prompt Adherence and Commercial Visuals: Route final hero renders, typography-heavy layouts, and complex multi-subject prompts to Flux 1.1 Pro or Photon for high-fidelity creative output.
  • Post-Generation Sharpening and Print Delivery: Chain final assets through Crisp Upscale to clean compression artifacts and deliver print-grade or high-DPI web assets.

You can also mirror the workflow patterns of LumozAI's turnkey web apps—such as Transparent Image Maker, Product Photo Studio, and AI Video Upscaler—under your own brand by orchestrating those exact capabilities via REST API calls.

3. Error Sanitization and Branded Asset Delivery

LumozAI's OpenAI-compatible endpoints (/api/v1/chat/completions, /api/v1/images/generations, and /api/v1/audio/speech) already sanitize upstream model and provider names from error messages before returning JSON errors. Still, your own application layer should enforce two additional white-label safeguards:

  • Error Code Normalization: Map HTTP 401, 402, 422, and 500 responses to your own domain error codes (for example, INSUFFICIENT_WORKSPACE_CREDITS) so a low upstream balance never surfaces as a third-party billing message to your end user.
  • Asset Re-Hosting or Signed Proxy URLs: When an image, transparent PNG, or audio file finishes rendering, stream or copy the output artifact into your own S3/R2 bucket under cdn.yourdomain.com/tenants/{tenant_id}/... before returning the URL to the client browser.

White-Label AI Backend Approaches Compared

Before writing integration code, compare the three common ways engineering teams build white-label AI infrastructure:

Capability DIY Multi-Vendor Integrations Text-Only LLM Gateway LumozAI Unified White-Label API
Modalities Covered Requires 4–6 separate vendor SDKs LLM chat & embeddings only LLM, image, upscaling, background removal, TTS, voice cloning & video
Client SDK Compatibility Custom wrapper per vendor OpenAI SDK compatible OpenAI SDK compatible (/api/v1) + unified microservices REST API
Per-Tenant Cost Attribution Manual ledger across multiple invoices Per-virtual-key token logs Multiple named API keys with per-key spend & request tracking in /panel
Async Media & Webhooks Different polling schemas per provider Not supported for media jobs Standardized async + webhook & /api/v1/services/status/{request_id}
Vendor Leak Protection Must build custom regex scrubbers Partial text filtering Built-in white-label error sanitization across OpenAI-compatible endpoints
AI Agent Tooling Custom MCP server per service Not included Native MCP server (/api/mcp) for Claude & Cursor

Implementation: Multi-Tenant White-Label Router in TypeScript

The following Node.js / TypeScript example demonstrates how to build a white-label backend service that resolves a tenant's scoped LumozAI API key, calls OpenAI-compatible LLM and image endpoints, routes between fast and studio image models, and normalizes all error responses.

import OpenAI from "openai";

type QualityTier = "draft" | "studio" | "creative";

interface TenantConfig {
  tenantId: string;
  lumozApiKey: string; // Created per-tenant in lumozai.com/panel
  brandName: string;
}

const MODEL_PRESETS: Record<QualityTier, string> = {
  draft: "sdxl-lightning",   // 4-step fast preview generation
  studio: "flux-11-pro",     // High prompt adherence flagship
  creative: "photon",        // High-fidelity creative workflows
};

function createTenantClient(tenant: TenantConfig): OpenAI {
  return new OpenAI({
    apiKey: tenant.lumozApiKey,
    baseURL: "https://lumozai.com/api/v1",
  });
}

export async function generateWhiteLabelAsset(
  tenant: TenantConfig,
  userBrief: string,
  tier: QualityTier = "studio"
) {
  const client = createTenantClient(tenant);

  try {
    // 1. Expand brief into a structured visual prompt via OpenAI-compatible LLM
    const promptExpansion = await client.chat.completions.create({
      model: "lumoz-llm-1.0",
      messages: [
        {
          role: "system",
          content:
            "Convert the user brief into a concise, photorealistic visual prompt. Return only the prompt text.",
        },
        { role: "user", content: userBrief },
      ],
      temperature: 0.4,
    });

    const refinedPrompt =
      promptExpansion.choices[0]?.message?.content?.trim() || userBrief;

    // 2. Route to the requested quality tier using the same OpenAI SDK client
    const imageRes = await client.images.generate({
      model: MODEL_PRESETS[tier],
      prompt: refinedPrompt,
    });

    const rawUrl = imageRes.data?.[0]?.url;
    if (!rawUrl) {
      throw new Error("EMPTY_OUTPUT");
    }

    // 3. Re-host onto your own white-label CDN before returning to the tenant UI
    const brandedUrl = await mirrorToTenantCdn(tenant.tenantId, rawUrl);

    return {
      status: "completed",
      brand: tenant.brandName,
      tier,
      assetUrl: brandedUrl,
    };
  } catch (err: any) {
    // Normalize upstream HTTP errors so tenants only see your SaaS error contract
    const status = err?.status ?? 500;
    if (status === 402) {
      return { status: "error", code: "WORKSPACE_CREDITS_EXHAUSTED" };
    }
    if (status === 422) {
      return { status: "error", code: "INVALID_GENERATION_PARAMETERS" };
    }
    return { status: "error", code: "GENERATION_TEMPORARILY_UNAVAILABLE" };
  }
}

async function mirrorToTenantCdn(tenantId: string, sourceUrl: string): Promise<string> {
  const res = await fetch(sourceUrl);
  const buffer = Buffer.from(await res.arrayBuffer());
  const objectKey = `tenants/${tenantId}/assets/${Date.now()}.png`;
  // Upload buffer to your S3/R2 bucket and return your custom domain URL
  return `https://cdn.yourwhitelabelapp.com/${objectKey}`;
}

Chaining Async Microservices for Background Removal & Upscaling

Real-world white-label design apps rarely stop at raw image generation. E-commerce SaaS platforms typically remove the background to produce a transparent cutout (similar to LumozAI's Transparent Image Maker) and then upscale for storefront zoom or print. You can trigger LumozAI utility microservices asynchronously using POST /api/v1/services/{service_slug}/run with a tenant-scoped webhook callback:

export async function runWhiteLabelCutoutAndUpscale(
  tenant: TenantConfig,
  imageUrl: string,
  webhookUrl: string
) {
  // Step 1: Trigger async background removal microservice
  const bgResponse = await fetch(
    "https://lumozai.com/api/v1/services/remove-background/run",
    {
      method: "POST",
      headers: {
        Authorization: `Bearer ${tenant.lumozApiKey}`,
        "Content-Type": "application/json",
      },
      body: JSON.stringify({
        image: imageUrl,
        async: true,
        webhook: webhookUrl,
      }),
    }
  );

  const bgJob = await bgResponse.json();
  // Returns a request_id you can also poll via:
  // GET https://lumozai.com/api/v1/services/status/{request_id}
  return bgJob;
}

Once your webhook receives the transparent PNG output, chain it into Crisp Upscale using the input schema shown on its model page and mirror the final high-resolution asset to your branded CDN. For video-centric SaaS products, the same async webhook architecture pairs cleanly with AI Video Upscaler and the video-audio-merger microservice.

Exposing White-Label Tools to AI Coding Agents via MCP

Modern agencies and internal developer platforms increasingly ship AI capabilities not only in web dashboards, but directly inside developer IDEs and desktop assistants. LumozAI exposes a hosted Model Context Protocol endpoint at https://lumozai.com/api/mcp (detailed at lumozai.com/mcp) that authenticates via OAuth or Bearer API keys.

If you manage separate client workspaces, you can configure client-specific MCP profiles in Claude Desktop or Cursor by binding each workspace profile to its corresponding scoped LumozAI API key:

{
  "mcpServers": {
    "acme-studio-ai": {
      "url": "https://lumozai.com/api/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_TENANT_SCOPED_LUMOZ_KEY"
      }
    }
  }
}

Because usage on that Bearer token rolls up under its dedicated key ID in your LumozAI panel, even agent-triggered generations inside Cursor or Claude remain cleanly isolated per client project.

Production Checklist Before Launching Your White-Label AI SaaS

  • Enforce Per-Tenant Quotas: Apply soft and hard spend caps in your middleware and reconcile unit economics against LumozAI pricing.
  • Authenticate Webhook Callbacks: Include an HMAC signature or unguessable token on every webhook URL so external callers cannot spoof job completions.
  • Default to Tiered Routing: Serve interactive drafts with SDXL Lightning and reserve Flux 1.1 Pro or Photon for confirmed exports.
  • Mirror All Output Media: Copy generated images, cutouts, and audio into your own domain-backed object storage before returning URLs to client browsers.
  • Test Failure Paths: Verify that invalid inputs, timeouts, and balance errors map cleanly to your branded JSON error contract.

To get started, create per-tenant API keys in the LumozAI panel, browse the model catalog, or connect your workspace via Lumoz MCP.

L
Written by LumozAI Team

AI systems researchers and distributed compute engineers at LumozAI. Building low-latency generative models, serverless vision pipelines, and production OpenAI-compatible endpoints.

Explore Lumoz Models Hub