### Display Help Information for tiktoken-cli Source: https://github.com/samber/tiktoken-cli/blob/main/README.md Access the help menu to see all available commands, options, and usage examples for tiktoken-cli. ```bash # Show help npx tiktoken-cli --help ``` -------------------------------- ### Using Globally Installed tiktoken-cli Source: https://github.com/samber/tiktoken-cli/blob/main/README.md Execute the globally installed tiktoken-cli command directly from the terminal. ```bash tiktoken-cli ./src/ ``` -------------------------------- ### Global Installation of tiktoken-cli Source: https://github.com/samber/tiktoken-cli/blob/main/README.md Install tiktoken-cli globally using npm for direct command-line access without npx. ```bash npm install -g tiktoken-cli ``` -------------------------------- ### Development Workflow for tiktoken-cli Source: https://github.com/samber/tiktoken-cli/blob/main/README.md Commands for setting up the development environment, running the tool in development mode, building, and publishing. ```bash # Install dependencies npm install # Run in development npx run dev -- ./README.md # Build npm run build # Publish npm publish ``` -------------------------------- ### Count Tokens in Files and Directories with tiktoken-cli Source: https://github.com/samber/tiktoken-cli/blob/main/README.md Use npx to run tiktoken-cli for counting tokens. Supports single files, recursive directory traversal, and multiple file inputs. ```bash # Count tokens in a single file npx tiktoken-cli ./README.md ``` ```bash # Count tokens in a directory (recursively) npx tiktoken-cli ./src/ ``` ```bash # Count tokens in multiple files npx tiktoken-cli ./README.md ./LICENSE ./package.json ``` -------------------------------- ### tiktoken-cli Exclude Pattern Anchoring Source: https://github.com/samber/tiktoken-cli/blob/main/README.md Demonstrates how to use anchored paths for exclude patterns, ensuring matches are relative to the current working directory. ```bash # Match by anchored path from current directory npx tiktoken-cli ./src/ --exclude ./src/generated/** ``` -------------------------------- ### Specify Model for Tokenization with tiktoken-cli Source: https://github.com/samber/tiktoken-cli/blob/main/README.md Use the --model flag to specify a particular OpenAI model for tokenization, ensuring accurate counts for different model contexts. ```bash # Use a specific model for tokenization npx tiktoken-cli --model gpt-4o ./README.md ``` -------------------------------- ### Exclude Files/Directories with tiktoken-cli Source: https://github.com/samber/tiktoken-cli/blob/main/README.md Specify patterns to exclude files or directories during token counting. Multiple exclude flags can be used. ```bash # Exclude a folder or file pattern npx tiktoken-cli ./src/ --exclude .github/ ``` ```bash npx tiktoken-cli --exclude .github/ ./src/ ``` ```bash npx tiktoken-cli --exclude .github/ --exclude tsconfig.json ./src/ ``` -------------------------------- ### tiktoken-cli Exclude Pattern Matching Anywhere Source: https://github.com/samber/tiktoken-cli/blob/main/README.md Shows how exclude patterns can match anywhere within the scanned paths when not anchored. ```bash # Match anywhere in scanned paths npx tiktoken-cli ./src/ --exclude tsconfig.json ``` ```bash npx tiktoken-cli ./src/ --exclude .github/ ``` ```bash npx tiktoken-cli ./src/ --exclude "**/*.md" ``` -------------------------------- ### Count Tokens from Standard Input with tiktoken-cli Source: https://github.com/samber/tiktoken-cli/blob/main/README.md Pipe content directly to tiktoken-cli via stdin for token counting. Useful for processing dynamic or streamed text. ```bash # Count tokens from stdin cat plop.txt | npx tiktoken-cli --model gpt-4o ``` ```bash echo "Hello world" | npx tiktoken-cli ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.