OpenRouter API Key
Detects OpenRouter API keys, which start with sk-or-v1- followed by 64 lowercase hexadecimal characters. OpenRouter is a gateway to many model providers behind one key, so a leaked key lets someone else run billed inference against every model the account can reach. OpenRouter's management keys use the same format and are matched too.
- Type
- regex
- Engine
- universal
- Confidence
- high
- Confidence justification
- High confidence: OpenRouter's authentication documentation states the format exactly (sk-or-v1- plus 64 lowercase hexadecimal characters, 73 in total), and TruffleHog's production detector pins the same structure independently. The prefix is vendor-specific and the body length is fixed, so a chance match is not realistic. The enforce tiers still ask for a nearby OpenRouter or API-key term, and a single key stops at 75.
- Jurisdictions
- global
- Regulations
- Criminal Code Act 1995 (Cth)
- Frameworks
- CIS Controls, ISO 27001, NIST CSF, SOC 2
- Data categories
- credentials, security
- Scope
- narrow
- Risk rating
- 8
- Platform compatibility
- Purview: Compatible, GCP DLP: Unsupported, Macie: Unsupported, Zscaler: Compatible, CrowdStrike DLP: Unsupported, Palo Alto: Unsupported, Netskope: Unsupported
Pattern
(?-i)(?<![A-Za-z0-9_-])(sk-or-v1-[0-9a-f]{64})(?![A-Za-z0-9_-])
Corroborative evidence keywords
openrouter, openrouter.ai, OPENROUTER_API_KEY, api key, api_key, apikey, access key, access token, auth token, authorization, bearer, conn str, connection string, connectionstring, cookie, credential, database, host, [object Object], oauth (+36 more)
Proximity: 300 characters
Should match
sk-or-v1-0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef— Bare OpenRouter key (sk-or-v1- plus 64 lowercase hex); 65 discovery tierOPENROUTER_API_KEY=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— Labelled key in an env assignment; 75 tierAuthorization: Bearer sk-or-v1-abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789 (openrouter.ai)— Key in a bearer header next to the OpenRouter host name; 75 tierOpenRouter API keys: sk-or-v1-0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef 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— Two distinct OpenRouter API Key values in one file with context; the 85 tier needs two distinct tokens (one token, or the same token repeated, stays below 85)
Should not match
OPENROUTER_API_KEY=sk-or-v1-0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcde— Body one character short (63 hex characters) despite the OpenRouter labelOPENROUTER_API_KEY=sk-or-v1-0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0— Body one character long (65 hex characters) despite the OpenRouter labelOPENROUTER_API_KEY=sk-or-v1-0123456789abcdefghij0123456789abcdefghij0123456789abcdefghij0123— Body of the right length that is not hexadecimal (contains g-j)openrouter api key sk-or-v2-0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef— Wrong version segment in the prefix (v2); no such format is documentedrotate the openrouter api key before deployment— Prose mention without a key valuetemplate example placeholder record identifier— Template/sample context should be excluded even when anchor words are present
Known false positives
- Keys that have already been deleted. OpenRouter is a GitHub secret-scanning partner and tells the owner when a key is found exposed, so a key copied from a public repository may be dead by the time it is seen. Mitigation: The pattern cannot test validity. Treat a match in internal content as live until the key is confirmed deleted in the OpenRouter account.
- Made-up keys in SDK documentation and tests that copy the real prefix and length. Mitigation: The template-exclusion dictionary suppresses values framed as examples or placeholders; a single key also needs an OpenRouter or API-key term to reach 75.
- Overlap with detectors for other sk- prefixed provider keys (OpenAI, Anthropic). Mitigation: None needed for the catalogue's own patterns. Their regexes require a different segment straight after sk- (48 alphanumerics, proj-, svcacct-, admin- or ant-), which sk-or-v1- does not satisfy, so they do not co-fire.
References
- OpenRouter API authentication documentation (key format is sk-or-v1- followed by 64 lowercase hexadecimal characters, 73 in total; management keys use the same format; OPENROUTER_API_KEY variable; OpenRouter is a GitHub secret-scanning partner)
- TruffleHog production OpenRouter detector (sk-or-v1-[0-9a-f]{64}, keyword sk-or-v1-)