API Key Generator
Generate random test API keys in generic, OpenAI-style, Anthropic-style or GitHub-style formats with a custom prefix and length.
API Key Generator
Output
Working…What this tool does
Generate random, API-key-shaped strings for local development and testing, with presets that mimic OpenAI, GitHub, and Anthropic prefixes or your own. Each key uses the browser's Web Crypto CSPRNG over a 62-character alphabet and never leaves your device. Important: these are placeholder keys for fixtures and mocks — they carry no privileges and will not authenticate against any real API.
Updated . Provided as is. Check the output before you rely on it in production.
How to use API Key Generator
- 1
Pick a format
Choose Generic, OpenAI-style, GitHub-style or Anthropic-style keys.
- 2
Set prefix and length
For generic keys set your own prefix and the random length; provider styles use their standard prefix.
- 3
Generate
Keys are generated with the browser's Web Crypto random number generator.
- 4
Use them in tests
Copy the key into test fixtures or mock configuration. These keys are not valid credentials with any provider.
Questions and answers
Are the keys real?
How random are they?
Use it as an API
API Key Generator is also callable as a free HTTP JSON API at
https://aidevhub.io/api/api-key-generator/ — GET with query
parameters or POST with a JSON body, no authentication, CORS enabled, fair use
(abusive traffic is throttled at the edge; there is no per-request quota header). Responses return
{ ok, tool, result, meta }.
curl -s "https://aidevhub.io/api/api-key-generator/?prefix=sk-test-&length=32"
Machine-readable contract: /api/tool/api-key-generator.json All API endpoints: /agents/ LLM site index: /llms.txt
For AI agents: how to call this tool
Machine-readable contract, endpoints and examples. Humans can ignore this section.
Best Path For Builders
Dedicated API endpoint
Deterministic outputs, machine-safe contracts, and production-ready examples.
Dedicated API
https://aidevhub.io/api/api-key-generator/ OpenAPI: https://aidevhub.io/api/openapi.yaml
Unified Runtime API
https://aidevhub.io/api/tools/run/?toolId=api-key-generator&a=sk-test-
GET and POST are supported at /api/tools/run/ with identical validation and limits.
Limit: 60 req / 60s, input max 128 KB.
How do I generate a fake API key for testing?
Pick a format preset (or your own prefix), set a length, and generate. The result looks like a real provider key — same prefix and character set — but the random body is meaningless, so it is safe to drop into fixtures, seed data, mock server configs, and format-validation tests. The value is created in your browser and shown as JSON with its total length.
Step by step
- Choose a mode: Generic, OpenAI-style, GitHub-style, or Anthropic-style.
- For Generic, set a custom prefix; the others apply the provider's known prefix.
- Set the random length (8 to 128 characters; the default is 32).
- Copy the generated key into your test fixture or mock configuration.
Key format presets this generator produces
| Preset | Prefix | Shape |
|---|---|---|
| Generic | key_ (or your prefix) | key_<random> |
| OpenAI-style | sk-proj- | sk-proj-<random> |
| GitHub-style | ghp_ | ghp_<random> |
| Anthropic-style | sk-ant-api03- | sk-ant-api03-<random> |
Prefixes as this generator applies them for realistic test fixtures. The random body is Base62 (A–Z, a–z, 0–9) of length 8–128; it copies the shape of real keys but is not a valid credential.
How random are the generated keys?
The random body is drawn from the browser's Web Crypto getRandomValues, a cryptographically secure generator, using rejection sampling so every character in the 62-character alphabet is equally likely. It only falls back to Math.random if Web Crypto is unavailable. That is strong enough for unique, unpredictable test fixtures.
Can I match a specific provider's key format?
Use the matching preset for the prefix, or the Generic mode with your own prefix for an internal scheme. The reported length is the whole key — prefix plus the random body — so if a test asserts on total length, set the random length with that prefix in mind.
Are these safe to use, and does anything leave the browser?
Generation is fully client-side; no key is transmitted or logged. Because the keys are random placeholders they are safe to commit into test fixtures, but they must never be used as real credentials — and you should never paste a genuine production key into any generator. Treat every generated string as a stand-in, not a secret.