# Does CodexBar Support Barcode Scanning? Understanding Usage Data Scanning

> CodexBar usage data scanning reads log files and databases, not visual barcodes. Learn how CodexBar processes AI provider records for analysis.

- Repository: [Peter Steinberger/CodexBar](https://github.com/steipete/CodexBar)
- Tags: how-to-guide
- Published: 2026-07-10

---

**CodexBar does not implement visual barcode scanning; instead, it performs usage data scanning by reading log files, SQLite databases, and network-generated records from AI providers like OpenAI and Anthropic.**

Contrary to what the name might suggest, **CodexBar** is a macOS menu-bar application focused on aggregating AI usage statistics and costs, not reading visual barcodes. According to the source code in `steipete/CodexBar`, every instance of "scan" terminology refers to parsing on-disk usage files rather than camera-based barcode detection. The architecture revolves entirely around ingesting, caching, and displaying token consumption data from various AI providers.

## What CodexBar Actually Scans

The application performs **usage scanning**, a file-system operation that locates and parses provider-specific consumption records. This process involves recursive directory traversal, JSONL parsing, and SQLite database reading to extract token counts and calculate associated costs.

The scanning workflow operates as follows:

- **ProviderStorageScanner** walks the file system to locate usage assets in provider-specific directories
- **CostUsageScanner** parses the discovered files and merges new entries into the data model
- **UsageStore** exposes observable properties that update the menu-bar UI with real-time cost calculations

No source files in the repository import `AVFoundation`, `Vision`, `CoreImage`, or any other Apple framework capable of camera access or visual barcode detection.

## The Usage Scanning Architecture

### UsageStore: The Central Data Hub

Located in [`Sources/CodexBar/UsageStore.swift`](https://github.com/steipete/CodexBar/blob/main/Sources/CodexBar/UsageStore.swift), the **UsageStore** class orchestrates all data fetching, caching, and refresh cycles. It provides a unified interface for pulling usage data from multiple providers while handling retries and background updates.

The store determines when fresh data is needed and delegates the actual scanning work to specialized components:

```swift
// Triggering a usage refresh from the status-item controller
await UsageStore.shared.refreshIfNeeded()

// Simplified implementation from UsageStore.swift
func refreshIfNeeded() async {
    guard needsRefresh else { return }
    await CostUsageScanner.shared.scanAllProviders()
}

```

### CostUsageScanner: Parsing Provider Files

The **CostUsageScanner** serves as the engine that reads provider-specific usage formats, including JSONL logs and SQLite databases. It is invoked either when the user opens the menu or on a timed interval, scanning on-disk files and merging new entries without blocking the main thread.

The scanner handles different provider formats through specialized parsing logic, ensuring that token counts from OpenAI, Anthropic, and Gemini are normalized into a consistent internal model.

### ProviderStorageScanner: File System Traversal

Before parsing can occur, the application must locate where providers store their usage data. The **ProviderStorageScanner** utility, tested in [`Tests/CodexBarTests/ProviderStorageFootprintTests.swift`](https://github.com/steipete/CodexBar/blob/main/Tests/CodexBarTests/ProviderStorageFootprintTests.swift), recursively walks directory trees while skipping symlinks and gracefully handling missing paths:

```swift
// Example: Scanning for provider storage footprints
let footprint = ProviderStorageScanner()
    .scan(provider: .codex, candidatePaths: [root.path])

```

This component ensures robust discovery of usage assets regardless of where AI providers write their logs on the local file system.

## Cost Calculation and UI Extensions

Once raw usage data is scanned, provider-specific extensions translate token counts into human-readable costs. Files like `Sources/CodexBar/UsageStore+TokenCost.swift`, `UsageStore+OpenAIWeb.swift`, and `UsageStore+ClaudeDebug.swift` contain the logic for converting raw numbers into hourly charts and monetary values displayed in the menu bar.

These extensions process data that originated from the scanning components, creating a pipeline that moves from file-system discovery (`ProviderStorageScanner`) through parsing (`CostUsageScanner`) to presentation (`UsageStore` extensions).

## Why There Is No Barcode Scanning Feature

A comprehensive review of the codebase confirms the absence of visual barcode capabilities:

- No camera permission requests or privacy strings in the bundle configuration
- No imports of `AVCaptureDevice`, `VNDetectBarcodesRequest`, or related APIs
- No test files referencing barcode processing or image recognition
- All "scan" terminology appears exclusively in the context of usage file ingestion

The application's narrow focus on AI provider data ingestion means it has no dependency on computer vision frameworks or hardware camera access.

## Summary

- **CodexBar** does not support visual barcode scanning despite the "Bar" in its name referring to the macOS menu bar.
- The application implements **usage scanning** through three core components: `UsageStore` for data coordination, `CostUsageScanner` for parsing provider files, and `ProviderStorageScanner` for file-system discovery.
- All scanning logic focuses on reading local log files, SQLite databases, and network records from AI providers.
- The source code contains no references to `AVFoundation`, `Vision`, or camera-related frameworks.
- Usage data flows from file-system scanning through provider-specific extensions that calculate costs and update the menu-bar UI.

## Frequently Asked Questions

### Does CodexBar support camera-based barcode scanning?

No. CodexBar contains no code for accessing the camera or processing visual barcodes. The application does not import `AVFoundation` or `Vision` frameworks, and there are no image processing capabilities in the repository. The term "scan" exclusively refers to reading AI usage logs from the local file system.

### What type of scanning does CodexBar actually perform?

CodexBar performs **usage data scanning**, which involves recursively searching directories for provider-specific log files, parsing JSONL and SQLite formats, and extracting token consumption metrics. This process is handled by the `CostUsageScanner` and `ProviderStorageScanner` classes, not by any optical recognition system.

### How does CodexBar gather usage data from AI providers?

The application relies on local file scanning rather than API calls. The `ProviderStorageScanner` locates where providers like OpenAI or Anthropic store their debug logs and usage databases on disk. The `CostUsageScanner` then parses these files to extract token counts, which extensions like `UsageStore+TokenCost.swift` convert into monetary costs for display in the menu bar.

### Is CodexBar planning to add barcode scanning features in the future?

Based on the current architecture and the specific focus on AI usage aggregation, there is no indication in the source code or test suite that barcode scanning is planned. The application's design is tightly coupled to parsing structured usage data from AI providers, with no abstractions that would support optical barcode recognition.