MCPcopy Create free account
hub / github.com/FSoft-AI4Code/CodeWiki / mask_api_key

Function mask_api_key

codewiki/cli/utils/validation.py:232–250  ·  view source on GitHub ↗

Mask API key for display, showing only first and last few characters. Args: api_key: API key to mask visible_chars: Number of visible characters at start and end Returns: Masked API key (e.g., "sk-1234...5678")

(api_key: str, visible_chars: int = 4)

Source from the content-addressed store, hash-verified

230
231 Returns:
232 True if top-tier, False otherwise
233 """
234 top_tier_models = [
235 "claude-opus",
236 "claude-sonnet",
237 "gpt-4",
238 "gpt-5",
239 "gemini-2.5",
240 ]
241
242 model_lower = model.lower()
243 return any(tier in model_lower for tier in top_tier_models)
244
245
246def mask_api_key(api_key: str, visible_chars: int = 4) -> str:
247 """
248 Mask API key for display, showing only first and last few characters.
249
250 Args:
251 api_key: API key to mask
252 visible_chars: Number of visible characters at start and end
253

Callers 1

config_showFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected