Hosting, AI Gateway
One OpenAI-compatible endpoint for your apps, with providers that process in the EU, keys, a budget, fallback and insight into usage.
An AI Gateway gives your app one endpoint for language models, like Vercel AI Gateway and Cloudflare AI Gateway, with only catalogued EU-processing providers enabled by default. Check your provider configuration and privacy report. The endpoint speaks the OpenAI shape, so use a chat-completions client with this gateway’s base URL and key.
Secure from the start
- EU providers only. A new gateway uses Mistral AI, Scaleway, IONOS and OVHcloud. OpenAI and Anthropic are off: processing in the EU is not proven there. Turning one on opens access: explicit only (
--allow-non-eu --yes), and then shown with a warning in the GDPR overview, the activity log and the EU evidence of the GDPR center (as a transfer outside the EEA). - Nothing kept. Hosting keeps no prompts or answers, only counts (tokens, cost, latency, errors). You turn keeping on yourself (
--on --yes), with a retention of 1 to 30 days; the content is stored encrypted in the EU. Turning it off deletes everything kept. - Budget and limits. By default € 25 per month, 60 requests and 100,000 tokens per minute. Above the budget the gateway refuses requests (
402), or only alerts if you choose so. At 80% and 100% you get an alert in Guard. - Keys. A key is shown once; Hosting keeps only a hash. Every key can have its own limit, budget and list of models, and can be rotated and revoked.
Create a gateway and a key
infaris-guard hosting ai create support-chat --budget 25 --default-model mistral/mistral-small-latest --json
infaris-guard hosting ai keys create <gatewayId> --name server --jsonThe answer of keys create contains the key (ifr_ais_…) and the base URL, once. In Guard you find the same under Hosting > AI Gateway.
Use it
import OpenAI from 'openai';
const client = new OpenAI({ baseURL: process.env.OPENAI_BASE_URL, apiKey: process.env.OPENAI_API_KEY });
const reply = await client.chat.completions.create({
model: 'mistral/mistral-small-latest',
messages: [{ role: 'user', content: 'Summarise this complaint in one sentence.' }],
});Models are named provider/model (mistral/mistral-small-latest, scaleway/llama-3.3-70b-instruct). A bare name also works when exactly one allowed provider has it. GET <baseURL>/models (or infaris-guard hosting ai models <gatewayId>) lists them with the price per million tokens. Streaming (stream: true) passes through unchanged as Server-Sent Events; /v1/embeddings works the same way.
Link to a site or function
infaris-guard hosting ai link <gatewayId> --function <functionId> --dry-run
infaris-guard hosting ai link <gatewayId> --function <functionId>The site or function gets its own key and the secret variables OPENAI_BASE_URL, OPENAI_API_KEY, INFARIS_AI_URL and INFARIS_AI_KEY. With --env-prefix CHAT_ you use two side by side. INFARIS_AI_URL and INFARIS_AI_KEY follow the scheme of the other parts (such as INFARIS_DATA_URL) and do not clash with the names of the Functions runtime (INFARIS_FUNCTION_*, INFARIS_PLATFORM_*). Hosting refuses a public prefix (NEXT_PUBLIC_, VITE_). hosting ai unlink revokes the key at once.
In the browser
A secret key does not work from a browser (a request with an Origin header is refused). For the browser you create a frontend key that belongs to an auth project:
infaris-guard hosting ai keys create <gatewayId> --name web --kind frontend --auth-project ap_… --models mistral/mistral-small-latest --rpm 20 --budget 5It only works together with a valid Infaris Auth token of a signed-in user in the X-Infaris-Auth header, and only from the origins of that auth project:
const client = new OpenAI({
baseURL: INFARIS_AI_URL,
apiKey: FRONTEND_KEY,
dangerouslyAllowBrowser: true,
defaultHeaders: { 'X-Infaris-Auth': session.access_token },
});Reliability
- Retries: on
429,5xxor a timeout the gateway tries again (2 times by default, with increasing waits). - Fallback: per model a list of other models, for example
mistral/mistral-large-latest→scaleway/llama-3.3-70b-instruct. An error in the request itself (400) does not go to the fallback. - Timeout: per attempt, 60 seconds by default (when streaming: between two chunks).
- Cache: identical non-streaming requests can come from the cache (off by default). The
x-infaris-cacheheader sayshitormiss;x-infaris-modelsays which model answered.
infaris-guard hosting ai update <gatewayId> --retries 2 --timeout-ms 30000 --fallbacks '[{"model":"mistral/mistral-large-latest","fallbacks":["scaleway/llama-3.3-70b-instruct"]}]'
infaris-guard hosting ai test <gatewayId> --jsonUsage
infaris-guard hosting ai usage <gatewayId> --by model --range 30d --jsonPer day, model or key: requests, tokens, cost in euro, average latency and error rate. Costs are an estimate based on the providers' list prices. Guard shows the same as a chart on the gateway page.
Your own provider key (BYOK)
printf %s "$MISTRAL_API_KEY" | infaris-guard hosting ai byok set <gatewayId> mistral --key-stdinYour own key takes precedence over the Infaris key. It is stored encrypted and never shown again; hosting ai byok remove deletes it.
Opening up
| What | Command |
|---|---|
| A provider outside the EU | hosting ai providers set <id> --providers mistral,scaleway,ionos,ovhcloud,openai --allow-non-eu --yes |
| Keep prompts and answers | hosting ai logging <id> --on --retention-days 7 --yes |
| Continue above the budget | hosting ai update <id> --budget-action alert |
hosting ai privacy <id> shows the GDPR overview: which providers process prompts, where, on what grounds, and every warning. Every command supports --json. Opening up and changes are confirmed with --yes; deleting the gateway with the typed name (--confirm <name>).
Limits and FAQ
Rate limits and cache operate per replica; they are not shared limits across replicas. Costs are estimates, not the model provider’s invoice. OpenAI compatibility covers chat completions, embeddings and models; Responses, images, audio and arbitrary custom endpoints are not promised.
All in the EU? Check allowed providers and the privacy report; non-EU providers can be explicitly enabled. Another client? Select chat completions explicitly, not Responses. A 402? Check both gateway and key budgets.