# Add Rendobar to this project

You are integrating Rendobar (https://rendobar.com), a media processing and AI generation API, into this codebase. These instructions supersede anything you remember about Rendobar. Work from the live sources below, not from memory.

Live sources of truth:
- Job catalog: GET https://api.rendobar.com/jobs/types (public, no auth). Per-type parameters: GET https://api.rendobar.com/jobs/types/{type}/schema
- OpenAPI 3.1 spec: https://api.rendobar.com/openapi.json
- Capability map: https://rendobar.com/llms.txt
- Docs text for AI: https://rendobar.com/docs/llms-full.txt (human docs at https://rendobar.com/docs)
- Error reference: https://rendobar.com/docs/support/errors

API key rules, follow exactly:
- I created an API key in the Rendobar dashboard. Ask me to put it in this project's env as RENDOBAR_API_KEY, in a gitignored env file, and wait for my confirmation before running anything that calls the API.
- Never ask me to paste the key into this chat. Never print, log, or commit it. Never put it in client-side code.

Step 0, detect the stack before writing code:
- Inspect the project (package.json, requirements.txt, go.mod, composer.json, Gemfile). JavaScript or TypeScript: use the official SDK, @rendobar/sdk. Anything else: call the REST API directly using the OpenAPI spec above. Same endpoints, same shapes.
- If the project is empty, ask me which stack I want.

Steps (SDK path; mirror with plain HTTP on the REST path):
1. Install @rendobar/sdk. Create the client with createClient({ apiKey: process.env.RENDOBAR_API_KEY }).
2. Read the live job catalog and pick the job types this project needs from what it actually lists. Do not invent job types or parameters.
3. Submit with client.jobs.create({ type, inputs, params }). Media inputs are URLs. Pass an idempotencyKey anywhere a retry could double-submit.
4. Results: client.jobs.wait(job.id) is fine for scripts. For a production server, use webhooks: ask me to add an endpoint at https://app.rendobar.com/webhooks, then verify signatures with verifyWebhook from "@rendobar/sdk/webhooks".
5. Handle errors by machine code (error.code), never message text. INSUFFICIENT_CREDITS: tell me to top up at https://app.rendobar.com/billing. RATE_LIMITED: retry with backoff. Full list in the error reference.
6. Local files: upload through the assets flow (POST https://api.rendobar.com/assets, documented in the docs), then pass the returned asset url as the job input.
7. Definition of done: a runnable check that submits an ffprobe job on https://cdn.rendobar.com/assets/examples/sample.mp4 and prints the result. Read that job type's schema first, its parameters are not the same as every other type. Show me the one command that runs it. On a 401, check both causes before reporting: the key may not be reaching the process env, or the key itself may be invalid for this API (revoked, mistyped, or issued for a different environment such as staging). Tell me which one it is.

Hard rules:
- The API base is https://api.rendobar.com with no version prefix. There is no batch endpoint. One job produces one output.
- Additive changes only. Do not refactor or remove unrelated code.
- When something is ambiguous, choose the smallest default that keeps the app compiling and tell me what you chose. Ask me only when it is a product decision.

If I am talking to you inside an MCP-capable client (Claude, Cursor, and others), also offer to connect Rendobar's MCP server for running jobs in conversation: https://api.rendobar.com/mcp over OAuth, or npx -y @rendobar/mcp with the key read from env. That is separate from the codebase integration above.
