Prompts para constructores de IA
El constructor escribirá el código más rápido que tú. Lo que no sabe son dos cosas sobre una API concreta: dónde poner la clave y por qué la petición desde el navegador no pasa. Ambas cuestan horas de depuración, y ambas se resuelven con un párrafo en el prompt.
Abajo está primero ese párrafo y después siete recetas.
La regla que hay que pegar antes de cualquier receta
Sección titulada «La regla que hay que pegar antes de cualquier receta»Copia este bloque en el constructor antes del texto de la receta. No trata del estilo del código, trata de lo que si no, no funcionará.
AstroWay API house rules. Apply these to every request you generate.
1. The API key is a server secret. Never put aw_live_* or aw_test_* into client code, into a VITE_* or NEXT_PUBLIC_* variable, or into a fetch that runs in the browser. Create a server route and call the API from there.2. The browser cannot call https://api.astroway.info/v1/* with that key. The one exception is a publishable pk_live_* key created for your app's origin: responses to that origin carry access-control-allow-origin, and the key works only from origins on its own list. Two prefixes answer any browser with no key: /v1/public/* returns JSON you can use, and /v1/embed/* returns a finished HTML page meant for an iframe, not for fetch.3. The auth header is exactly "X-Api-Key: <key>". Authorization: Bearer is rejected with 401, and so is an api_key query parameter.4. Send the birth time zone as an IANA name: "timezone": "Europe/Kyiv". Do not compute a UTC offset yourself. Kyiv in May 1990 was UTC+4, not the +3 it is today, and a wrong offset moves every house cusp.5. Every response is {"ok": true, "data": {...}} or {"ok": false, "error": {"code": "...", "message": "..."}}. Read data on success and show error.message to the user on failure. Do not assume a bare object.6. Planet positions arrive as ecliptic longitude in degrees, with no sign name. Derive it: SIGNS[Math.floor(longitude / 30)] where SIGNS runs Aries, Taurus, Gemini, Cancer, Leo, Virgo, Libra, Scorpio, Sagittarius, Capricorn, Aquarius, Pisces. Degrees inside the sign are longitude % 30.7. Responses carry X-Credits-Used and X-Credits-Remaining. Log both on the server so the cost of a feature is visible before the bill is.8. Ask for the fields you will render. Every endpoint takes ?fields= as a comma-separated list of dotted paths and ?precision= as decimal places: POST /v1/chart?fields=planets.name,planets.longitude,houses.cusp&precision=2 answers in 559 bytes where the full response is 32,410. Same credits, and the tokens are yours to pay either way.9. Get a free key at https://api.astroway.info/dashboard/sign-up and use an aw_test_* sandbox key while building: it spends no credits.1. Carta natal con rueda
Sección titulada «1. Carta natal con rueda»Dos respuestas para una sola acción del usuario: los datos de la carta y un SVG listo.
| Endpoint | Créditos |
|---|---|
/v1/chart | 20 |
/v1/render/wheel-western | 10 |
Build a single-page app: a birth data form (date, time, city with latitude andlongitude, IANA time zone) that renders a natal chart.
Server route POST /api/chart does two calls to AstroWay, in parallel: POST https://api.astroway.info/v1/chart POST https://api.astroway.info/v1/render/wheel-westernBoth take the same body: { "date": "1990-05-15", "time": "14:30:00", "timezone": "Europe/Kyiv", "latitude": 50.45, "longitude": 30.52 }Both need the X-Api-Key header.
/v1/chart returns data.planets (array with name, longitude, isRetrograde),data.houses.cusps (array of 12 longitudes) and data.aspects (array withplanet1, planet2 and a type object carrying name, symbol and color)./v1/render/wheel-western returns data.svg as a string.
The page shows the SVG at the top, then a table of planets with sign anddegree derived from longitude, then the aspect list using type.symbol andtype.color. Mark retrograde planets with an R.
Do not call AstroWay from the browser. The page calls /api/chart only.Comprueba después de generar: el SVG está insertado como marcado y no en <img src>; la hora se envía como cadena HH:mm:ss; la clave no ha acabado en el bundle (buscar aw_ en los archivos compilados no debe encontrar nada).
2. Compatibilidad de dos cartas
Sección titulada «2. Compatibilidad de dos cartas»Un número y sus componentes, sin texto explicativo. /v1/synastry/attraction-score, 50 créditos por pareja.
Build a compatibility page: two birth-data forms side by side, one button.
Server route POST /api/compat calls POST https://api.astroway.info/v1/synastry/attraction-scorewith body { "chart1": {...}, "chart2": {...} }, where each chart is { "date", "time", "timezone", "latitude", "longitude" }.
The response has data.score (a number), data.components (the parts that madeit) and data.notes. Render score as a large number with a progress ring, thencomponents as labelled bars, then notes as a list.
Never show the score without the components: a single number with no reasonbehind it is the thing users distrust.3. Horóscopo diario, sin ninguna clave
Sección titulada «3. Horóscopo diario, sin ninguna clave»La única receta en la que no hace falta una ruta de servidor: este endpoint responde al navegador y no cuesta créditos.
Add a daily horoscope block to the page. Call this directly from the browser,no key and no server route needed:
GET https://api.astroway.info/v1/public/horoscope/daily?sign=leo&lang=en
Response: data.sign, data.date, data.period, data.horoscope (the text),data.disclaimer and data.language. Render a sign picker with the twelve signs,remember the choice in localStorage, and always show data.disclaimer under thetext.
The first request for a date that has not been generated yet can take a while,so show a skeleton, not a spinner that looks stuck.4. Human Design
Sección titulada «4. Human Design»Tipo, estrategia, autoridad, perfil, centros y canales con una sola llamada a /v1/human-design, 50 créditos.
Build a Human Design page: birth data form, then the chart summary.
Server route POST /api/hd calls POST https://api.astroway.info/v1/human-designwith { "date", "time", "timezone", "latitude", "longitude" }.
The response has data.type, data.strategy, data.notSelfTheme, data.authority,data.profile, data.definition, data.cross, data.centers, and the activationarrays data.personalityActivations and data.designActivations.
Lay it out as: type and strategy as the headline, authority and profile as twocards, centers as a list with defined ones filled and undefined ones outlined,activations in a collapsible table. Birth time matters here more than anywhereelse, so refuse to submit without it and say why.5. Informe PDF con la marca del usuario
Sección titulada «5. Informe PDF con la marca del usuario»Para quien vende informes, no quien muestra pantallas. /v1/reports/natal, 5000 créditos por documento, y el enlace dura 24 horas.
Build a report generator: birth data form plus a branding form (company name,report title, accent colour), and a Generate button.
Server route POST /api/report calls POST https://api.astroway.info/v1/reports/natalwith { "chart": { "date", "time", "timezone", "latitude", "longitude" }, "whitelabel": { "companyName": "...", "reportName": "...", "themeColor": "#7c3aed", "footerText": "..." } }
The response has data.url, data.page_count, data.byte_length anddata.expires_at. The URL is valid for 24 hours only, so the server mustdownload the PDF immediately and store it on your side, then hand the useryour own link. Never give the AstroWay URL to the end user.
Show page_count and a download button. One report costs 5000 credits: put aconfirmation step before the call, not after.El catálogo completo de dieciséis informes, qué hay en cada uno y cuántas páginas tiene: Reports API.
6. Calendario de tránsitos del mes
Sección titulada «6. Calendario de tránsitos del mes»Una lista de eventos en una ventana de fechas, de la que sale tanto un feed como un calendario. /v1/transit-calendar, 100 créditos por ventana.
Build a month view of transits.
Server route POST /api/transits calls POST https://api.astroway.info/v1/transit-calendarwith { "natal": { "date", "time", "timezone", "latitude", "longitude" }, "startDate": "2026-10-01", "endDate": "2026-10-31" }
The response has data.count and data.events, plus the echoed startDate,endDate and maxOrb. Render events on a month grid, one dot per day withevents, and a day panel listing that day's events.
One call covers the whole window, so fetch the month once and filter in theclient. Do not call the API per day: that is thirty-one calls and thirty-onetimes the credits for the same answer.7. Tirada de tarot
Sección titulada «7. Tirada de tarot»La forma más barata de añadir una interacción diaria. /v1/tarot/rider-waite/draw/three-card, 10 créditos por tirada, o cero para la carta diaria.
Add a three-card tarot spread.
Server route POST /api/tarot calls POST https://api.astroway.info/v1/tarot/rider-waite/draw/three-cardwith an optional { "seed": 7 }. The response has data.spread, data.seed anddata.drawn.
Pass a seed derived from the user id and today's date, so the same person getsthe same spread all day and a new one tomorrow. Without a seed every reloaddeals a new hand, which reads as a slot machine.
For a zero-cost daily card the browser can call GET https://api.astroway.info/v1/public/tarot/dailydirectly, no key.Ocho constructores, una diferencia
Sección titulada «Ocho constructores, una diferencia»Las recetas de arriba son iguales para todos. La única diferencia es dónde vive la ruta de servidor y dónde poner la clave.
| Constructor | Dónde vive la llamada de servidor | Dónde poner la clave |
|---|---|---|
| Lovable | edge function en Supabase | Secrets del proyecto de Supabase |
| Bolt | server function | panel Secrets de Bolt |
| v0 | route handler de Next.js en Vercel Functions | environment variable en Vercel, de tipo Secret |
| Replit | un proceso de servidor normal | Replit Secrets, y otra vez por separado en Deployments |
| Cursor, Claude Code, Devin Desktop, Copilot | el de tu stack | .env fuera de git más el almacén de secretos de tu hosting |
Cuatro trampas distintas, cada una cuesta una tarde.
- Lovable y Bolt construyen el frontend con Vite, y Vite entrega al navegador cualquier variable con el prefijo
VITE_. La clave no se pone ahí ni siquiera temporalmente: acabará en el bundle que se sirve a todo el mundo. - Bolt muestra la vista previa dentro de un WebContainer, y eso es un navegador real con CORS real, que ahí no se puede desactivar. Una función de servidor aquí no es “mejor”, es la única forma de que la llamada llegue a hacerse.
- v0 incrusta
NEXT_PUBLIC_*en el bundle en tiempo de compilación. Cambiar el valor en el panel no basta: hasta que no haya un nuevo despliegue, la aplicación funciona con la clave antigua. Rotar la clave es rotar más recompilar. - Replit guarda por separado los secretos del espacio de trabajo y los de Deployments. Lo que funcionaba en el editor falla tras publicar con una clave vacía, hasta que la añades otra vez en el panel de Deployments.
Las cuatro últimas filas de la tabla no son plataformas, sino agentes en tu repositorio, y cada uno tiene su propia lista de red permitida para su sandbox. Cuando el agente quiera probar el código que acaba de escribir, la llamada a api.astroway.info puede quedar bloqueada hasta que se añada el dominio. Para ellos hay un camino más corto: conecta nuestro MCP y el agente llamará a la API por sí mismo, sin tu código. Instrucciones en Configuración del agente.
Si tu agente habla function calling y no MCP
Sección titulada «Si tu agente habla function calling y no MCP»Toma las definiciones de herramientas ya preparadas y pásalas directamente al modelo. Se generan a partir del documento OpenAPI, así que el esquema que rellena el modelo es el mismo que valida el endpoint.
curl "https://api.astroway.info/v1/agent/tools?format=openai&select=starter" \-H "X-Api-Key: aw_live_YOUR_KEY"format acepta openai y anthropic; select reduce el catálogo al conjunto inicial en lugar de todas las herramientas.