Function: gptel--format-token-usage

gptel--format-token-usage is a natively compiled function defined in gptel.el.

Signature

(gptel--format-token-usage TOKEN-PLIST)

Documentation

Format TOKEN-PLIST (token usage) for display.

Source Code

;; Defined in /nix/store/q3r7g81pvghw7a523kjk2k2zih3pfk8z-emacs-packages-deps/share/emacs/site-lisp/elpa/gptel-20261002.545/gptel.el
(defun gptel--format-token-usage (token-plist)
  "Format TOKEN-PLIST (token usage) for display."
  (when token-plist
    (let ((input (plist-get token-plist :input))
          (output (plist-get token-plist :output))
          (cached (plist-get token-plist :cached)))
      (concat
       "[" (and input
                (concat (file-size-human-readable input 'si)
                        (and (numberp cached) (/= cached 0)
                             (format ", C%s"
                                     (file-size-human-readable cached 'si)))
                        "↑"))
       (and output (concat " " (file-size-human-readable output 'si) "↓")) "]"))))