Launching a SaaS?·Collect waitlist signups before you build — before.run
SandboxPatternsDetectDocsChangelog
Dev Tools
#openai
#api
#key
#ai

OpenAI API Key

Validates OpenAI API keys, specifically supporting the standard project keys starting with 'sk-proj-'.

API billing key validationBackend auth config validationSaaS AI integrations
/
/
Safe
Test String
3 matches
ss's' — literal character
kk'k' — literal character
--'-' — literal character
pp'p' — literal character
rr'r' — literal character
oo'o' — literal character
jj'j' — literal character
--'-' — literal character
[…]{40,100}Character class […]Matches any single character listed in this set — repeated between 40 and 100 times · {40,100} — between 40 and 100 times
a-za-za-z — range from 'a' to 'z'
A-ZA-ZA-Z — range from 'A' to 'Z'
0-90-90-9 — range from '0' to '9'
Pattern: 27 charsInput: 170 chars
100% client-side · private

Valid Examples

  • sk-proj-aBcDeFgHiJkLmNoPqRsTuVwXyZ1234567890aBcDeFgH
  • sk-proj-12345678901234567890123456789012345678901234
  • sk-proj-AbCdEfGhIjKlMnOpQrStUvWxYz1234567890AbCdEfGhIjKlMnOpQrSt

Invalid Examples

  • sk-proj-short
  • sk-api-key
  • sk-proj-!invalid-characters!
  • sk-proj-with spaces inside the key 123

Usage & Integration

Validate OpenAI API Key natively in your backend or frontend without copying regex strings.

Node / Edge

import { validate } from '@regexto/validators';

validate('openai-api-key', '...');

Python

from regexto_validators import validate

validate("openai-api-key", "...")

Go

import "github.com/regex-to/validators-go"

valid, err := validators.Validate("openai-api-key", "...")

PHP

use RegexTo\Validators\Validator;

Validator::validate('openai-api-key', '...');

Rust

use regexto_validators::validate;

let is_valid = validate("openai-api-key", "...").unwrap();