flexway
FRENTalk to an expert

Control the AI bill

Keep the AI bill in check, tenant by tenant.

Quotas are in tokens and euros, per tenant, with a soft cap that warns or routes to a cheaper model, then a hard cap. Usage per tenant reads in the console, and the prompt is never logged.

The path

  1. ExposeAn OpenAI-compatible surface in front of your providers and models
  2. BudgetTokens and euros per tenant, soft cap then hard cap
  3. RouteTo a cheaper model, or an internal one for a sensitive request
  4. ReportUsage per tenant in the console, audit without the prompt

Spending stops at the gateway, before the provider: an overrun becomes a clear answer, not a line on the bill.

Open this template in the editor

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
Budget and rate per tenantDelivered · v0.1.0
Policy routing across providers and modelsDelivered · v0.1.0
Sensitive requests pinned, sovereignty and fallback by policyDelivered · v0.1.0
Metadata audit, never a promptDelivered · v0.1.0
Backends by kind (OpenAI, relay, gRPC), local or upstream meteringDelivered · v1.5.0
Semantic cache, per operationPlanned

Going further

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.