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.

GET/health

Backend status and the Gemini model list. No secrets.

GET/v1/targets

Mars and Moon target sites with every measurement and its source.

POST/v1/analogs

Ranked Earth places for a target. Optional mission lens, custom weights, and hard filters (“needs”) on Earth values.

fieldmeaning
targetid or name: jezero, acidalia, arcadia, shackleton, tranquillitatis_pit
lensbalanced, landing, rover, lunar_base, thermal, astrobiology
weightsobject of dimension → weight, overrides the lens
needslist like "slope < 10", "elevation < 2000"
limit1 to 100 (default 10)
{"target": "jezero", "lens": "rover", "needs": ["slope < 10"], "limit": 5}
POST/ask

Gemini “Ask the Planet”: plain English → lens weights (JSON only).

{"question": "where could astronauts practise driving on flat cold ground?", "target": "shackleton"}
POST/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.