Skip to content

AI Assistant

The extractor assistant helps you turn a natural language description of your raw event into extractor configuration JSON.

Use it when you know the event shape but do not want to write the extractor JSON from scratch.

  1. Open Rules.
  2. Select Create extractor draft.
  3. Select Ask assistant.
  4. Describe the event shape, subject, dimensions, metrics, and prices.
  5. Select Generate config.

The generated JSON replaces the extractor draft editor. Review it before creating the draft.

Good prompts name the exact fields in the raw event.

Include:

  • the subject field, such as meta.user_id, workspace_id, or api_key_id;
  • dimensions you want on every usage event, such as provider, model, plan, or region;
  • charge item metrics, such as input tokens, output tokens, requests, workflow runs, or tool calls;
  • units and pricing when known;
  • whether sparse dynamic metrics will be reported through x-billing.
Our raw event has meta.user_id, provider, usage.model,
usage.prompt_tokens, and usage.output_tokens.
Use meta.user_id as the subject.
Keep provider and usage.model as dimensions.
Create prompt_tokens and output_tokens charge items in unit tokens.
Bill prompt tokens at 2.00 USD per 1M tokens and output tokens at 8.00 USD per 1M tokens.
Also add one request item.

Always review generated JSON before saving it.

Check:

  • paths match the real raw event;
  • metric names are stable;
  • units are consistent;
  • pricing currency and scale are correct;
  • subject type and subject ID match the account routing model you plan to use.

If the result is close but not exact, edit the JSON in the draft editor and create the draft after review.