johnalbertini14-glitch/openclaw-skills / skills/0x5446/ohmytoken-tracker
ohmytoken-tracker
Verified| File | Kind | Size |
|---|---|---|
| README.md | markdown | 1.0 KB |
| SKILL.md | skill md | 3.3 KB |
| _meta.json | config | 464 B |
| claw.json | config | 388 B |
| clawhub.json | config | 710 B |
| instructions.md | markdown | 898 B |
| src/index.ts | script | 1.3 KB |
src/index.ts
View on GitHubinterface OhmyTokenConfig {
api_key: string
endpoint?: string
}
interface TokenUsage {
model: string
prompt_tokens: number
completion_tokens: number
reasoning_tokens?: number
cached_tokens?: number
}
const DEFAULT_ENDPOINT = 'https://api.ohmytoken.dev/api/v1/ingest'
export default function ohmytokenTracker(config: OhmyTokenConfig) {
const apiKey = config.api_key || process.env.OHMYTOKEN_API_KEY
const endpoint = config.endpoint || DEFAULT_ENDPOINT
if (!apiKey) {
console.warn('[ohmytoken] No API key configured. Set OHMYTOKEN_API_KEY or config.api_key')
return {}
}
return {
name: 'ohmytoken-tracker',
async onLLMResponse(usage: TokenUsage) {
try {
await fetch(endpoint, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-API-Key': apiKey,
},
body: JSON.stringify({
model: usage.model || 'unknown',
prompt_tokens: usage.prompt_tokens || 0,
completion_tokens: usage.completion_tokens || 0,
reasoning_tokens: usage.reasoning_tokens || 0,
cached_tokens: usage.cached_tokens || 0,
}),
})
} catch {
// silent fail — don't break the user's workflow
}
},
}
}
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |