{"slug": "i-built-an-api-that-stops-ai-hallucinating-colour", "title": "I built an API that stops AI hallucinating colour", "summary": "A developer launched Colour Memory, an API that maps hex values, palettes, and images to named archive colours with provenance data, CIEDE2000 distance, WCAG contrast, and cultural risk flags. The tool provides 65 REST endpoints and MCP integrations for LLMs and design systems, offering a public rate-limited demo key with no signup required. The API aims to eliminate AI hallucination of colour names by returning only archive-verified entries with confidence scores and do-not-say guardrails.", "body_md": "Colour intelligence for agents and design systems.\n\nMaps hex values, palettes, and images to named archive colours. Returns CIEDE2000 distance, Lab/LCh metrics, WCAG contrast, cultural risk, provenance, and design tokens. No signup to try it.\n\n→ Public rate-limited demo key — safe to use in client examples\n\nArchitecture\n\n1Archive layerStructured colour records with names, primary sources, notes, and hex values drawn from historical and cultural archives.\n\n3Agent layer65 REST endpoints and MCP tools for LLMs, design systems, and automated workflows.\n\n4Narrative layerOptional LLM-generated reports, hooks, and briefs — clearly labelled where used.\n\n1\n\nAuthentication\n\nYour demo key\n\nNo signup. The demo key is rate-limited to 50 calls but covers everything below. Get a production key at colourmemory.com when you're ready to build.\n\nAPI Key\n\n```\ncm_demo_public_quickstart\n```\n\nPass as header: X-Api-Key: cm_demo_public_quickstart · Public, rate-limited, safe to expose in client examples.\n\n2\n\nTool 1 of 3\n\nquery.hex\n\nMatch any hex to the archive. Returns the nearest named colour with its primary source, confidence score, claim_role, and do_not_say guardrails. This is the core of what Colour Memory does.\n\ncurl\n\n```\ncurl -X POST https://api.colourmemory.com/query/hex \\\n  -H \"X-Api-Key: cm_demo_public_quickstart\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"hex\": \"#D4A829\", \"n_results\": 1}'\n```\n\nResponse — key fields\n\nnameSong Gold Sycee\n\narchiveChina\n\nprimary_sourceNorthern Song Dynasty monetary records, 960–1127\n\nconfidence0.92\n\nclaim_strengthA — Direct institutional record\n\nclaim_roleanchor\n\ndo_not_say\n\nDo not describe this hex as spectrophotometrically measured — values are computed from material descriptions.\n\nclaim_role tells you how hard you can push this entry: anchor = load-bearing evidence. reject = stub, exclude from deliverables.\n\n3\n\nTool 2 of 3\n\narchive.search\n\nFull-text keyword search across thousands of archive colours. This is a text search, not a colour search — search for \"arterial blood\" not \"red\". Use query.hex for hue-based retrieval.\n\ncurl\n\n```\ncurl -X POST https://api.colourmemory.com/archive/search \\\n  -H \"X-Api-Key: cm_demo_public_quickstart\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"query\": \"arterial blood\", \"archive\": \"Keats\", \"include_full\": true}'\n```\n\nResponse\n\nnameKeats's Lung\n\nslugkeats:keats-s-lung\n\nhex#C8B6B0\n\nprimary_sourceThe Letters, 3 February 1820\n\nclaim_roleanchor\n\nAlways save the slug from search results. Pass it to colour.card for reliable retrieval — slugs never break on apostrophes.\n\n4\n\nTool 3 of 3 · Commercial palette analysis\n\nbrand.audit\n\nPass a palette of hex values. Returns WCAG accessibility matrix, cultural risk notes by market, archive matches with provenance, palette role assignments, and a commercial verdict. Fully deterministic — no LLM involved.\n\ncurl\n\n```\ncurl -X POST https://api.colourmemory.com/brand/audit \\\n  -H \"X-Api-Key: cm_demo_public_quickstart\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"palette\": [\"#D4A829\", \"#1A5C6E\", \"#0F2D6B\", \"#0A0A0B\"],\n    \"markets\": [\"UK\", \"China\", \"Middle East\"],\n    \"context\": \"luxury packaging\"\n  }'\n```\n\nResponse — key fields\n\nwcag_matrixAll foreground/background combinations with AA/AAA pass/fail\n\ncultural_riskPer-market flags with context notes\n\ncommercial_labelArchive-verified name for each hex\n\nverdict_copyPlain-English palette verdict\n\nissuesActionable flags requiring attention\n\n5\n\nOptional · No code required\n\nConnect to Claude or ChatGPT\n\nAll tools load instantly via MCP. No SDK. No boilerplate. One URL. Disconnect and reconnect after any update to refresh the tool list.\n\n✗Searching for colour by hue with archive.search. Use query.hex or query.conceptual instead. archive.search is text matching, not perceptual matching.\n\n✗Ignoring claim_role. Anything marked reject is a stub with no primary source. Don't use it in client-facing work.\n\n✗Using names instead of slugs. Get the slug from archive.search. Names break on apostrophes. Slugs always work.\n\n✗Presenting a RacingSilks entry as Georgian evidence. Run cultural.anachronism first. A 2011 Jockey Club registration is not Georgian provenance.\n\n✗Ignoring do_not_say fields. They exist to stop your agent making claims the archive doesn't support. Read them.\n\n?\n\nTransparency\n\nWhat runs without an LLM?\n\nMost core endpoints are fully deterministic. Some endpoints optionally call an LLM for written output, and those are labelled clearly in the docs.\n\nDeterministic (no LLM)\n\nNearest-colour matching (CIEDE2000)\n\nLab / LCh metrics and LRV\n\nWCAG contrast and accessibility matrix\n\nPalette role assignment\n\nCultural risk scoring\n\nArchive audit and coverage gap\n\nImage palette extraction\n\nDesign token export\n\nUses LLM (opt-in)\n\nBrand reports and editorial briefs\n\nsession.brief forensic narrative\n\ncolour.hooks and colour.story\n\nagent.brief for image generation\n\n↯\n\nHonest caveats\n\nLimitations\n\n·Hex values are computational approximations derived from material descriptions and historical references, not spectrophotometric measurements.\n\n·A nearest archive match means perceptual similarity by CIEDE2000, not historical identity. Song Gold Sycee is the closest named colour — not proof the specific hex existed in 960 AD.\n\n·Cultural risk is context-dependent and should not be treated as universal truth. Market flags are starting points for research, not final verdicts.\n\n·Image extraction uses dominant pixel clustering. It does not yet reliably separate logo, text, product material, and background colours.\n\n·Some endpoints generate editorial copy using an LLM. These are labelled in the docs. The underlying archive data is the same either way.", "url": "https://wpnews.pro/news/i-built-an-api-that-stops-ai-hallucinating-colour", "canonical_source": "https://colourmemory.com/start", "published_at": "2026-06-03 14:24:42+00:00", "updated_at": "2026-06-03 14:50:00.057748+00:00", "lang": "en", "topics": ["ai-tools", "ai-products", "ai-agents", "artificial-intelligence"], "entities": ["Colour Memory", "Northern Song Dynasty"], "alternates": {"html": "https://wpnews.pro/news/i-built-an-api-that-stops-ai-hallucinating-colour", "markdown": "https://wpnews.pro/news/i-built-an-api-that-stops-ai-hallucinating-colour.md", "text": "https://wpnews.pro/news/i-built-an-api-that-stops-ai-hallucinating-colour.txt", "jsonld": "https://wpnews.pro/news/i-built-an-api-that-stops-ai-hallucinating-colour.jsonld"}}