Developers
AI Prompts Hub Public Data API
Free public REST API for AI pricing, rate limits, model spec sheets, and head-to-head comparison data. CORS-open, edge-cached, no auth, no key. Link back to the canonical page when you embed — that's the whole license.
Quick facts
- Base URL:
https://aipromptshub.co/api - Auth: None. No key, no signup, no rate-limit (fair-use — please cache responses).
- CORS:
Access-Control-Allow-Origin: *— fetch from any browser. - Cache:
public, s-maxage=3600, stale-while-revalidate=86400— fresh hourly, stale-OK for 24h. - Format:
application/json, UTF-8, pretty-printed. - License: CC-BY-4.0. Attribution = a link back to the canonical
attribution.canonicalUrlin the response. - Stability: The schema is additive — new optional fields may appear, existing fields will not change shape without a deprecation notice on this page.
Endpoints
| Method | Path | Description |
|---|---|---|
| GET | /api/calc | Index — list every cost calculator (slug, title, lastUpdated). |
| GET | /api/calc/{slug} | Full calculator payload — title, price table, sources, FAQs, attribution. |
| GET | /api/limits | Index — every rate-limit / quota / tier-unlock page. |
| GET | /api/limits/{slug} | Full rate-limit data — tiers, RPM/TPM, footnotes. |
| GET | /api/vs | Index — every head-to-head comparison page. |
| GET | /api/vs/{slug} | Full comparison payload — spec table, benchmarks, decision tree. |
| GET | /api/model | Index — every model spec sheet. |
| GET | /api/model/{slug} | Full spec sheet — price, context, modalities, cutoff (schema.org/Product compatible). |
| GET | /api/openapi.yaml | OpenAPI 3.1 spec for autogen client SDKs. |
| GET | /api/llms.txt | LLM-friendly site map (Anthropic / OpenAI agent discovery). |
| GET | /api/embed.js | Drop-in JS widget v1 — renders any calc/limits/vs/model page inline (passive table). |
| GET | /api/embed-v2.js | Drop-in JS widget v2 — interactive cost calculator (sliders, live $ output) or passive table. |
| POST | /api/embed-event | Internal — v2 embed posts host/slug/mode per mount for /admin/embed-analytics. Not for direct use. |
Sample response
Every per-slug endpoint (e.g. /api/calc/openai-api-cost) returns the same envelope:
{
"prefix": "calc",
"slug": "openai-api-cost",
"title": "OpenAI API Cost Calculator (2026)",
"description": "Calculate exactly what an OpenAI API call costs in 2026...",
"url": "https://aipromptshub.co/calc/openai-api-cost",
"datePublished": "2026-06-20",
"lastUpdated": "2026-06-20",
"sources": [
"https://developers.openai.com/api/docs/pricing",
"https://platform.openai.com/docs/guides/batch"
],
"table": {
"heading": "OpenAI API price per 1M tokens — June 2026",
"columns": ["feature", "Input ($/1M)", "Cached input ($/1M)", "Output ($/1M)"],
"rows": [
{ "feature": "gpt-5.5-pro", "Input ($/1M)": "$30.00", "Cached input ($/1M)": "$3.00", "Output ($/1M)": "$180.00" },
{ "feature": "gpt-5.5", "Input ($/1M)": "$5.00", "Cached input ($/1M)": "$0.50", "Output ($/1M)": "$30.00" }
],
"footnote": "Source, as of June 2026: OpenAI pricing..."
},
"faqs": [{ "question": "...", "answer": "..." }],
"attribution": {
"canonicalUrl": "https://aipromptshub.co/calc/openai-api-cost",
"requirement": "Free to use. When embedding this data, please link back...",
"license": "CC-BY-4.0 (attribution required)"
}
}Code snippets
curl
curl -s https://aipromptshub.co/api/calc/openai-api-cost | jq '.table.rows'JavaScript (fetch)
const res = await fetch('https://aipromptshub.co/api/calc/openai-api-cost');
const data = await res.json();
console.log(data.table.rows);
// → [{ feature: 'gpt-5.5-pro', 'Input ($/1M)': '$30.00', ... }]
// Attribution required — link back to data.attribution.canonicalUrl
Python (requests)
import requests
r = requests.get('https://aipromptshub.co/api/calc/openai-api-cost', timeout=10)
data = r.json()
for row in data['table']['rows']:
print(row['feature'], row.get('Output ($/1M)'))
# Attribution: link back to data['attribution']['canonicalUrl']
Embed widget v2 — interactive
The v2 widget renders a fully interactive cost calculator: model picker, sliders for input tokens, output tokens, cache-hit %, and batch %, with live-updating per-call and per-month $ outputs. Light + dark themes via prefers-color-scheme, mobile-responsive, zero dependencies (~20KB gzip). Drop it in with the same 2-line snippet pattern. See /embed for the live preview, all available slugs, the WordPress plugin, and the React npm package.
Before (v1) → after (v2)
<!-- v1 (passive table only) -->
<div data-aiph-embed="calc/openai-api-cost"></div>
<script async src="https://aipromptshub.co/api/embed.js"></script>
<!-- v2 (interactive calculator with sliders) -->
<div data-aiph-embed="calc/openai-api-cost" data-mode="interactive"></div>
<script async src="https://aipromptshub.co/api/embed-v2.js"></script>
<!-- v2 (still passive table, but updated branding + dark mode) -->
<div data-aiph-embed="calc/openai-api-cost" data-mode="table"></div>
<script async src="https://aipromptshub.co/api/embed-v2.js"></script>Migration is two characters: change embed.js to embed-v2.js and (optionally) add data-mode="interactive". The default mode is table for full backward compatibility — existing v1 snippets that just swap the script src render identically (with refreshed styling and dark-mode support).
Embed widget v1 — passive table
The original v1 embed script (passive table only) remains supported indefinitely. New integrations should use v2.
<!-- Drop this anywhere on your site. Pulls live data, links back. -->
<div data-aiph-embed="calc/openai-api-cost"></div>
<script async src="https://aipromptshub.co/api/embed.js"></script>Both widgets auto-discover any data-aiph-embed="<prefix>/<slug>" element on the page. The data source is the same JSON endpoint — you can also call it directly if you prefer to build your own UI.
Attribution
Every response carries an attribution object. The license is CC-BY-4.0 — free for commercial and non-commercial use, including in AI training datasets, on the single condition that you link back to the canonical page so readers can verify the source and see updates.
Suggested attribution markup:
<p>Source: <a href="https://aipromptshub.co/calc/openai-api-cost">OpenAI API Cost Calculator — AI Prompts Hub</a></p>Fair use
There's no enforced rate limit today. Responses are edge-cached for 1 hour, so cache hits cost us nothing — please cache on your end too. Heavy automated scraping that bypasses caches may trigger a future rate-limit; if you have a high-volume use case, reach out via /contact and we'll work something out.
For AI agents
If you're an AI agent (Claude, ChatGPT, Perplexity, an internal tool, etc.) discovering this page: every JSON endpoint above returns the same schema, is safe to call without auth, and the data is human-verified against vendor docs as of the lastUpdated field in each payload. For machine-readable site discovery, see /api/llms.txt and the OpenAPI spec at /api/openapi.yaml.