Skip to content

Conversation

hekike
Copy link
Contributor

@hekike hekike commented Oct 11, 2025

Cost

GET /api/v1/billing/invoices/{"invoiceId}/lines/{lineId}/cost?windowSize=HOUR

{
  "cost": "2.4",
  "costPerUnit": "0.0000119845997893",
  "currency": "USD",
  "from": "2025-10-11T16:36:43Z",
  "internalCost": "2.00257",
  "internalCostPerUnit": "0.8344041666666667",
  "margin": "0.39743",
  "marginRate": "0.1655958333333333",
  "rows": [
    {
      "cost": "1.1208477106944932",
      "costPerUnit": "0.0000119845997893",
      "groupBy": {},
      "internalCost": "0.93524",
      "internalCostPerUnit": "0.00001",
      "margin": "0.1856077106944932",
      "marginRate": "0.1655958333353672",
      "usage": "93524",
      "windowEnd": "2025-10-11T17:00:00Z",
      "windowStart": "2025-10-11T16:00:00Z"
    },
    {
      "cost": "1.2791522893113569",
      "costPerUnit": "0.0000119845997893",
      "groupBy": {},
      "internalCost": "1.06733",
      "internalCostPerUnit": "0.00001",
      "margin": "0.2118222893113569",
      "marginRate": "0.1655958333353672",
      "usage": "106733",
      "windowEnd": "2025-10-11T19:00:00Z",
      "windowStart": "2025-10-11T18:00:00Z"
    }
  ],
  "to": "2025-11-11T16:36:43Z",
  "usage": "200257"
}

Feature

GET /api/v1/features/ai_gpt_5_input_tokens

{
  "id": "01K7A229QEBS3HXA51BCVZ38TR",
  "key": "ai_gpt_5_input_tokens",
  "name": "GPT-5 Input Tokens",
  "costPerUnit": "0.00000125",
  "createdAt": "2025-10-11T16:36:06.510673Z",
  "meterSlug": "tokens_total",
  "meterGroupByFilters": {
    "model": "gpt-5",
    "provider": "openai",
    "type": "input"
  },
  "advancedMeterGroupByFilters": {
    "model": {
      "$eq": "gpt-5"
    },
    "provider": {
      "$eq": "openai"
    },
    "type": {
      "$eq": "input"
    }
  },
  "updatedAt": "2025-10-11T16:36:06.510673Z"
}

@hekike hekike requested a review from a team as a code owner October 11, 2025 18:29
@hekike hekike marked this pull request as draft October 11, 2025 18:29
Copy link
Contributor

coderabbitai bot commented Oct 11, 2025

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/invoice-cost-model-cost

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@hekike hekike added the release-note/feature Release note: Exciting New Features label Oct 11, 2025
@hekike hekike changed the title Feat/invoice cost model cost feat(invoice): cost, internal cost and margin Oct 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-note/feature Release note: Exciting New Features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant