Tools
Token Counter
Count tokens for a text string using the GPT tokenizer. Useful for estimating API costs.
Requires an API key. Run devv login <key> first.
Commands
devv tokens "Hello, how are you today?"
devv tokens "$(cat prompt.txt)"
cat long-prompt.txt | devv tokens
Examples
# Count tokens in a prompt
devv tokens "Explain quantum computing in simple terms"
# Count tokens in a file
cat system-prompt.txt | devv tokens
# Estimate cost before sending
devv tokens "$(cat my-prompt.txt)"
Output
Tokens: 7
Model estimates:
GPT-4: ~$0.0002 (input)
GPT-3.5: ~$0.00001 (input)
Pipeline Usage
| Pipeline ID | Description |
|---|---|
token-counter |
Count GPT tokens |
devv pipe exec "token-counter" "Hello, how are you?"
Behavior
Takes text as input, returns token count and cost estimates.
Was this page helpful?