#!/bin/sh # Ganivra seat check: what your Claude Code and Codex usage would cost at API prices, next to your plan. # # curl -fsSL https://ganivra.com/check.sh | sh # curl -fsSL https://ganivra.com/check.sh | sh -s -- --claude-plan max --days 30 # # Downloads check.py and runs it with Python 3. It reads the logs Claude Code and Codex keep on this # machine and uses only token counts, model names, times and folder names; nothing is sent anywhere # except a request for the public price list. Read it first if you like: https://ganivra.com/check.py set -eu SITE=${GANIVRA_SITE:-https://ganivra.com} has() { command -v "$1" >/dev/null 2>&1; } has curl || { echo "ganivra check: curl is required" >&2; exit 1; } PY="" for candidate in python3 python; do has "$candidate" || continue # On a Mac without developer tools, /usr/bin/python3 only opens an installer. if [ "$(uname -s)" = Darwin ] && [ "$(command -v "$candidate")" = /usr/bin/python3 ] && ! xcode-select -p >/dev/null 2>&1; then continue; fi if "$candidate" -c 'import sys; sys.exit(0 if sys.version_info >= (3, 8) else 1)' >/dev/null 2>&1; then PY=$candidate; break; fi done [ -n "$PY" ] || { echo "ganivra check: needs Python 3.8 or later. On a Mac, run: xcode-select --install" >&2; exit 1; } tmp=$(mktemp "${TMPDIR:-/tmp}/ganivra-check.XXXXXX") trap 'rm -f "$tmp"' EXIT INT TERM curl -fsSL "$SITE/check.py" -o "$tmp" || { echo "ganivra check: couldn't download $SITE/check.py" >&2; exit 1; } head -n 1 "$tmp" | grep -q '^#!/usr/bin/env python3' || { echo "ganivra check: unexpected download from $SITE/check.py" >&2; exit 1; } "$PY" "$tmp" "$@"