---
title: "Discussion on \"Calculate OpenAI usage for Chat Completion API stream in NodeJS\" | Hashnode"
description: "Discussion on \"Calculate OpenAI usage for Chat Completion API stream in NodeJS\". Introduction\nOpenAI does have the usage field in its non-stream response.\nFor example with a non-stream request like this (stream: false):\n{\n    \"model\": \"gpt-3.5-turbo\",\n    \"messages\": [\n        {\n            \"role\": \"user\",\n            \"content\": ..."
url: "https://hashnode.com/posts/calculate-openai-usage-for-chat-completion-api-stream-in-nodejs/6519009d0d7c53d5b12024cc"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Calculate OpenAI usage for Chat Completion API stream in NodeJS](https://anvodev.hashnode.dev/calculate-openai-usage-for-chat-completion-api-stream-in-nodejs?utm_source=hashnode&utm_medium=feed)

Introduction OpenAI does have the usage field in its non-stream response. For example with a non-stream request like this (stream: false): { "model": "gpt-3.5-turbo", "messages": \[ { "role": "user", "content": ...

Oct 1, 2023 · 6 min read · anvodev.hashnode.dev  
Read the article

-   [#openai](https://hashnode.com/tag/openai)
-   [#tiktoken](https://hashnode.com/tag/tiktoken)
-   [#tokenusage](https://hashnode.com/tag/tokenusage)

## Written by

[An Vo](https://hashnode.com/@anvodev)

@anvodev · Ho Chi Minh, Vietnam

  
[View profile](https://hashnode.com/@anvodev)

Software Engineer

Learn | Build | Share

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
