Crear con IA
Asistentes de programación basados en IA
Configura la integración con Claude Code, Codex o Cursor.
Los ejemplos de código, los puntos finales y los códigos de error son los mismos en todos los idiomas.
Deja que Claude Code, Codex o Cursor escriban la integración por ti. Hay dos formas de hacerlo:
- Consulta la documentación. Cada página tiene una versión en Markdown (añade
.mda la URL o utiliza la opción Copiar página que aparece en la parte superior). La referencia completa también se encuentra en /llms-full.txt. - Conecta el servidor MCP para que el asistente pueda leer estos documentos y realizar pruebas reales mientras se compila. Consulta «Servidor MCP».
Dónde colocar las instrucciones
| Asistente | Inserta el contrato que aparece a continuación en |
|---|---|
| Claude Code | CLAUDE.md, en el directorio raíz de tu proyecto |
| Codex | AGENTS.md, en el directorio raíz de tu proyecto |
| Cursor | .cursor/rules/tryoncloud.mdc o pégalo en el chat |
| ¿Algún otro? | Pégalo en el chat |
A continuación, escribe: «Añadir la prueba virtual de TryOnCloud utilizando el contrato de CLAUDE.md» (o AGENTS.md). Guarda tu clave en una variable de entorno, como TRYONCLOUD_API_KEY; nunca en el archivo.
El contrato
text
You are integrating the TryOnCloud Developer API into my app.
ENDPOINT
POST https://www.tryoncloud.com/api/v1/generate
Test mode (free, nothing generated or stored): add ?mock=true
AUTH
Header X-API-KEY, read from env TRYONCLOUD_API_KEY (starts with tk_dev_v1_)
REQUEST: multipart/form-data OR JSON. Two images required:
garment_image (file) OR garment_url (public https URL) OR garment_base64
person_image (file) OR person_base64
JPEG, PNG, WebP or HEIC, up to 15MB each.
Optional: customer_id (my own end-user id, max 128 chars).
Optional header: Idempotency-Key (a new UUID per try-on; reuse it only
when retrying that same try-on, so it is never charged twice).
RESPONSE
200 -> the response BODY IS the finished try-on image (image/png).
Read it as bytes, do NOT JSON.parse it. Store it yourself.
Headers: X-Request-Id (log it), X-Credit-Was-Free, X-Result-Id
(only if result storage is enabled), X-Mock: 1 in test mode.
non-200 -> JSON { "error": string, "code": string }:
401 NO_KEY, INVALID_KEY | 400 BAD_INPUT, NO_PERSON, NO_GARMENT
402 NO_CREDITS, QUOTA_EXCEEDED, FREE_TRIAL_USED, KEY_LIMIT_REACHED
403 DEVICE_BANNED | 409 IDEMPOTENCY_IN_PROGRESS, IDEMPOTENCY_REPLAY,
IDEMPOTENCY_MISMATCH (not charged)
413 IMAGE_TOO_LARGE | 422 CONTENT_FILTERED (refunded)
429 RATE_LIMITED (wait Retry-After) | 500 GENERATION_FAILED (refunded)
OTHER ENDPOINTS
GET https://www.tryoncloud.com/api/v1/credits -> { credits_remaining, ... }
DELETE https://www.tryoncloud.com/api/v1/results/<id> -> 204
Async (only if I ask for it): POST /api/v1/generations -> 202 job;
GET /api/v1/generations/<id>; POST /api/v1/batches (<= 500 URL items);
signed webhooks generation.completed / generation.failed / batch.completed
(verify x-tryoncloud-signature-v2 = HMAC-SHA256 of "<timestamp>.<raw body>").
Spec: https://www.tryoncloud.com/api/v1/openapi.json
RULES
- Call from my server only, never the browser; never expose the key.
- Client timeout 120 seconds; a typical result takes about 20 seconds.
- Build and test with ?mock=true first, then remove it.
- Retry 500 once and 429 after Retry-After. Never loop on 402.
- Only send photos of adults who agreed to the try-on.
Write production code for [MY STACK] that uploads two images, calls this
endpoint, handles every error code above, and saves/returns the PNG.Sustituye [MY STACK] por el tuyo, por ejemplo, «un gestor de rutas de Next.js», «Laravel», «Django» o «Express».