Token usage in jsonl

Resolved 💬 4 comments Opened Sep 10, 2025 by vjain419 Closed Sep 30, 2025
💡 Likely answer: A maintainer (vjain419, contributor) responded on this thread — see the highlighted reply below.

What feature would you like to see?

add Token usage for each step / entry and overall chat in jsonl. I am creating a tool which will generate some report / dashboard and in order to be effective I want to have "token" usage per session feature and overall token usage.

Are you interested in implementing this feature?

I can if OAI team agree to look at PR on time.

Additional information

_No response_

View original on GitHub ↗

4 Comments

MaurUppi · 11 months ago

https://platform.openai.com/docs/api-reference/responses/object

{
  "id": "resp_67ccd3a9da748190baa7f1570fe91ac604becb25c45c1d41",
  "object": "response",
  "created_at": 1741476777,
  "status": "completed",
  "error": null,
  "incomplete_details": null,
  "instructions": null,
  "max_output_tokens": null,
  "model": "gpt-4o-2024-08-06",
  "output": [
    {
      "type": "message",
      "id": "msg_67ccd3acc8d48190a77525dc6de64b4104becb25c45c1d41",
      "status": "completed",
      "role": "assistant",
      "content": [
        {
          "type": "output_text",
          "text": "The image depicts a scenic landscape with a wooden boardwalk or pathway leading through lush, green grass under a blue sky with some clouds. The setting suggests a peaceful natural area, possibly a park or nature reserve. There are trees and shrubs in the background.",
          "annotations": []
        }
      ]
    }
  ],
  "parallel_tool_calls": true,
  "previous_response_id": null,
  "reasoning": {
    "effort": null,
    "summary": null
  },
  "store": true,
  "temperature": 1,
  "text": {
    "format": {
      "type": "text"
    }
  },
  "tool_choice": "auto",
  "tools": [],
  "top_p": 1,
  "truncation": "disabled",
  "usage": {
    "input_tokens": 328,
    "input_tokens_details": {
      "cached_tokens": 0
    },
    "output_tokens": 52,
    "output_tokens_details": {
      "reasoning_tokens": 0
    },
    "total_tokens": 380
  },
  "user": null,
  "metadata": {}
}
vjain419 contributor · 11 months ago

yes its present in oai response object but not in rollout jsonl

bl-ue · 11 months ago

Implemented in #1583

vjain419 contributor · 11 months ago

Thanks it address my requirement.