1. Set up
- Gateway
- Telemetry
Turn on the Without the SDK, set the same values on each request yourself: see the gateway’s Weflayr fields.
x-weflayr-metadata header once: every gateway call, made by any OpenAI client, then carries the values of the scope it is made in.2. Tag the feature run and name its calls
Wrap the feature inpropagate_metadata / propagateMetadata: every LLM call made inside, including nested ones, carries its values, and the scope is one feature run, which AI cost counts and prices. Inside it, set_call_name / setCallName names each call.
feature_name: the product feature making the calls.customer_name: who the calls are for, to join your AI cost with your revenue.call_name: one LLM call of the feature. A benchmark is set up per call name.
- Gateway
- Telemetry
3. Keep one run across processes
Each scope starts a new feature run. When one run spans several processes, for example the ticket classified by your API and the reply drafted by a worker, the two scopes would count as two runs. Create the run’s id once where it starts, send it along with the work, and pass it to every scope of the run.- Gateway
- Telemetry
create_feature_run_uuid / createFeatureRunUuid gives: 32 lowercase hexadecimal characters.