> ## Documentation Index
> Fetch the complete documentation index at: https://docs.omnichar.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Build with AI: agent prompts for the Omnichar API

> Copy a prompt into Cursor, Claude Code or Codex and let your agent add the Omnichar API to your project, or connect it to Omnichar over MCP.

Each prompt below gives a coding agent what it needs to add one part of the Omnichar API to your project: the docs to read, the calls to make in order, the rules to keep, and a check that proves it worked. Copy one and paste it into your agent, or open it straight in Cursor.

Every prompt works against the sandbox, so nothing is charged while your agent builds. You need a sandbox key (`sk_test_...`) in `OMNICHAR_API_KEY`; see [Authentication](https://docs.omnichar.org/api/authentication.md).

> [card] [Characters and generation](#characters-and-generation)
>
> Build characters from photos, generate images and video, and get told when a build is ready.

> [card] [Licensing](#licensing)
>
> For platforms that license likenesses. Issue and verify licenses, and generate with a licensed character.

## Characters and generation

Start here. Most integrations need only these two.

**Build a character and generate with it.** Paste into Cursor, Claude Code or Codex to add the Omnichar API to your project.

Add an Omnichar integration to this project that builds a character from face photos and generates an image with it.

Inspect this codebase's stack and existing patterns first and follow them. Read these docs before writing code: `https://docs.omnichar.org/api/quickstart.md`, `https://docs.omnichar.org/api/uploads.md`, `https://docs.omnichar.org/api/characters.md`, `https://docs.omnichar.org/api/runs.md`. The full index is `https://docs.omnichar.org/llms.txt`.

Base URL `https://api.omnichar.org/v1`. Send `Authorization: Bearer` with the key from the `OMNICHAR_API_KEY` environment variable. The key needs the scopes `chars:write`, `chars:read`, `runs:write` and `runs:read`.

1. `GET /team` and confirm `env` is `sandbox`. On 401 or 403, stop and tell me the key or its scopes are wrong.
2. For each of 4 or more face photos: `POST /uploads`, then PUT the bytes to `uploadUrl` with exactly the returned `headers`. Keep each `upload_key`.
3. `POST /chars` with a `subject_id` and the upload keys in `references.face`. Send an `Idempotency-Key` built from the `subject_id`.
4. Wait until `GET /chars/{id}` says `ready`, with backoff. Stop on `failed` and show `failure_reason`.
5. `POST /runs` with slug `default-flux-2-klein-4b`, the prompt in `inputs.prompt.text`, the character in `characters.character.char_id`, and a fresh `Idempotency-Key` per run.
6. Poll `GET /runs/{id}` every few seconds until `succeeded`, `failed` or `canceled`. Runs have no webhook.
7. `GET /runs/{id}/outputs` and download each `url` straight away into `./omnichar-out/`. The links expire.

Hard rules:

* The API key stays server side. Never put it in client code, a bundle, a log or an error message.
* Use only an `sk_test_` key while building.
* In production, listen for the `char.ready` webhook instead of polling the build.
* Retry 429 and 5xx with backoff and the same `Idempotency-Key`. Treat other 4xx answers as final.

Done when: in sandbox, the character reaches `ready`, the run reaches `succeeded`, and its output file is saved. Print the character id and run id, never the key.

**Receive character webhooks.** Paste into your agent to add a verified webhook endpoint for character builds.

Add an endpoint to this project that receives Omnichar character webhooks and verifies them.

Inspect this codebase's stack and existing patterns first and follow them. Read these docs before writing code: `https://docs.omnichar.org/api/webhooks.md`, `https://docs.omnichar.org/api/verify-webhooks.md`, `https://docs.omnichar.org/api/sandbox.md`. The full index is `https://docs.omnichar.org/llms.txt`.

Base URL `https://api.omnichar.org/v1`. Send `Authorization: Bearer` with the key from `OMNICHAR_API_KEY`. Read the signing secret from `OMNICHAR_WEBHOOK_SECRET`.

1. Add a POST route that reads the raw request body before any JSON parsing.
2. Check `OmniChar-Signature` as the verify page shows: HMAC-SHA256 of the timestamp, a dot and the raw body. Accept any matching `v1`, compare in constant time, and reject a timestamp more than 5 minutes off. Answer 400 on failure.
3. Skip events whose `OmniChar-Event-Id` was already handled. Delivery is at least once.
4. Handle `char.ready` (store the version and fetch the file later), `char.failed` (record `failure_reason`) and `char.updated`. Answer 2xx quickly and do slow work afterwards.
5. Register the endpoint. Ask me for its public HTTPS URL, then either ask me to add it as a Sandbox endpoint under Settings, Webhooks, or call `POST /teams/{id}/webhooks` with a key that has `webhooks:write`, using the id from `GET /team`. The signing secret is shown once: store it in `OMNICHAR_WEBHOOK_SECRET`.
6. Send a test with `POST /webhooks/test` and type `char.ready`. This needs a sandbox key.

Hard rules:

* Keys and secrets stay server side, read from the environment, and never appear in logs.
* Verify every signature before trusting the body.
* Use only an `sk_test_` key while building.

Done when: the test `char.ready` is accepted and recorded once, the same event sent twice is handled once, and a request with a changed body or an old timestamp gets 400.

## Licensing

These extend a characters integration, so run the first prompt above before these. Issuing licenses needs the provider flag on your team; email [support@omnichar.org](mailto:support@omnichar.org) to request it.

**Issue and verify licenses.** For provider teams. Paste into your agent to add licensing to an existing Omnichar integration.

Add Omnichar licensing to this project so my team can license its characters to other teams.

First check this codebase for an existing Omnichar integration that builds characters and extend it. If there is none, stop and tell me to run the "Build a character and generate" prompt from `https://docs.omnichar.org/api/build-with-ai.md` first. Follow the stack and patterns already here. Read: `https://docs.omnichar.org/api/licensing-quickstart.md`, `https://docs.omnichar.org/api/licenses.md`, `https://docs.omnichar.org/api/verify.md`, `https://docs.omnichar.org/api/usage.md`. Index: `https://docs.omnichar.org/llms.txt`.

Base URL `https://api.omnichar.org/v1`, `Authorization: Bearer` with `OMNICHAR_API_KEY`, which needs `licenses:write`, `licenses:read` and `usage:read`.

1. `GET /team` and confirm `env` is `sandbox`. Then check the provider flag: `POST /licenses/lic_test_provider_check/revoke` with reason `provider check`. A 404 means the flag is on. A 403 saying only provider teams can issue licenses means it is off: stop and tell me to email [support@omnichar.org](mailto:support@omnichar.org) to request provider access.
2. Issue: `POST /licenses` with `char_id`, the licensee's `licensee_team_slug` (ask me), `scope` (`use`, `media`, `territories`), `starts_at` and `ends_at`, and an `Idempotency-Key`. Store `key`, `signature` and `kid`. The `secret` is shown once: store it as a secret.
3. Verify: `GET /licenses/{key}/verify` with `signature`, plus `use`, `media` and `territory`. Only `status` `valid` with `in_scope` true lets work go ahead.
4. Usage: `GET /licenses/{key}/usage`.
5. Revoke: `POST /licenses/{key}/revoke` with a `reason`.
6. If a webhook handler exists, add `license.*` and `usage.*` events to it.

Hard rules:

* Keys and license secrets stay server side and never appear in logs or client code.
* Use only an `sk_test_` key while building.
* Block any use of a character whose license does not verify as `valid` and in scope.

Done when: in sandbox, a license is issued, verify answers `valid`, the license is revoked, and verify then answers `revoked`.

**Generate with a licensed character.** Paste into your agent to let your app generate with characters other teams license to you.

Extend this project's Omnichar integration so it can generate with characters other teams license to us.

First check this codebase for an existing Omnichar integration that runs generations and extend it. If there is none, stop and tell me to run the "Build a character and generate" prompt from `https://docs.omnichar.org/api/build-with-ai.md` first. Follow the stack and patterns already here. Read: `https://docs.omnichar.org/api/licensed-characters.md`, `https://docs.omnichar.org/api/license-context.md`, `https://docs.omnichar.org/api/errors.md`. Index: `https://docs.omnichar.org/llms.txt`.

Base URL `https://api.omnichar.org/v1`, `Authorization: Bearer` with `OMNICHAR_API_KEY`, which needs `chars:read`, `runs:write` and `runs:read`.

1. List licensed characters with `GET /characters/licensed`. Show each one's `license.status`, `use`, `media`, `territories` and dates.
2. Before a run, check that the license is `active` and allows this run's use, territory and media. If not, block the run and say why.
3. `POST /runs` with the character in `characters.character.char_id`, `license_context` set to the run's `use` and `territory`, and a fresh `Idempotency-Key` per run.
4. On a 403, read `error.details.reason` (for example `license_revoked`), block the run, show the reason, and do not retry.
5. Poll `GET /runs/{id}` until it settles, then download `GET /runs/{id}/outputs` straight away.
6. If the app needs the file, `POST /licenses/{key}/download` and save the `.char`.

Hard rules:

* The API key stays server side and never appears in logs or client code.
* Use only an `sk_test_` key while building.
* Never start a run when the license check fails.

Done when: in sandbox, a run with a licensed character succeeds, and after the provider revokes the license, the next run is refused with `license_revoked` and the app shows that reason without retrying.

**Verify licenses inside your app.** Paste into your agent to let a local app check a licensed .char before using it.

Make this app check the license inside an Omnichar `.char` before it generates with the character, and report each generation.

First check this codebase for existing Omnichar or `.char` handling and extend it. Follow the stack and patterns already here. Read: `https://docs.omnichar.org/api/char-license-format.md`, `https://docs.omnichar.org/api/verify-licenses-offline.md`, `https://docs.omnichar.org/api/local-verify.md`. Index: `https://docs.omnichar.org/llms.txt`.

Base URL `https://api.omnichar.org/v1`. These calls need no API key, so never ship one in this app.

1. Open the `.char` (a zip) and read `reserved.license` from `manifest.json`. No block means the character is not licensed: leave it alone.
2. Offline check: fetch `GET /.well-known/license-keys`, cache it, rebuild the signed fields exactly as the offline page says, and verify the Ed25519 `signature` with the key matching `kid`.
3. Online check: ask the user for the license secret, keep it in the OS keychain or equivalent, and `POST /licenses/verify` with `license_id`, `secret`, `char_id`, `output`, `model`, `client` and `client_version`. Keep the returned ticket.
4. After each generation, `POST /licenses/usage` with the ticket, `output`, `model` and `client`.
5. Refuse to generate when either check fails, and show the status the API returned.

Hard rules:

* Never log or display the license secret after it is entered.
* Fail closed: no network, no ticket, no generation with a licensed character.
* Build and test against a sandbox license (`lic_test_`).

Done when: a sandbox `.char` passes the offline check, the same file with one changed character in `signature` fails it, the online check returns a ticket, and a usage report is accepted with 202.

## Let your agent use Omnichar directly

The prompts above write code. To have your agent make images and video for you, connect it to the Omnichar MCP server instead. It works with your Omnichar Cloud account and needs no API key.

**Set up the Omnichar MCP server.** Paste into Claude Code, Cursor or VS Code and your agent connects itself to Omnichar Cloud.

Connect this agent to the Omnichar Cloud MCP server so it can list my characters and generate images and video with them.

Read `https://docs.omnichar.org/cloud/mcp-clients.md` and `https://docs.omnichar.org/cloud/mcp.md` first. The server URL is `https://mcp.omnichar.org/mcp`.

1. Work out which client you are running in: Claude Code, Cursor, VS Code or another. If you can't tell, ask me.
2. Add the server the way the setup page shows for that client: the `claude mcp add` command, or the `mcp.json` entry. Show me the change before you make it.
3. Tell me to finish sign-in in the browser window that opens: Google, then pick the workspace, then approve. Do not ask me to paste a key into this chat.
4. Call `get_credits` and tell me my balance and the daily MCP credit limit.
5. Call `list_characters` and `list_models` and summarise them.
6. Before the first `generate_image` or `generate_video`, tell me the character, the model and the credit price from `list_models`, and wait for my yes.

Hard rules:

* Never print, log or store an API key or token.
* Don't call `delete_run`, `delete_session` or `sign_license` unless I ask for that exact action.
* Nothing is spent until I confirm a generation.

Done when: `get_credits` answers in this client and no credits have been spent.

> [!NOTE]
>
> The page menu at the top of every docs page offers **Copy page**, **Open in Claude** and similar options, plus a link to the docs' own MCP server. That server lets an agent search and read these docs. To generate images and video from an agent, use the [Omnichar MCP server](https://docs.omnichar.org/cloud/mcp.md).

## Personal keys

A personal workspace has no sandbox, and its `oc_sk_` key works on production only, so these prompts don't fit it. Use the MCP prompt above, or make a sandbox key in a team workspace; see the Team plan on [Pricing](https://docs.omnichar.org/cloud/pricing.md). Personal keys are covered in [Authentication](https://docs.omnichar.org/api/authentication.md#personal-keys).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.