How-to Guides

How do I map AI spend to GL accounts?

Tag every AI call with a GL account code so finance can process it automatically. Takes 10 minutes to set up — after which chargeback reports arrive pre-coded for your accounting system.

Goal: Every AI API call automatically attributed to the correct General Ledger account, with a monthly chargeback report finance can import directly.

Prerequisites: Cognocient proxy key in place, at least one application making calls through the proxy.


Step 1 — Add the GL account header to your calls

Add X-Cost-GL-Account to every API call. Use your organisation's existing GL code — the same code that appears on your expense reports and invoices.

response = client.chat.completions.create(
    model="gpt-4o-mini",
    messages=[{"role": "user", "content": user_message}],
    extra_headers={
        "X-Cost-Feature":    "ticket-resolver",
        "X-Cost-Department": "customer-success",
        "X-Cost-GL-Account": "6420",          # Software & SaaS spend
    }
)
const response = await openai.chat.completions.create({
  model: "gpt-4o-mini",
  messages: [{ role: "user", content: userMessage }],
  headers: {
    "X-Cost-Feature":    "ticket-resolver",
    "X-Cost-Department": "customer-success",
    "X-Cost-GL-Account": "6420",
  },
});

If different features charge to different GL accounts, add the header conditionally in the function that wraps your AI calls.

Step 2 — Tag historical calls (optional)

If you want historical GL attribution without changing code for every call site, set a default GL account on your proxy key instead. Go to Settings → API Keys, click your key, and set a Default GL Account. Every call from that key inherits the account unless the call overrides it with its own header.

Default GL accounts on proxy keys work well for single-GL-code teams. If your org has multiple GL codes across features, you need per-call headers (Step 1) rather than a key-level default.

Step 3 — Generate the chargeback report

Go to Dashboard → Chargeback. Select your billing period and click Generate Report. The report shows:

ColumnWhat it contains
GL AccountThe code you passed in X-Cost-GL-Account
DepartmentFrom X-Cost-Department
FeatureFrom X-Cost-Feature
Total SpendAggregated cost for the period
ProviderOpenAI / Anthropic / etc.
Token VolumeInput + output tokens

Step 4 — Export for your accounting system

FOCUS 1.1 export — Click Export → FOCUS 1.1 on the Chargeback page. The resulting CSV is compatible with CloudZero, Apptio, and any BI tool. The GL account code appears in the SubAccountId field per the FOCUS specification.

PDF chargeback — Click Export → PDF for a formatted report you can send to finance as an email attachment. The GL code breakdown appears as a separate section.

Scheduled delivery — Go to Reports → Scheduled and configure monthly delivery. Finance receives the chargeback PDF on the first of each month without anyone manually triggering it.

Done

Finance now receives a monthly report with AI spend pre-coded by GL account. No manual categorisation, no spreadsheet assembly.

Once GL attribution is working, set up budget enforcement per GL account or department to prevent overspend before it reaches the bill.

On this page