Skip to main content
Eden AI makes decisions on your behalf on every request: which provider serves a model sold by several, which region it runs in, whether to retry elsewhere when one fails, and whether to use your own provider key. None of that is visible in a normal response, because the answer looks the same whoever produced it. Send the x-edenai-metadata header to have Eden AI attach what it decided.

Enabling it

cURL
The value is case-insensitive. Any value other than enabled, including disabled, is treated as off.
The block is absent unless you ask for it, and adding the header changes nothing else: the rest of the response is identical. It is safe to enable per request, for a subset of traffic, or only while debugging.

What you get

The response gains one extra top-level key, edenai_metadata:

Strategy values

strategy tells you how much Eden AI chose for you:

Tags

tags lists the tags recorded for the call, merged from the API key’s default tags, the X-EdenAI-Tags header and the tags body field, with keys in lowercase. It is {} when the call has none.

Reading it on a stream

For streaming requests the block rides the first chunk, not the last. Routing is settled before the first token is generated, so the answer is already known, and putting it first means you get it even from providers that never send a terminal usage chunk.
If a stream fails partway through, the error frame carries a corrected block. The retry that happened after the first chunk would otherwise leave you holding a report that says the request succeeded. Read the block from the first chunk, and let a later error frame overwrite it.

What it is useful for

  • Confirming which provider answered. With provider routing the seller varies per request; summary and attempts name the one that produced your tokens.
  • Explaining a slow or failed request. attempts records every provider tried with its status, so a retry is visible rather than inferred from latency.
  • Verifying BYOK. is_byok confirms your own key was used, without reading a bill.
  • Verifying data residency. region reports where the request was actually served, not merely what you asked for.
  • Attributing cost. The provider in attempts is the one you were billed for.
  • Checking your tags. tags shows exactly what was recorded for your usage breakdown, after the key’s default tags, the header and the body are merged.

Scope

The block is also omitted when the response is served from cache, because no provider was called for it.

Universal AI

Universal AI never ranks sellers: you name the provider and, optionally, fallbacks. The block has no strategy or endpoints, and reports mode instead:
The other fields, including tags, mean the same as above. A failed attempt reports the provider’s own status, even though Universal AI always answers HTTP 200 with "status": "fail".

Next Steps

Provider Routing

How the provider in attempts was chosen

Fallback

Name your own backup models

BYOK

Use your own provider keys

Monitoring

Account-level consumption and credits