Home / Servers / OpenAI API / usage_costs

Costs

An MCP tool from the OpenAI API server, hosted on mcp.hjlabs.in.

Costs Get costs details for the organization. [GET /organization/costs]

Name on the gateway: openai_api__usage_costs · read-only.

Parameters

NameTypeDescription
start_time requiredintegerStart time (Unix seconds) of the query time range, inclusive.
end_timeintegerEnd time (Unix seconds) of the query time range, exclusive.
bucket_width1dWidth of each time bucket in response. Currently only 1d is supported, default…
project_idsarrayReturn only costs for these projects.
api_key_idsarrayReturn only costs for these API keys.
line_itemsarrayReturn only costs for these exact line item names. Each value must match the…
group_byarrayGroup the costs by the specified fields. Supported fields include project_id…
limitintegerA limit on the number of buckets to be returned. Limit can range between 1 and…
pagestringA cursor for use in pagination. Corresponding to the next_page field from the…

How to call it

Through the Smart Gateway, any client can run it by name with call_tool, or let the gateway find it with search_tools:

call_tool arguments
{
  "name": "openai_api__usage_costs",
  "arguments": {
    "start_time": 0
  }
}

Or connect the OpenAI API server directly, which lists 371 tools including this one:

Run in your terminal
claude mcp add --transport http hj-openai-api https://mcp.hjlabs.in/mcp/openai-api \
  --header "Authorization: Bearer YOUR_API_KEY"

Try asking

Use the costs tool with start_time set to ….

More from OpenAI API