Table of contents
Official Content
  • This documentation is valid for:

As of version 2026-04, Glob.AI OS Chat API usage payload has evolved from a simple total-cost summary into a richer billing and token accounting format where:

  • Usage Cost Version 1 (V1) returns you the overall request cost.
  • Usage Cost Version 2 (V2) additionally also explains you the cost breakdown where detailed token categories are available.

V2 preserves the existing top-level cost fields for backward compatibility, while adding optional detail fields that show which token categories contribute to the final cost.

What V2 changes

  • Backward-compatible core fields remain:
    • prompt_cost
    • completion_cost
    • total_cost
  • Detailed cost data is now available under token_cost_details.
  • Model family now determines response shape conventions:
    • GPT models return an OpenAI-style usage shape.
    • Claude models return an Anthropic-style usage model normalized into the same OpenAI-compatible response format.
  • Token detail fields may include category-level data, such as cached token counts and cached token cost.

V1 format

In V1, pricing configuration and usage responses focus only on general token categories, making easy to answer, for example:

"How much does this request cost?"

but not:

"Why did it cost that amount?"

V1 cost configuration

Previously, model costs were configured using only basic token keys.


  {
    "key": "prompt_tokens",
    "value": number
  },
  {
    "key": "completion_tokens",
    "value": number
  },
  {
    "key": "total_tokens",
    "value": number
  }

V1 usage response

The response exposed token counts and overall costs but did not provide category-level billing details.

{
  "usage": {
    "prompt_tokens": number,
    "completion_tokens": integer,
    "total_tokens": integer,
    "currency": "string",
    "prompt_cost": number,
    "completion_cost": number,
    "total_cost": number
  }
}

V1 does not expose details such as:

  • cache read cost
  • cache creation cost
  • cached token cost

V2 format

V2 keeps the familiar top-level usage and cost fields, then adds optional nested structures for more detailed token accounting.

Common ideas in V2

  • completion_tokens_details can expose completion-side details such as reasoning_tokens.
  • prompt_tokens_details can expose prompt-side details such as cached_tokens.
  • token_cost_details contains cost-related details for specific token categories, such as cached_tokens_cost.

Implementation guidance: Treat the new detail objects as optional. You should continue to rely on top-level totals as the canonical backward-compatible fields, and only read nested detail fields when present.

V2 Response Sample for GPT models

GPT-family models return the OpenAI-style usage structure with added detail fields.

{
  "usage": {
    "completion_tokens": integer,
    "prompt_tokens": integer,
    "total_tokens": integer,
    "currency": string,
    "completion_cost": number,
    "prompt_cost": number,
    "total_cost": number,
    "completion_tokens_details": {
      "reasoning_tokens": integer
    },
    "prompt_tokens_details": {
      "cached_tokens": integer
    },
    "token_cost_details": {
      "cached_tokens_cost": number,
      "cached_tokens": integer
    }
  }
}

V2 Repone Sample for Claude models

Claude-family models preserve Anthropic-style detail semantics, but the response is normalized into the same OpenAI-compatible outer shape. This makes downstream handling more consistent across model providers.

{
  "usage": {
    "completion_tokens": integer,
    "prompt_tokens": integer,
    "total_tokens": integer,
    "currency": string,
    "completion_cost": number,
    "prompt_cost": number,
    "total_cost": number,
    "completion_tokens_details": {
      "reasoning_tokens": integer
    },
    "prompt_tokens_details": {
      "cached_tokens": integer
    },
    "token_cost_details": {
      "cached_tokens_cost": number,
      "cached_tokens": integer
    }
  }
}

Field-by-field interpretation

Field Meaning Notes
prompt_tokens Total prompt-side tokens counted for the request Present in both V1 and V2
completion_tokens Total output tokens generated Present in both V1 and V2
total_tokens Combined prompt and completion tokens Present in both V1 and V2
prompt_cost Total billed prompt-side cost Backward-compatible top-level field
completion_cost Total billed completion-side cost Backward-compatible top-level field
total_cost Total billed request cost Main field for billing summaries
completion_tokens_details.reasoning_tokens Subset of completion tokens used for reasoning Optional detail field
prompt_tokens_details.cached_tokens Subset of prompt tokens served from cache Optional detail field
token_cost_details.cached_tokens_cost Cost attributed to cached tokens Optional detailed billing field
token_cost_details.cached_tokens Detailed token count tied to the billed cached category Useful for audits and billing analysis

V1 vs V2 comparison

{
  "prompt_cost": number,
  "completion_cost": number,
  "total_cost": number
}
{
  "prompt_cost": number,
  "completion_cost": number,
  "total_cost": number,
  "token_cost_details": {
    "cached_tokens_cost": number,
    "cached_tokens": integer
  }
}

Availability

Since version 2026-04

Last update: 2026 | © Globant S.A. All rights reserved.