Low-Code · Orchestration Frameworksactive

Portkey (Conditional Routing)

Type: low-code · Vendor: Portkey AI · Language: TypeScript · License: MIT · Status: active · Status in practice: mature · First released: 2023

Links: homepage docs repo

Portkey is an AI gateway that routes each LLM request to a provider target by deterministic rules over request metadata and parameters, and falls back to another provider when one fails.

Description. Portkey's AI Gateway sits in front of many LLM providers behind one API. Its conditional routing evaluates custom conditions over request metadata, request parameters, and the URL path to pick a provider target, so a rule path runs ahead of the models. When the primary provider fails, Portkey automatically falls back to the next configured target. It also adds retries, load balancing, and guardrails.

Agent loop shape. Portkey is a gateway, not an agent loop. Each incoming request is matched against conditional-routing rules over its metadata and parameters to select a provider target; the gateway forwards the call, applies retries, and on failure falls back through an ordered list of alternative targets before returning the response to the caller.

Primary use cases

  • rule-based routing of requests to provider targets
  • automatic fallback across providers on failure
  • load balancing across LLM deployments
  • gateway-level guardrails and observability

Key concepts

  • Configs (docs)A declarative JSON object attached to a request that composes the gateway's routing behaviour - conditional routing, fallbacks, load balancing, retries, caching, and guardrails - without changing application code.
  • Targets fallback-chain (docs)The ordered list of provider/model destinations a Config can route to; fallbacks try them in priority order and load balancing splits traffic across them by weight.
  • Load balancing weights (docs)Per-target weights that Portkey normalises to 100% and uses to distribute requests proportionally across multiple LLM deployments, e.g. weights 5,3,1 become 55%,33%,11%.
  • Guardrails input-output-guardrails (docs)Pluggable checks that run synchronously or asynchronously around the model call to validate requests and responses, with configurable actions on a failed check.

Patterns this low-code implements —

Neighbourhood

Click any neighbour to follow the lineage. Scroll to zoom, drag to pan.