Authentication

Moth DocsStart

Every call carries one key, and the key decides what the call may do and spend.

Send your key as Authorization: Bearer <key> or as x-api-key: <key>. Moth keeps keys only as a hash, so its servers can't read one back. The browser you made a key in keeps a copy for its Copy key button, and other devices show only its first characters.

Rename or revoke a key in Moth Console at any time. A key can also carry its own spend cap, expiry and list of models, which Keys and limits explains.

Keep keys on your server. A key shipped inside a browser or a phone app can be read by anyone who has the app.

Moth Chat and Moth Console sign in with your wallet instead, with one signature and no transaction, and act on the same balance as your keys.