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 wires up the Hicap client and starts tagging requests so usage and spend roll up the way the rest of 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 prompt defaults to a sensible starter set.

Master prompt

Copy this into your agent. It covers Hicap setup and base attribution in one pass.

Focused prompts

Prefer smaller steps? Run these in order — each is safe to hand over on its own.

After the agent runs

  • Verify the header. Confirm each request sends a single x-hicap-tags header whose value is one JSON object. 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.