Skip to content

Function: maskApiKey()

@providerprotocol/ai


@providerprotocol/ai / http / maskApiKey

maskApiKey(key): string

Defined in: src/http/keys.ts:165

Masks an API key for safe logging. Shows first 4 and last 4 characters with ellipsis, or ’***’ for short keys.

string

The API key to mask

string

Masked key like “sk-ab…yz12” or ”***” for short keys

maskApiKey('sk-abc123def456xyz789'); // 'sk-a...z789'
maskApiKey('short'); // '***'