flexway
FRENTalk to an expert

AI

Your models behind one surface, with a budget that holds.

An OpenAI-compatible API in front of your providers and internal models: token and euro budgets per tenant, ordered fallback before the first byte, and never an external model for a sensitive request.

11 of the 13 shown delivered · since v0.1.0

What you expect from this domain

  • Centralise access to providers and internal modelsDelivered · since v0.1.0
  • Hide provider keys, manage secretsDelivered · since v0.1.0
  • Fail over when a provider is downDelivered · since v0.1.0
Every market expectation
Measured usageMeasured usage
A tenant's measured usage: requests, tokens and euros against their daily and monthly ceilings.Real console capture, demo data · v1.6.3

What it solves

Problem 1

The inference bill runs away

A tenant or an agent loop consumes without limit; the bill arrives at month end.

Flexway's answer: Monthly budget in tokens and euros per tenant; a soft cap that warns and moves to a cheaper model.

Problem 2

Sensitive data leaves for a provider

A request with personal data goes to a model hosted outside your walls.

Flexway's answer: A request marked sensitive is pinned to an internal model, or refused.

Problem 3

A provider goes down

The main model errors or times out; the application fails.

Flexway's answer: Fallbacks tried in order before any byte to the client, a circuit breaker per model.

How it works

Every step is a decision readable in the trace and in the console.

Your infrastructureflexwayAPI, AI and agent gatewayUnified Decision Chain (UDC)429budget exhausted: 42901 Identity02 Sensitivity03 Routing04 Budget05 Fallback06 RelayApplicationsAgentsExternal modelCheaper modelInternal model503Your infrastructureflexwayAPI, AI and agent gatewayUnified Decision Chain (UDC)42901 Identitytenant read from the identity02 Sensitivitysensitive request: internal model only03 Routingdefault backend, override or soft cap04 Budgettokens and euros reserved before the call05 Fallbackfailure, 5xx, timeout: the next one06 Relayline by line, budget reconciledApplicationsAgentsExternal modelCheaper modelInternal model503

AI - Domain diagram: who calls, the decision steps, what is called, and where a request is refused.

  • Applications
  • Agents
  1. Identity
  2. Sensitivity
  3. Routing
  4. Budget
  5. Fallback
  6. Relay
  • External model
  • Cheaper model
  • Internal model

budget exhausted: 429

Applications
The applications that call your APIs: each request goes through Flexway, which checks the contract and the identity before reaching your systems.
Agents
AI agents: they call MCP tools and models through Flexway, under the same identity, quota and audit as an API.
Identity
Flexway checks who is calling (OIDC token, API key or client certificate) and reads the tenant from the identity; no valid identity: 401.
Sensitivity
A request marked sensitive goes only to an internal model, never to an external provider.
Routing
Flexway picks the model by policy: default backend, declared override or soft cap depending on the request.
Budget
The tenant's budget, in tokens and euros, is reserved before the model call; exhausted: 429 budget_exceeded.
Fallback
If the model fails (outage, 5xx, timeout), Flexway moves to the next one before any byte is sent back and says so in the response.
Relay
The model's response is relayed without buffering, streams included, and the budget is reconciled at the real price of the model that served.
External model
A model provider outside your infrastructure: called under budget, never for a sensitive request.
Cheaper model
The cheaper fallback model: Flexway falls back to it if the first one fails, before any byte is sent back.
Internal model
A model running on your premises: sensitive requests never leave your infrastructure.
  • Line: one route
  • Interchange: shared decision
  • Model or tool call
  • Refusal
  • Your infrastructure
  1. Identitytenant read from the identity
  2. Sensitivitysensitive request: internal model only
  3. Routingdefault backend, override or soft cap
  4. Budgettokens and euros reserved before the call
  5. Fallbackfailure, 5xx, timeout: the next one
  6. Relayline by line, budget reconciled

In detail

The essentials of each topic, with its status in the published release; unfold a card for the full text.

An OpenAI-compatible surface, backends by kind

Delivered · v1.5.0

The gateway serves an OpenAI-compatible /v1/* with no contract to write, under the same identity and policies, towards backends declared by kind.

  • /v1/chat/completions, /v1/models, /v1/embeddings built in
  • Kinds openai, relay, grpc; no provider imposed
  • Streaming relayed line by line
See the detailHide the detail - An OpenAI-compatible surface, backends by kind

The gateway serves /v1/* with no contract to write: the built-in operations ai.chatCompletions, ai.listModels and ai.embeddings answer under the ai section of flexway.yaml, with the same identity, policies and tracing as the rest of the traffic. Errors on /v1/* are returned in the OpenAI error envelope, gateway refusals included, and as RFC 9457 everywhere else. Streaming is relayed line by line, unbuffered, and the budget is reconciled on the final usage.

A backend is declared by its kind: openai for any OpenAI-compatible API (the default), relay for another Flexway, grpc for the upstream of a specialised model. No provider is named in the product: a backend is a URL, an authentication method and a price. Authentication is generic - none, bearer by reference, header with a declared name, token_file re-read on every call as a workload identity projects it - and client TLS can be added for an mTLS relay.

The requested model is served if it appears in the backend's models list, otherwise its default_model is used; the audit keeps the model actually served. Earlier configurations load unchanged.

All the points

  • /v1/chat/completions, /v1/models, /v1/embeddings built in
  • OpenAI error envelope on /v1/*
  • Kinds openai, relay, grpc; no provider imposed
  • Streaming relayed line by line

Features and status

  • OpenAI-compatible /v1/* surfaceDelivered · v0.1.0
  • Backends by kind (OpenAI, relay, gRPC), local or upstream meteringDelivered · v1.5.0
  • Inference streaming relayed without holdingDelivered · v0.1.0
  • Translation to the OpenAI error envelope on /v1/*Delivered · v0.1.0
Read in the documentation : OpenAI-compatible inference

Budgets in tokens and euros, with a soft cap

Delivered · v0.1.0

Flexway counts tokens and euros per tenant, switches to a cheaper backend at the soft cap and refuses with 429 at the hard cap.

  • Tokens (day, month) and euros (month) per tenant
  • Soft cap: warn and switch; hard cap: 429
  • Reservation returned on failure or refusal
See the detailHide the detail - Budgets in tokens and euros, with a soft cap

A requests-per-second quota says nothing about the cost of a model call. Flexway counts tokens per day and per month, and euros per month, per tenant: each backend declares its price (euros per million input and output tokens), and the first budget reached decides. Each call is pre-reserved, then reconciled at the price of the backend that actually served it.

At the soft cap (ai.budget.soft), the response carries the Flexway-Budget: soft header and traffic switches to the declared, cheaper backend; at the hard cap, the request is refused with 429 budget_exceeded. A failed or refused call gives its reservation back, tokens and euros: a failing backend does not drain a tenant's budget. Overrides per tenant and per agent set a different backend and different budgets.

Behind a relay to another Flexway that meters on its own (metering: upstream), the local cap still applies, the upstream's 429 is relayed as is and series carry metered_by="upstream", so that consumption is counted once, where it is paid. flexway validate warns about a relay metered locally, which would count twice.

All the points

  • Tokens (day, month) and euros (month) per tenant
  • Soft cap: warn and switch; hard cap: 429
  • Reservation returned on failure or refusal
  • Overrides per tenant and per agent

Features and status

  • Budget and rate per tenantDelivered · v0.1.0
  • Token quotas and monetary inference budgetDelivered · v0.1.0
Read in the documentation : Serving inference

Sensitive requests and sovereignty

Delivered · v0.1.0

A request marked sensitive goes only to an internal backend, otherwise it is refused: the header narrows routing, never widens it.

  • Sensitive request: internal backend, otherwise refused
  • External sensitive backend refused at load
  • Declarative, reproducible choice
See the detailHide the detail - Sensitive requests and sovereignty

A request flagged as sensitive by the declared header (ai.sensitive_header) is pinned to the designated internal backend (ai.sensitive_backend). That backend must be internal: declaring an external one is refused at load. If no internal backend can serve it, the request is refused rather than sent outside. The header can only narrow routing, never widen it.

A relay to another Flexway is treated as external unless declared otherwise (external: false): only the operator decides that another gateway may receive sensitive traffic. The call's identity is passed under declared names only (identity_headers: tenant, agent, sensitive); nothing from the caller's request is copied. Neither the soft-cap switch nor fallbacks ever send a sensitive request to an external backend.

Backend choice is declarative: default, then tenant and agent override, then capability override, then sensitivity; neither latency, nor content, nor the requested model decides. Declaring which backend serves which tenants helps you meet your data residency requirements; automatic routing by latency or by jurisdiction is upcoming.

All the points

  • Sensitive request: internal backend, otherwise refused
  • External sensitive backend refused at load
  • Relay external by default, identity under declared names
  • Declarative, reproducible choice

Features and status

  • Sensitive requests pinned, sovereignty and fallback by policyDelivered · v0.1.0
  • Policy routing across providers and modelsDelivered · v0.1.0
Read in the documentation : AI and inference

Ordered fallback and a circuit breaker per backend

In part

On a failure, 5xx or timeout, the declared fallbacks are tried in order before any byte is sent, never on a 4xx nor towards an external backend when sensitive.

  • Fallbacks in order, before any byte
  • Never on 4xx, never external when sensitive
  • Response marked Flexway-Degraded
See the detailHide the detail - Ordered fallback and a circuit breaker per backend

Each backend declares a fallback list, tried in order on connection error, 5xx, timeout or open circuit. Fallback happens before any byte reaches the client, each backend once. It never happens on a 4xx, a provider's 429 included, and never to an external backend for a sensitive request. A response served by a fallback carries Flexway-Degraded: backend-fallback.

A circuit breaker per backend avoids insisting on a model that has stopped answering. Fallback applies to the openai and relay kinds and keeps only backends that serve the requested capability: a request with an image falls back only to a vision backend. Fallback on an exhausted budget is the soft cap described above.

Inference-aware routing - by model, request criticality, actual model-server load or context-cache affinity, interfacing with the Gateway API Inference Extension on Kubernetes - is upcoming. The semantic cache, opt-in per operation, is upcoming as well.

All the points

  • Fallbacks in order, before any byte
  • Never on 4xx, never external when sensitive
  • Response marked Flexway-Degraded
  • Inference-aware routing: planned
  • Semantic cache: planned

Features and status

  • Policy routing across providers and modelsDelivered · v0.1.0
  • Sensitive requests pinned, sovereignty and fallback by policyDelivered · v0.1.0
  • Inference-aware routing (Gateway API Inference Extension)Planned
  • Semantic cache, per operationPlanned
Read in the documentation : Serving inference

Metadata audit, never a prompt

Delivered · v1.5.0

Every inference call leaves a metadata audit line - tenant, model, tokens, cost - without ever collecting the prompt or the response.

  • Metadata only: no prompt, no response
  • Served model, tokens and cost per call
  • Per-tenant reporting from the audit
See the detailHide the detail - Metadata audit, never a prompt

Each inference call produces a metadata audit line: tenant, agent, served model, backend, tokens, cost. Prompts and responses are never collected, and identifiers are hashed in logs. Per-tenant reporting, for internal billing or chargeback, comes out of this audit with no extra tooling.

The same facts feed the flexway.inference.cost and flexway.inference.calls metrics, with metered_by and capability dimensions, which the console reads for its per-tenant and per-backend gauges. Keeping a usable record of who called which model at what cost, without keeping the content, helps you meet the logging and data governance requirements that apply to AI usage.

All the points

  • Metadata only: no prompt, no response
  • Served model, tokens and cost per call
  • Per-tenant reporting from the audit
  • flexway.inference.* metrics

Features and status

  • Metadata audit, never a promptDelivered · v0.1.0
  • Backends by kind (OpenAI, relay, gRPC), local or upstream meteringDelivered · v1.5.0
Read in the documentation : AI and inference

Multimodal, embeddings and specialised models

Delivered · v1.5.0

Images, embeddings and specialised gRPC models are metered against the tenant's budget, each served by a backend with the requested capability.

  • An image goes only to a vision backend
  • Embeddings with budget, fallback and audit
  • Specialised gRPC model metered per call or per byte
See the detailHide the detail - Multimodal, embeddings and specialised models

Message content can be a string or text and image_url parts, in the OpenAI format. The image is measured in the body without being decoded (ai.vision.max_image_bytes, 8 MiB by default; body bounded by ai.vision.max_body_bytes, 24 MiB by default); data: URIs are accepted by default, a remote URL only from a declared https origin (ai.vision.allowed_origins), and any other part type is refused. An image goes only to a backend with the vision capability, otherwise 400 capability_unavailable; it is pre-reserved at 2,048 tokens, reconciled on the reported usage.

POST /v1/embeddings follows the same path as a completion: identity, budget on prompt_tokens, fallback before any byte, metadata audit, and a backend with the embeddings capability. A gRPC method of a specialised model is metered when it carries the ai option of (flexway.v1.operation), the gRPC counterpart of x-flexway-ai: per call (body never read) or per byte, with a price per thousand and a feature.

For these models, the tenant's euro budget is reserved before the call and returned if the upstream did not serve; refusals are RESOURCE_EXHAUSTED budget_exceeded and PERMISSION_DENIED sensitive_no_internal_backend. Their upstream must be named by a kind: grpc backend, otherwise the configuration is refused at load.

All the points

  • image_url images: data: by default, declared https origins
  • An image goes only to a vision backend
  • Embeddings with budget, fallback and audit
  • Specialised gRPC model metered per call or per byte

Features and status

  • OpenAI-compatible multimodal content, vision backendDelivered · v1.5.0
  • Embeddings, with budget and auditDelivered · v1.5.0
  • gRPC method of a specialised model, metered per callDelivered · v1.5.0
Read in the documentation : Serving inference

Configuration

The ai-cost example, as it ships with Flexway v1.6.3.

examples/ai-cost/flexway.yaml
# What inference costs, and what happens when a backend fails: prices declared per backend, a
# monthly budget in euros per tenant beside the token budget, a soft cap that warns and moves the
# call to a cheaper backend, and fallbacks tried in order before any byte reaches the client - never
# an external one for a sensitive request.
version: 1
auth:
  issuers:
    - name: customers
      discovery: https://login.example.net/.well-known/openid-configuration
      audience: api
      tenant_claim: org
ai:
  security:
    - oidc: { scopes: [inference] }
  sensitive_header: X-Sensitive
  default_backend: eu-large
  sensitive_backend: on-prem
  backends:
    eu-large:
      url: https://api.provider.example/v1
      api_key: "file:/etc/flexway/secrets/provider-key"
      default_model: mistral-large
      external: true
      price: { input_per_mtok: 2.00, output_per_mtok: 6.00 }   # euros per million tokens
      fallback: [eu-small, on-prem]              # in order, on connection failure, 5xx, timeout
    eu-small:
      url: https://api.provider.example/v1
      api_key: "file:/etc/flexway/secrets/provider-key"
      default_model: mistral-small
      external: true
      price: { input_per_mtok: 0.10, output_per_mtok: 0.30 }
      fallback: [on-prem]
    on-prem:
      url: http://vllm.inference.svc:8000/v1
      default_model: mistral-7b-instruct
      price: { input_per_mtok: 0, output_per_mtok: 0 }      # 0 is a price: internal
  budget:
    store: "${COUNTERS_URL}"
    monthly_tokens: 40000000                     # both budgets hold: the first reached decides
    monthly_eur: 50                              # per tenant, over the calendar month
    soft: { at: 0.8, backend: eu-small }         # past 80 %: Flexway-Budget: soft, moved to eu-small
  overrides:
    - { match: { tenant: acme }, monthly_eur: 500 }

Features

What is delivered in the published release v1.6.3, and what is coming; a feature is never shown as delivered before its release.

FeatureStatus
OpenAI-compatible /v1/* surfaceDelivered · v0.1.0
Policy routing across providers and modelsDelivered · v0.1.0
Budget and rate per tenantDelivered · v0.1.0
Sensitive requests pinned, sovereignty and fallback by policyDelivered · v0.1.0
Metadata audit, never a promptDelivered · v0.1.0
Inference streaming relayed without holdingDelivered · v0.1.0
OpenAI-compatible multimodal content, vision backendDelivered · v1.5.0
Embeddings, with budget and auditDelivered · v1.5.0
Backends by kind (OpenAI, relay, gRPC), local or upstream meteringDelivered · v1.5.0
gRPC method of a specialised model, metered per callDelivered · v1.5.0
Inference-aware routing (Gateway API Inference Extension)Planned
Semantic cache, per operationPlanned
Usage: requests, tokens, euros, per tenantDelivered · v0.1.0

Every feature · Work out your AI budget

The other expectations of this domain

  • AI-augmented frontend with no provider key, streams, limitsDelivered · since v0.1.0
  • Rights per team, application, model or environmentScopes per endpoint, overrides per tenant and per agent, models allowed per backend; models allowed per caller (tenant, plan, use case, client) are missingPartly · next in 1.9
  • Choose the model by taskRouting by capability (chat, vision, embeddings); model aliases and use cases framed; routes per declared task are missingPartly · next in 1.9
  • Choose by latency, cost, quality or regionCost: a soft cap that switches; measured latency, declared cost, region and hosting class as declared criteria are missing. Quality cannot be measured by the gateway (evaluation: out of scope)Partly · next in 1.9
  • Send simple requests to a small modelPossible through a declared route (the task says so); a classifier on the path is excluded by a product rulePartly · next in 1.9
  • Tell cloud, private and local models apartThe external attribute of backends and pinning of sensitive requests; the declared hosting class (cloud, private, local) is missingPartly · next in 1.9
  • Prevent confidential data from reaching some providersA request marked sensitive is pinned to an internal backend; data classes and the backends allowed per class are missingPartly · next in 1.9
  • Govern RAG access (search, vectors, embeddings)Embeddings under budget, search APIs and vector databases served as endpoints; filtering rights per document is out of scopePartly · next to be scheduled
  • Industrialise the prompt lifecycleConfiguration versioned in Git, models allowed per backend; models approved per caller planned; prompt registry and result comparison: out of scopePartly · next in 1.9
  • Cut latency and costs (cache, small model)REST response cache; semantic cache planned; routes per task plannedPartly · next in 1.9
  • Cloud and self-hosted side by sideSensitive requests pinned to an internal model, relay to another Flexway; data classes and hosting plannedPartly · next in 1.9
  • Semantic routing, selection by task, sensitivity, budget, latencyPlanned through declared rules; autonomous selection by a model is excludedPartly · next in 1.9
  • AI at the edgeThe same arm64 binary routes to a local model; running the model stays with the inference runtimePartly · next to be scheduled
  • Gateway driven by business intentThe declared intent (use case, task route) is resolved by a rule; never by a modelPartly · next in 1.9
  • Data residencyAnnounced "by policy", not built: regions allowed per tenant or per class, proven in the tracePlanned in 1.9
  • Health AI: models approved per data type, tracesData classes, allowed backends, decision linePlanned in 1.9

The other domains

Let's talk about your gateway

Flexwiz is a young company: you talk directly with the person who founds it. Tell us what you want to run through Flexway. We talk about your infrastructure and your digital sovereignty requirements.

Online booking is coming soon; until then, an e-mail is enough.