Token Meter
While a response streams, its speed reads large in the 5 x 7 dot face with a dot sparkline of it over the request beside it, and a line of figures under it: the model, the time to the first token, the tokens so far and, given prices, what it's cost. When the response finishes the meter settles on its average speed. Feed it the running token count as it streams.
Needs: None. Canvas 2D. You pass the counts from your streaming client.
Customize
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| tokens | number | required | Output tokens so far. |
| inputTokens | number | 0 | Tokens in the prompt, for the cost. |
| startedAt | number | – | When the request was sent, in ms. |
| firstTokenAt | number | – | When the first token arrived, in ms. |
| done | boolean | false | The response has finished. |
| price | { input: number; output: number } | – | Dollars per million tokens, for the cost. |
| model | string | – | The model's name, first on the line of figures. |
| tone | string | – | The speed and its sparkline. The page's accent by default. |
| pitch | number | 3 | Size of one dot in px. |
| className | string | – | Class on the meter. |
| style | CSSProperties | – | Style on the meter. |