sema-docs 1.23.0

Canonical structured documentation for Sema builtins/special forms; powers LSP hover/completion and REPL apropos
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
---
name: "llm/last-usage"
module: "llm"
params: []
returns: "map or nil"
---

Return token usage for the most recent LLM call as a map with `:prompt-tokens`, `:completion-tokens`, `:total-tokens`, `:model`, and (when pricing is known) `:cost-usd`. Returns nil if no call has been made yet.

```sema
(llm/complete "hi")
(llm/last-usage)   ; => {:prompt-tokens 8 :completion-tokens 12 :total-tokens 20 :model "..."}
```