Skip to main content
This page gives you a prompt you can hand to a coding agent — GitHub Copilot, or any agent that can read and edit your repository — to add a working base attribution setup to your application. It scans the whole application, distinguishes ordinary traffic from model calls, assesses existing client tags, and wires up evidence-backed attribution using agent, env, system, feature, and domain. Structural usage and spend still roll up as the Concepts pages describe. Start with the master prompt for a complete pass, or use the focused prompts to do it one step at a time.
These prompts describe the outcome, not a fixed set of edits. Review the agent’s changes like any other pull request — where things land depends on how your codebase is structured.

Before you start

The agent will need a few things to be true. You can either set these up first or let the prompt ask you for them:
  • A Hicap API key. Create one in the Hicap Platform dashboard ↗ and make it available as the HICAP_API_KEY environment variable. The agent should never hard-code it.
  • The base URL and auth header. Requests go to https://api.hicap.ai/v1, and the key is sent as the api-key header. Any OpenAI-compatible SDK works — see the Developer Quickstart.
  • A sense of your dimensions. Decide which labels you want to slice spend by. See Tags, Dimensions & Segments for the model; the prompts assess five starter dimensions, reuse approved application conventions, and distinguish missing instrumentation from intentionally non-applicable values.

Master prompt

Copy this short instruction into your agent. It will read the full prompt from a dedicated page and help you set up Hicap and attribution in your application repository. Use the copy button to copy only the instruction below. The linked page contains the full, maintained implementation prompt.
Master prompt
Review the full prompt.

Focused prompts

Prefer smaller steps? Run these in order — each is safe to hand over on its own.
Client setup
Review the full prompt.
Tagging helper
Review the full prompt.
Base dimensions
Review the full prompt.
Per-call features
Review the full prompt.

After the agent runs

Review the emitted tags for real workflows, not only whether a helper exists. A valid tags header can still omit a named agent role. After deployment, inspect fresh traffic in the correct application and environment; a 30-day chart can still include older untagged requests.
  • Review coverage and evidence. Check the whole-app inventory, separate ordinary traffic from AI call sites, and review every deferred or unresolved path. Zero model calls is a valid finding; a prepared client is not proof of live attribution.
  • Review all five dimensions. Confirm agent, env, system, feature and domain definitions and sources. Reuse approved application conventions and distinguish missing values from dimensions that do not apply. Preserve compatible existing dimensions and review any migration.
  • Verify the header. Confirm each model request sends a single x-hicap-tags header whose value is one JSON object of strings; check safe merge precedence, privacy, concurrency and queued/retried context. Unknown assessment values must not become JSON null. See How tags are sent.
  • Check for untagged traffic. Requests that arrive without your expected dimensions surface as Unattributed Traffic — a signal that a call site still needs the helper. See Segments.
  • Grow into segments. Once dimensions are flowing, define segments to slice spend without touching code again.

Developer Quickstart

The minimal client setup the prompts build on.

Tags, Dimensions & Segments

The attribution model these prompts implement.