Skip to main content
As your workloads grow more complex, you may need different GPU types for different inputs, want to A/B test model versions, or orchestrate multi-step pipelines across specialized apps. Multi-app routing lets you deploy a lightweight CPU app as a router that inspects incoming requests and forwards them to the right backend. Each backend runs independently on its own machine type, scaling configuration, and model version. The pattern is simple: deploy your backend apps normally, then deploy a CPU-only router app that uses FAL_KEY (auto-injected into every runner) to call the backends via the fal client SDK. The router runs on cheap CPU instances and adds minimal latency, while each backend scales independently based on its own traffic. For simpler cases where you just want requests routed to runners that already have the right model loaded, see Optimize Routing Behavior instead.

When to Use

  • Route by GPU requirements — Send small inputs to A100, large inputs to H100
  • Route by model variant — Different LoRA adapters, different base models
  • A/B testing — Split traffic between model versions
  • Multi-step pipelines — Orchestrate a chain of apps (preprocess, generate, postprocess)
  • Fallback routing — Try one app, fall back to another on failure
  • Cost optimization — Route simple requests to cheaper machines, complex ones to expensive

How It Works

  1. Deploy multiple backend apps, each on a specific machine type
  2. Deploy a lightweight CPU router app that accepts all requests
  3. The router inspects the input and calls the appropriate backend via fal_client
  4. FAL_KEY is auto-injected into every runner, so the router can call other fal apps without hardcoding credentials

Example: Route by Input Size

Three apps: a CPU router and two GPU backends for different resolutions.

Backend Apps

Deploy both:

Router App

Users call image-router — it routes to the right backend automatically.

Example: A/B Testing

Split traffic between two model versions:

Example: Multi-Step Pipeline

Chain multiple apps together:

Trade-offs

Set max_multiplexing high on the router app (e.g., 50+) since it’s just making HTTP calls and doesn’t need exclusive resources per request.

Optimize Routing Behavior

Route requests within a single app using runner hints

Environment Variables

FAL_KEY is auto-injected for calling other fal apps