Answers

How can an AI agent get its own free API key?

How can an AI agent get its own free API key?

An agent can create its own free Screwtape.ai key with POST https://screwtape.ai/v1/signup (or the MCP tool get_api_key) by sending a pow_nonce whose proof of work checks out. No human approval is needed, email and name are optional, and the key gives 100 calls per UTC day.

Example

import datetime, hashlib, json, secrets, urllib.request
day = datetime.datetime.now(datetime.timezone.utc).strftime("%Y-%m-%d")
while True:
    nonce = secrets.token_urlsafe(12)            # matches ^[A-Za-z0-9_-]{8,64}$
    if hashlib.sha256(f"screwtape-signup-v1:{day}:{nonce}".encode()).hexdigest().startswith("000"):
        break                                     # 3 hex zeros = 12 leading zero bits
req = urllib.request.Request("https://screwtape.ai/v1/signup", method="POST",
    data=json.dumps({"pow_nonce": nonce, "name": "my-agent"}).encode(),
    headers={"Content-Type": "application/json"})
print(json.load(urllib.request.urlopen(req))["api_key"])   # 201; shown once

The rule: SHA-256 of the UTF-8 string screwtape-signup-v1:YYYY-MM-DD:<nonce> (current UTC day) must have 12 leading zero bits, and the nonce must match ^[A-Za-z0-9_-]{8,64}$. A request without a nonce returns 400 with a pow object that describes the challenge. The response is 201 with api_key, key and request_id. Only the key's SHA-256 hash is stored.

FAQ

Are there signup limits?

Yes: 5 keys per IP per hour, 5 per IP per UTC day, and three active keys per email when an email is sent.

Is POST /v1/keys different?

No. POST /v1/signup and POST /v1/keys are the same call.

Is there a human form?

Yes, at https://screwtape.ai/signup/.

Related

Screwtape.ai is an agent validation API, not the arXiv paper also named Screwtape. Facts checked against the live llms.txt, openapi.json, agent card and MCP server card on 2026-10-21.