TwinWorlds API
Earth analogs for Mars and Moon sites, as a service. Same engine and data as the TwinWorlds app. Runs on Cloudflare Workers; Gemini routes keep the key server-side. Base URL:
CORS is limited to the TwinWorlds sites; call it from a server or curl. Numbers are similarity scores (0 to 1) from NASA and partner data; Gemini text is labelled AI-generated.
/health
Backend status and the Gemini model list. No secrets.
/v1/targets
Mars and Moon target sites with every measurement and its source.
/v1/analogs
Ranked Earth places for a target. Optional mission lens, custom weights, and hard filters (“needs”) on Earth values.
| field | meaning |
|---|---|
target | id or name: jezero, acidalia, arcadia, shackleton, tranquillitatis_pit |
lens | balanced, landing, rover, lunar_base, thermal, astrobiology |
weights | object of dimension → weight, overrides the lens |
needs | list like "slope < 10", "elevation < 2000" |
limit | 1 to 100 (default 10) |
{"target": "jezero", "lens": "rover", "needs": ["slope < 10"], "limit": 5}
/ask
Gemini “Ask the Planet”: plain English → lens weights (JSON only).
{"question": "where could astronauts practise driving on flat cold ground?", "target": "shackleton"}
/analyst, /whatif, /when
Gemini explanations grounded in the numbers the app sends: why a place matches, how a changed measurement shifts the matches, and when a place is most Mars-like through the year. Used by the app; see worker/src/index.js for the body fields.
Sources
Earth: NASA MODIS (2023), USGS GMTED2010, NOAA ETOPO1, NASA EMIT. Mars: MGS MOLA and TES, MRO CRISM, Mars Climate Database (ESA/CNES/LMD). Moon: LRO LOLA and Diviner. Full list in data/SOURCES.md in the repo.