Getting access
Everything on this site works against a 2wai account that’s been enrolled in the developer program. This page covers that enrollment, where your sk_ key comes from, and the opt-in that lets your own custom avatars be reachable through the developer API.
Enroll at 2wai.ai/developers
Section titled “Enroll at 2wai.ai/developers”The developer portal is hosted on the main 2wai site, not here. Sign up and manage keys at:
- Create or sign in to a 2wai account at https://2wai.ai. Email/password or Google.
- Open the Developer area at https://2wai.ai/developers.
- Accept the developer agreement. This is the legal gate between a regular 2wai account (consumer) and developer access (API usage with billing exposure).
- Get auto-approved on the thinned baseline (verified email + not disabled + not rate-locked). If you miss one of those, the request goes to a short admin-review queue.
- Generate a key in the Developer Console. You’ll see:
sk_test_...for test mode (canned responses on some endpoints, useful for CI + integration tests without burning real pipeline minutes).sk_live_...for real pipeline runs, metered against your account. The plaintext key is shown once at creation. Copy it immediately into your server’s environment (TWAI_SECRET_KEY=sk_live_...) or secrets manager.
sk_test_ vs sk_live_
Section titled “sk_test_ vs sk_live_”sk_test_ | sk_live_ | |
|---|---|---|
| Where it hits | Same api.2wai.ai/v1/* surface | Same |
| Response shape | Byte-identical | Byte-identical |
| What it actually runs | Canned responses on test-mode-aware endpoints; real pipeline on others | Real pipeline on everything |
| Metering | Virtual quota, no account spend | Real metering against your account |
| Best for | CI, integration tests, dev builds, smoke testing | Production + staging |
The gateway decides mode per key, not per request. The two prefixes are just advisory for your own eyes — the actual mode is baked into the key the portal issued.
Expose your own avatars via the developer API
Section titled “Expose your own avatars via the developer API”By default, avatars you create in Avatar Studio (the consumer avatar-creation flow) are private to your account and not reachable through api.2wai.ai. To make an avatar available via your developer sk_:
- Create or open an avatar in Studio at https://2wai.ai/studio.
- Flip the “API-expose” toggle for that avatar in the Developer Console’s Avatars tab at 2wai.ai/developers/avatars. This writes
api_exposed_aton the avatar — the developer-portal gate that lets the API read it. - Resolve it from code by handle via
GET /v1/avatars/{owner}/{name}— see Catalog hydrate. The response returns the resolvedavatar_idyou pass toPOST /v1/sessions.
Public (listed) avatars on 2wai are reachable with any valid sk_ without this toggle; the toggle only matters for private avatars.
Where the keys live and how they’re billed
Section titled “Where the keys live and how they’re billed”- Issuance — the Developer Console at 2wai.ai/developers. SHA-256 hashed in gen-2wai’s
gen_developer_keytable; the plaintext is shown once and never retrievable. - Validation —
api.2wai.ai(the gateway) checks everysk_on every request. For keys issued by the Developer Portal, the gateway resolves them via a service-to-service bridge to gen-2wai and lazy-mirrors them locally so repeat requests fast-path. - Rate + concurrency — see Limits & concurrency. Per-tenant caps enforced at the gateway.
- Spend — real-time metering on
sk_live_. Dashboard surfaces are on the Developer Console roadmap.