Detects where the active Anthropic API key is sourced from.
// Source: https://github.com/Yeachan-Heo/oh-my-claudecode | License: MIT | Copyright 2025 Yeachan Heo
// Provided via justclaw.it.com; keep this notice with the code.
/**
* OMC HUD - API Key Source Element
*
* Detects and renders where the active ANTHROPIC_API_KEY comes from:
* - 'project': set in .claude/settings.local.json (project-level)
* - 'global': set in ~/.claude/settings.json (user-level)
* - 'env': present only as an environment variable
*
* Never displays the actual key value.
*/
import { existsSync, readFileSync } from 'fs';
import { join } from 'path';
import { dim, cyan } from '../colors.js';
import { getClaudeConfigDir } from '../../utils/config-dir.js';
export type ApiKeySource = 'project' | 'global' | 'env';
/**
* Check whether a settings file defines ANTHROP
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key