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 — Tag your calls with department and feature

GL codes are assigned by mapping, not by a per-call header — Cognocient maps X-Cost-Department values to GL accounts, so make sure your calls already carry X-Cost-Department (and X-Cost-Feature, which appears in the export as project_code):

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",
    }
)
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",
  },
});

There is no X-Cost-GL-Account call header that feeds the chargeback export — GL codes are assigned centrally per department in Step 2, not per call.

Step 2 — Map each department to a GL account

Go to Chargeback → GL Mappings. For each department value you use in X-Cost-Department, add a mapping to a GL account code and name (e.g. customer-success6420 / "Software & SaaS"). Every call tagged with that department automatically picks up the mapped GL code in the export — no per-call configuration needed.

Step 3 — Generate the chargeback report

Go to Chargeback → Department Breakdown, pick the billing month, and export. The generic CSV export contains:

ColumnWhat it contains
dateCall date
departmentFrom X-Cost-Department
project_codeFrom X-Cost-Feature
gl_accountMapped GL account code
gl_account_nameMapped GL account name
amount_usdAggregated cost
descriptionLine-item description

There's no separate Provider or Token Volume column in this export — if you need per-provider or token-level detail, use the FOCUS export or the API Call Log instead.

Step 4 — Export for your accounting system

FOCUS export — Click Download FOCUS CSV on the Chargeback page. Cognocient's FOCUS export currently targets FOCUS 1.2 on a best-effort basis (not a certified 1.1 or 1.2 conformance claim). The department maps to the FOCUS SubAccountId field; the GL account code itself appears in a custom x-cog-gl-account tag column, not SubAccountId.

There is no separate PDF chargeback export today — CSV (generic or FOCUS) is the only chargeback export format.

Scheduled delivery — Go to Reports → Scheduled Delivery to have an AI ROI Summary or Full Detail Report emailed automatically each month. This is a general spend/ROI report, not a GL-coded chargeback document — for the GL-coded breakdown, export the CSV from the Chargeback page directly each period.

Done

Finance now has AI spend pre-coded by GL account via department mappings — 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