Skip to main content
Every time you send a request to Meliai, the platform evaluates all available European providers in real time and selects the one that best fits your priorities — balancing cost, latency, and environmental impact. Routing is fully automatic, so your code doesn’t need to change as providers are added or removed. You control the tradeoff by choosing a routing flavor, either by appending a suffix to your model ID or by setting a preset field in your request body.

The five routing flavors

Each flavor applies a different weighting across three dimensions: price, speed, and environmental impact. Meliai scores every candidate provider against these weights and routes to the winner.

How to choose a flavor

Method 1: Suffix the model ID

Append :flavor directly to the model ID in your request. This is the simplest and most portable approach — it works with any OpenAI- or Anthropic-compatible client without any custom parameters.

Method 2: Use the preset field

Pass a preset value in the request body to hint at the type of workload. Accepted values are "reasoning" and "non_reasoning". Meliai uses this to further refine provider selection within the active flavor.
If you specify both a model-ID suffix and a preset field, the suffix takes precedence. For example, model: "qwen/qwen3-235b-a22b:price" with preset: "reasoning" routes using the price flavor.

Automatic failover

If a provider returns an error or exceeds its response-time threshold, Meliai automatically retries with the next-best provider according to the active flavor’s scoring. This happens transparently — your client receives a single response with no visible retry logic. To see which provider ultimately served your request, inspect the environment_impact.provider_id and environment_impact.location fields in the response:
If every provider in the pool fails, the API returns error code INFERENCE_3103. This is rare; check the status page if you encounter it repeatedly.
Use the :eco flavor to bias routing toward providers powered by higher proportions of renewable energy. Combined with the environment_impact response block, this gives you an auditable record of the carbon footprint of every inference call.