Skip to main content
This guide sends an image generation request, retrieves the result, and shows the same flow with the TypeScript SDK.

1. Create an API key

Sign in to the dashboard, open API keys, and click Create API key. Choose one of these presets:
BabySea shows the full key only once. Store it in a secrets manager before closing the dialog.

2. Pick the correct region

Use the API hostname that matches where the key was created. In examples below, replace api.us.babysea.ai with your region if needed.

3. Smoke-test the key

GET /v1/status verifies the key and returns its account metadata. It requires the account:read scope.
Terminal
A valid key returns a success envelope:
JSON
If you created a Generate Only key, skip this status check and call a generation or library endpoint instead. That preset does not include account:read.

4. Submit a generation

Use an Idempotency-Key when the same user action or queue job might retry.
Terminal
BabySea validates the request, checks the key scope, reserves credits, creates a generation record, and returns a generation_id.
JSON

5. Fetch the result

Poll GET /v1/content/{generation_id} until generation_status is succeeded, failed, or canceled.
Terminal
Typical statuses:

6. Use the SDK

TypeScript

Production checklist

  • Use a Generate Only key for generation workers.
  • Add an IP allowlist when requests come from fixed infrastructure.
  • Use idempotency for queue retries and user-triggered retries.
  • Register a webhook endpoint instead of polling in hot paths.
  • Review the generation lifecycle before adding cancel or delete controls.
  • Use errors to distinguish retryable provider errors from request issues.
  • Monitor logs, credits, and activity after launch.