Moving From Portkey to Model Waygate

Model Waygate · Every source read on

How each of Portkey's config strategies (single, loadbalance, fallback, conditional, retry, cache and circuit breaker) maps onto Model Waygate's route node kinds, and where the two behave differently.

Model Waygate wrote this page, and it has an interest in how it reads: Model Waygate is one of the products compared. So every cell about another product cites that product's own documentation, pricing page or official repository, and every Model Waygate cell cites the code that makes it true. Each published cell has had its wording independently checked against those sources. A cell awaiting confirmation reads "Not verified".

"Not documented in the pages read" means the pages cited do not say. It does not mean the product lacks the feature. Products change, so each cell shows the date its sources were read.

If a cell is wrong or out of date, please email support@modelwaygate.com with the page that shows it, and we will check it again and correct it.

Portkey nests Config strategies; Model Waygate stores typed graph nodes with id, kind, position, and config, linked by source/target/order/optional label edges. The fragments below show only kind and config; add IDs, positions and edges before submission. Credential IDs refer to records created in the destination account, not Portkey virtual-key identifiers.

Sources: PK-1, PK-2, MW-1, MW-2 · Read

Config strategy to node kind

1. Root entry point
Portkey JSON shape

Top-level Config referenced by x-portkey-config.

Sources: PK-1 · Read

Model Waygate node kind

InputNode: {"kind":"input","config":{}}.

Sources: MW-2 · Read

Migration notes and behavioural differences

Exactly one input and one outgoing edge to the root routing/output node.

Sources: MW-2 · Read

2. Single target (single)
Portkey JSON shape

{"provider":"openai","virtual_key":"...","override_params":{"model":"gpt-4o"}} (legacy virtual-key form remains documented).

Sources: PK-2 · Read

Model Waygate node kind

OutputNode: {"kind":"output","config":{"credential":1,"model":"gpt-4o","timeoutSeconds":60}}.

Sources: MW-2 · Read

Migration notes and behavioural differences

Provider/host belong to the credential record; the graph fixes the credential and model. Optional timeoutSeconds is 1–300 seconds and bounds a buffered call in full, or a stream until it starts. Portkey request_timeout is in milliseconds and a timeout returns 408.

Sources: MW-1, MW-2, PK-27 · Read

3. Weighted load balance (loadbalance)
Portkey JSON shape

{"strategy":{"mode":"loadbalance"},"targets":[{"weight":70,...},{"weight":30,...}]} (schematic targets). Optional strategy.sticky (enabled, hash_fields, ttl) is also documented.

Sources: PK-2, PK-8 · Read

Model Waygate node kind

WeightedNode: {"kind":"weighted","config":{"branches":[{"id":"a","weight":7000},{"id":"b","weight":3000}]}}. Saving fills an omitted salt.

Sources: MW-8 · Read

Migration notes and behavioural differences

Round/rebalance positive weights to total exactly 10,000 and label each outgoing edge with its branch ID. Unset Portkey weights default to 1, so give them explicit equal shares; zero-weight targets receive no traffic, so remove them. Model Waygate uses a keyed deterministic assignment scoped to the route version, not a cached Portkey TTL assignment.

Sources: MW-8, PK-8 · Read

4. Fallback (fallback)
Portkey JSON shape

{"strategy":{"mode":"fallback","on_status_codes":[429,500,503]},"targets":[...]}.

Sources: PK-2, PK-4 · Read

Model Waygate node kind

FallbackNode: {"kind":"fallback","config":{"fallbackOn":["rate_limited","server_error"]}}. Omitted/null fallbackOn means any failure.

Sources: MW-3 · Read

Migration notes and behavioural differences

Keep target order as ascending edge order. Status-to-category mapping loses precision: selecting server_error for 500/503 also permits other 5xx. Portkey default fallback is non-2xx; Waygate any-failure also covers unreadable/empty buffered 2xx and local breaker/limit refusals. Request-wide limits stop Waygate regardless.

Sources: PK-4, MW-2, MW-3 · Read

5. Conditional routing (conditional)
Portkey JSON shape

strategy.conditions holds ordered query/then rules and default; targets are named. Paths are metadata.<key>, primitive params.<key>, and url.pathname.

Sources: PK-9 · Read

Model Waygate node kind

SwitchNode (kind: "switch", config rules with id/when, and default) or DecisionNode (kind: "decision").

Sources: MW-9, MW-2 · Read

Migration notes and behavioural differences

Switch matches only API, stream, and trusted backend-created task-session customer/feature labels. Arbitrary Portkey params/regex/URL rules have no exact translation. A Decision node can classify content with an extra model call, but is not an equivalent deterministic regex rule.

Sources: PK-9, MW-9 · Read

6. Retry (retry)
Portkey JSON shape

{"retry":{"attempts":3,"on_status_codes":[429,500,502,503,504,529],"use_retry_after_headers":true}}.

Sources: PK-5 · Read

Model Waygate node kind

RetryNode: {"kind":"retry","config":{"attempts":4,"backoff":"exponential","baseDelayMs":1000,"maxDelayMs":30000,"jitter":false}}.

Sources: MW-2, MW-4 · Read

Migration notes and behavioural differences

Portkey counts retries after the initial try; Waygate counts total tries (2–5). Thus three Portkey retries map to four tries, but five Portkey retries exceed Waygate's node limit. Waygate retries only fixed transient categories, not arbitrary status lists. Provider waits above maxDelayMs stop retries; Portkey has a 60-second cumulative wait cap. This is a semantic approximation.

Sources: PK-5, MW-4 · Read

7. Circuit breaker (cb_config)
Portkey JSON shape

{"cb_config":{"failure_threshold":5,"cooldown_interval":30000}}; optional percentage threshold, minimum requests and failure status list.

Sources: PK-6 · Read

Model Waygate node kind

BreakerNode: {"kind":"breaker","config":{"failureThreshold":5,"cooldownSeconds":30}}.

Sources: MW-2, MW-5 · Read

Migration notes and behavioural differences

Waygate breaker must directly guard an output; a Limit can wrap that breaker. Portkey supports count/percentage logic and bypasses the breaker when all targets are open. Waygate counts consecutive transient failures and admits one probe after cooldown. Thresholds/state transitions are not equivalent even when the numbers match.

Sources: PK-6, MW-5, MW-7 · Read

8. Response cache (cache)
Portkey JSON shape

{"cache":{"mode":"simple","max_age":3600}}; semantic mode has plan/infrastructure restrictions.

Sources: PK-2, PK-17 · Read

Model Waygate node kind

No Model Waygate response-cache node.

Sources: MW-20 · Read

Migration notes and behavioural differences

Removing cache loses gateway response reuse. Provider prompt caching is separate: Waygate preserves native markers and specified OpenAI translated hints, but does not reproduce Portkey auto_caching marker insertion.

Sources: MW-13, MW-16, PK-22 · Read

9. Parameter overrides/defaults/drop/passthrough
Portkey JSON shape

{"override_params":{"temperature":0.2,"model":"..."}}; defaults/drop and caller-resolved passthrough are documented separately.

Sources: PK-1, PK-2 · Read

Model Waygate node kind

Output fixes model; caller supplies other generation parameters.

Sources: MW-1, MW-10 · Read

Migration notes and behavioural differences

No general target-level replacement for Portkey defaults/drop/override/passthrough. Move such logic to the client or preserve it elsewhere. Native forwarding carries provider fields; translated paths retain only representable canonical features, not arbitrary provider parameters.

Sources: PK-1, MW-10 · Read

10. Additional Waygate nodes
Portkey JSON shape

Hedge or per-target concurrency strategies: Not documented in the pages read.

Sources: PK-1, PK-2, PK-6 · Read

Model Waygate node kind

HedgeNode (kind: "hedge", config delay_ms/duplicate_calls) and LimitNode (kind: "limit", config maxConcurrent).

Sources: MW-2, MW-6, MW-7 · Read

Migration notes and behavioural differences

Hedge races buffered calls only; a limit is immediate refusal with PostgreSQL-coordinated leases. “Not documented” does not establish that Portkey lacks an equivalent capability.

Sources: MW-6, MW-7, PK-6 · Read

An example translation

This schematic Portkey configuration weights Anthropic/OpenAI 80/20, applies three retries and a count-based breaker to the Anthropic target, and falls back to Gemini for selected HTTP statuses. Only the Anthropic target has retries/a breaker.

Sources: PK-2, PK-5, PK-6, PK-8 · Read

{
  "strategy": {"mode": "fallback", "on_status_codes": [429, 500, 502, 503, 504]},
  "targets": [
    {
      "strategy": {"mode": "loadbalance"},
      "targets": [
        {
          "provider": "anthropic",
          "virtual_key": "anth-key",
          "override_params": {"model": "claude-sonnet-4-5"},
          "weight": 80,
          "retry": {"attempts": 3, "use_retry_after_headers": true},
          "cb_config": {"failure_threshold": 5, "cooldown_interval": 30000}
        },
        {
          "provider": "openai",
          "virtual_key": "oa-key",
          "override_params": {"model": "gpt-5"},
          "weight": 20
        }
      ]
    },
    {"provider": "google", "virtual_key": "gem-key", "override_params": {"model": "gemini-2.5-pro"}}
  ]
}

A Model Waygate graph that approximates it, node by node:

  1. Input in-1 leads to Fallback fb-1, config {"fallbackOn":["rate_limited","server_error","circuit_open"]}.
  2. fb-1 edge order 0 leads to Weighted wt-1, config {"branches":[{"id":"anth","weight":8000},{"id":"oa","weight":2000}]} (saving supplies salt).
  3. wt-1 edge labeled anth leads to Retry rt-1, config {"attempts":4,"backoff":"exponential","baseDelayMs":1000,"maxDelayMs":30000,"jitter":false}, then Breaker br-1, config {"failureThreshold":5,"cooldownSeconds":30}, then the Anthropic output.
  4. wt-1 edge labeled oa leads to the OpenAI output.
  5. fb-1 edge order 1 leads to the Gemini output. Each output config contains its destination-account credential ID and model.

Sources: MW-2, MW-3, MW-4, MW-5, MW-8 · Read

See the whole comparison of Model Waygate with other gateways.

Draw Your First Route

Add a provider key, let the wizard start an endpoint, and point your SDK at it.

Sign In to Get Started

Sources

Model Waygate's repository is not public, so its sources are named as files at trunk commit 0406fbd7 rather than linked.

  • PK-1 Configs, read
  • PK-2 Gateway Config Object, read
  • MW-1 Editor, endpoint API and fixed-model routing, read
    • apps/model-waygate/CONTEXT.md
    • apps/model-waygate/client/src/Editor/View.hs
    • apps/model-waygate/client/src/Editor/History.hs
    • apps/model-waygate/client/src/Editor/Geometry.hs
    • apps/model-waygate/app/Endpoint/RouteTest.hs
    • apps/model-waygate/app/Api/Control.hs
    • apps/model-waygate/app/Api/Control/Lifecycle.hs
    • apps/model-waygate/app/Routing/GraphJson.hs
    • apps/model-waygate/docs/adr/0030-control-api-v1-stable.md
    • apps/model-waygate/docs/control-api-v1.schema.json
  • MW-2 Graph types, validation, wire encoding and execution, read
    • apps/model-waygate/shared/Gateway/Shared/Graph.hs
    • apps/model-waygate/app/Routing/Graph.hs
    • apps/model-waygate/app/Routing/GraphJson.hs
    • apps/model-waygate/app/Routing/Run.hs
  • PK-5 Automatic Retries, read
  • PK-6 Circuit Breaker, read
  • PK-8 Load Balancing, read
  • MW-3 Failure categories and fallback policy, read
    • apps/model-waygate/shared/Gateway/Shared/Graph.hs
    • apps/model-waygate/app/Gateway/Error.hs
    • apps/model-waygate/docs/control-api-v1.schema.json
  • MW-4 Retry attempts, transient failures and provider waits, read
    • apps/model-waygate/shared/Gateway/Shared/Graph.hs
    • apps/model-waygate/app/Routing/Run.hs
    • apps/model-waygate/app/Gateway/Error.hs
    • apps/model-waygate/app/Upstream/Http.hs
    • apps/model-waygate/app/Docs/Content.hs
  • MW-5 Circuit breaker shape and shared state, read
    • apps/model-waygate/app/Routing/Graph.hs
    • apps/model-waygate/app/Endpoint/Breaker.hs
    • apps/model-waygate/app/Pipeline.hs
    • apps/model-waygate/shared/Gateway/Shared/Graph.hs
    • apps/model-waygate/app/Docs/Content.hs
  • MW-8 Weighted branches and version-scoped assignment, read
    • apps/model-waygate/app/Routing/Weighted.hs
    • apps/model-waygate/shared/Gateway/Shared/Graph.hs
    • apps/model-waygate/app/Routing/GraphJson.hs
    • apps/model-waygate/docs/control-api-v1.schema.json
  • PK-27 Request timeouts, read
  • PK-4 Fallbacks, read
  • PK-9 Conditional Routing, read
  • MW-9 Switch facts and decider routing, read
    • apps/model-waygate/shared/Gateway/Shared/Graph.hs
    • apps/model-waygate/app/Routing/Run.hs
    • apps/model-waygate/app/Routing/Graph.hs
    • apps/model-waygate/app/Routing/GraphJson.hs
    • apps/model-waygate/CONTEXT.md
    • apps/model-waygate/app/Gateway/Error.hs
    • apps/model-waygate/app/Pipeline.hs
  • MW-7 Concurrency leases and allowed wrapper shape, read
    • apps/model-waygate/app/Endpoint/Concurrency.hs
    • apps/model-waygate/app/Routing/Graph.hs
    • apps/model-waygate/shared/Gateway/Shared/Graph.hs
  • PK-17 Cache (Simple & Semantic), read
  • MW-20 No response caching, read
    • apps/model-waygate/CONTEXT.md
    • apps/model-waygate/app/Docs/Content.hs
    • apps/model-waygate/app/Pipeline.hs
  • MW-13 Cache marker forwarding, translation limits and usage, read
    • apps/model-waygate/docs/adr/0032-prompt-cache-markers-and-cached-tokens.md
    • apps/model-waygate/app/Pipeline.hs
    • libs/llm-providers/src/LlmProviders/Adapter/OpenAICompatible.hs
    • libs/llm-providers/src/LlmProviders/Adapter/OpenAIResponses.hs
    • libs/llm-providers/src/LlmProviders/Adapter/Anthropic.hs
  • MW-16 Payload non-storage and metadata retention, read
    • apps/model-waygate/CONTEXT.md
    • apps/model-waygate/app/Config.hs
    • apps/model-waygate/app/Database/Schema/Request.hs
    • libs/server-utils/src/ServerUtils/Privacy.hs
    • apps/model-waygate/app/Pipeline.hs
  • PK-22 Anthropic prompt caching and automatic cache control, read
  • MW-10 Inference endpoints and forwarding/translation, read
    • apps/model-waygate/app/Api/Gateway.hs
    • apps/model-waygate/app/Pipeline.hs
    • apps/model-waygate/app/Format/OpenAIResponses.hs
    • apps/model-waygate/app/Format/Embeddings.hs
    • apps/model-waygate/CONTEXT.md
    • apps/model-waygate/app/Docs/Content.hs
  • MW-6 Hedge restrictions and execution, read
    • apps/model-waygate/app/Routing/Graph.hs
    • apps/model-waygate/app/Routing/Run.hs
    • apps/model-waygate/app/Routing/GraphJson.hs
    • apps/model-waygate/shared/Gateway/Shared/Graph.hs
    • apps/model-waygate/app/Docs/Content.hs