Skip to content

johnalbertini14-glitch/openclaw-skills / skills/0x5446/ohmytoken-tracker

ohmytoken-tracker

Verified

FileKindSize
README.mdmarkdown1.0 KB
SKILL.mdskill md3.3 KB
_meta.jsonconfig464 B
claw.jsonconfig388 B
clawhub.jsonconfig710 B
instructions.mdmarkdown898 B
src/index.tsscript1.3 KB

src/index.ts

View on GitHub
interface 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
      }
    },
  }
}
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: 198kUpdated Claude CodeCodexVerifiedInstall
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: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
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: 194kUpdated Claude CodeCodexVerifiedInstall