Get an API key from your account code (and sign up through the API)
There are three different things here, and only the last two ever reach us.
- Account code, like
RJQDX-WM6PR-2QV5M-8BX5G: what you sign in with. Treat it like a password. Only you have it; never send it to us. - Account key, 64 characters of 0-9 and a-f, like
5d5e9236...: made from your account code on your device, and sent to us instead of it. We can’t get the code back from it. - API key, like
sk-obs1_...: goes inAuthorization: Beareron every API request.
The website and the apps make the account key for you. Through the API you make it yourself, and this page shows how.
The API itself doesn’t change. Every request carries your API key and works with any OpenAI- or Anthropic-compatible client. The account key is only for getting that API key, and for signing up.
The easy way: the Account page
Sign in at obscurify.ai/account and press Show API Key. Copy it into your tool. You never need the account key.
One command
In a terminal, with Node.js installed:
npx -y @obscurify/cli signup
It makes a new account code on your machine, signs up with its account key, and prints the code and your API key. Save the code: it’s the only way to sign in. Already have an account? This prints its API key (it asks for your code):
npx -y @obscurify/cli api-key
The tool is open source (Obscurify-ai/obscurify-cli, about 60 lines that matter), and its test checks that the code is never among the bytes it sends.
By hand
1. Turn your account code into its account key
The account key is two steps:
- Argon2id of the account code, upper case without dashes (
RJQDXWM6PR2QV5M8BX5G): saltobscurify-code-v1, 64 MiB of memory, 8 passes, 1 lane, 32 bytes out. It takes about a second on purpose. - HMAC-SHA256 of the word
login, keyed with those 32 bytes, written as 64 lower-case hex digits.
In Python (pip install argon2-cffi):
import hashlib, hmac, secrets, sys
from argon2.low_level import Type, hash_secret_raw
ALPHABET = "0123456789ABCDEFGHJKMNPQRSTVWXYZ" # no I, L, O or U
def new_account_code() -> str:
"""A new account code: 96 random bits and a 4-bit typo check."""
random = secrets.token_bytes(12)
check = hashlib.sha256(random).digest()[0] >> 4
bits = (int.from_bytes(random, "big") << 4) | check
code = "".join(ALPHABET[(bits >> (5 * k)) & 31] for k in range(19, -1, -1))
return "-".join(code[i:i + 5] for i in range(0, 20, 5))
def login_key(account_code: str) -> str:
"""The account key we get instead of the account code."""
bare = account_code.upper().replace("-", "").replace(" ", "")
bare = bare.replace("O", "0").replace("I", "1").replace("L", "1")
master = hash_secret_raw(bare.encode(), b"obscurify-code-v1", time_cost=8,
memory_cost=64 * 1024, parallelism=1, hash_len=32, type=Type.ID)
return hmac.new(master, b"login", hashlib.sha256).hexdigest()
if __name__ == "__main__":
code = sys.argv[1] if len(sys.argv) > 1 else new_account_code()
print("account code (keep it, never send it):", code)
print("account key (send this):", login_key(code))
Save it as obscurify_key.py and run python obscurify_key.py RJQDX-WM6PR-2QV5M-8BX5G with your own code:
account code (keep it, never send it): RJQDX-WM6PR-2QV5M-8BX5G
account key (send this): 5d5e923630b2d631d4a9adc0ed11d01d605bd03d862c3c2cf61cb70e099344d2
2. Get your API key
curl -X POST https://obscurify.ai/generate_token \
-H 'Content-Type: application/json' \
-d '{"account_key": "YOUR-ACCOUNT-KEY"}'
{"message": "This is your API key. You can get it again from your account code or number.",
"token": "sk-obs1_AbCd..."}
The API key is worked out from your account, not stored, so asking again gives the same key until you replace it.
3. Or sign up through the API
First make a new account code and its account key: run python obscurify_key.py with no argument. It prints both:
account code (keep it, never send it): EPMPT-6SKTZ-6H59Q-EANTK
account key (send this): 7f65aa0d27d66f10479ad93835cb98db262255e2b745bbe5482f7e727e8671ef
Write the account code down somewhere safe: it’s the only way to sign in, and we can’t show it to you again. Send only the account key:
curl -X POST https://obscurify.ai/create_account \
-H 'Content-Type: application/json' \
-d '{"accept_tos": true, "account_key": "YOUR-ACCOUNT-KEY"}'
Then get its API key with step 2. Sign in on the website with the code to add funds.
More than one API key
An account can have several API keys, one per tool say, so you can revoke one without touching the others. On the Account page, type a name and press New API Key. In a terminal:
npx -y @obscurify/cli api-key --name "Claude Code" # a new key, shown once
npx -y @obscurify/cli api-key --revoke KEY-ID # stop one key
By hand, POST /api_keys with {"name": "Claude Code", "account_key": "YOUR-ACCOUNT-KEY"} makes one, and POST /api_keys/KEY-ID/revoke with your account key revokes it. Making and revoking keys needs the account key, not an API key, so a leaked API key can’t make more. GET /api_keys, with any of your API keys, lists them all with when each was made and what it was used for.
What we refuse
If you send the account code itself (in account_number) instead of its account key, we refuse it with a 400 and never use it: your code should only ever be on your device. Accounts made before account codes have a 16-digit account number. Their number is still accepted as typed ({"account_number": "1234 5678 9012 3456"}), and npx -y @obscurify/cli api-key takes it too.