Skip to content

Official Crawl4AI Cloud: a hosted web scraping, extraction, and search API for AI agents. Free API key, 1,000 credits a month, no card. Fully open source: this repo is the Apache-2.0 crawler that powers it, and you can self-host it.

docs: the Crawl4AI Cloud announcement banner on every page

unclecodef19734aeb98e
diff --git a/docs/md_v2/assets/cloud-banner.css b/docs/md_v2/assets/cloud-banner.css
new file mode 100644
index 00000000..067b0df0
--- /dev/null
+++ b/docs/md_v2/assets/cloud-banner.css
@@ -0,0 +1,67 @@
+/* The Crawl4AI Cloud announcement banner (overrides/partials/cloud-banner.html).
+ Three states set on <html data-c4b>: big · small · off. The accent is the amber of the landing
+ (#d9a441) on the docs' dark ground; the fonts and the base colours come from the site's own tokens. */
+:root{--c4b-amber:#d9a441;--c4b-ink:#1a1200;--c4b-dim:rgba(217,164,65,.14);--c4b-line:rgba(217,164,65,.5);--c4b-hair:#3f3f44;--c4b-muted:#a3abba;--c4b-faint:#8b857a;--c4b-beige:#d5cec0;--c4b-cyan:#4AE6E5;--c4b-teal:#09b5a5}
+
+/* the wrap sits in flow right under the fixed header; the main container then needs no header padding */
+.c4b-wrap{position:relative;z-index:950;margin-top:var(--header-height,65px);font-family:var(--font-stack);line-height:1.5}
+html[data-c4b="big"] .container:has(.terminal-mkdocs-main-grid),html[data-c4b="small"] .container:has(.terminal-mkdocs-main-grid){padding-top:0}
+html[data-c4b="off"] .c4b-wrap{display:none}
+/* the fixed side panel (z 900, top = the header) moves down by the banner height still on screen */
+html[data-c4b="big"] #terminal-mkdocs-side-panel,html[data-c4b="small"] #terminal-mkdocs-side-panel{top:calc(var(--header-height,65px) + var(--c4b-offset,0px))}
+.c4b-big,.c4b-small{display:none}
+html[data-c4b="big"] .c4b-big,html:not([data-c4b]) .c4b-big{display:block}
+html[data-c4b="small"] .c4b-small{display:flex}
+.c4b-wrap *{box-sizing:border-box}
+.c4b-wrap a{text-decoration:none}
+
+/* ---- big ---- */
+.c4b-big{position:relative;overflow:hidden;background:linear-gradient(180deg,#0e0d06 0%,#0a0a0b 100%);border-bottom:1px solid var(--c4b-line)}
+.c4b-big::before{content:"";position:absolute;inset:0;pointer-events:none;background:radial-gradient(900px 260px at 18% -20%,rgba(217,164,65,.18),transparent 60%),radial-gradient(600px 220px at 92% 120%,rgba(9,181,165,.14),transparent 60%)}
+.c4b-in{position:relative;max-width:1440px;margin:0 auto;padding:26px 24px 22px;display:grid;grid-template-columns:minmax(0,1.05fr) minmax(0,1fr);gap:34px;align-items:start}
+.c4b-eyebrow{display:inline-flex;align-items:center;gap:10px;font-size:12px;letter-spacing:.14em;text-transform:uppercase;color:var(--c4b-amber)}
+.c4b-tag{background:var(--c4b-amber);color:var(--c4b-ink);padding:2px 8px;font-weight:700;letter-spacing:.1em}
+/* the theme sizes every h2 and em; these win by specificity */
+.c4b-wrap h2.c4b-title{font-size:30px;line-height:1.15;font-weight:700;margin:12px 0 10px;padding:0;color:var(--font-color);text-wrap:balance}
+.c4b-wrap h2.c4b-title em{font-style:normal;font-size:inherit;font-weight:inherit;color:var(--c4b-amber)}
+.c4b-lead{color:var(--font-color);font-size:14.5px;line-height:1.55;max-width:56ch;margin:0 0 6px}
+.c4b-lead b{font-weight:700;color:var(--c4b-cyan)}
+.c4b-oss{color:var(--c4b-muted);font-size:12.5px;margin:8px 0 18px;max-width:60ch}
+.c4b-oss b{color:var(--font-color);font-weight:400}
+.c4b-cta{display:flex;flex-wrap:wrap;gap:12px;align-items:center}
+.c4b-btn{font:inherit;font-size:13.5px;padding:10px 16px;border:1px solid var(--c4b-amber);background:var(--c4b-amber);color:var(--c4b-ink)!important;font-weight:700;letter-spacing:.02em;display:inline-flex;align-items:center;gap:8px}
+.c4b-btn:hover{background:#e6b45a;text-decoration:none}
+.c4b-ghost{background:transparent;color:var(--c4b-amber)!important;font-weight:400}
+.c4b-ghost:hover{background:var(--c4b-dim)}
+.c4b-meta{display:flex;gap:18px;flex-wrap:wrap;color:var(--c4b-faint);font-size:12px;margin-top:16px}
+.c4b-meta span::before{content:"✓ ";color:var(--c4b-teal)}
+.c4b-meta b{color:var(--c4b-amber);font-weight:700}
+.c4b-paste{border:1px solid var(--c4b-line);background:rgba(0,0,0,.45);box-shadow:0 0 0 1px rgba(0,0,0,.3),0 18px 40px -24px rgba(217,164,65,.4)}
+.c4b-tabs{display:flex;border-bottom:1px solid var(--c4b-hair);overflow-x:auto}
+.c4b-tabs button{font:inherit;font-size:12.5px;background:none;border:0;border-right:1px solid var(--c4b-hair);color:var(--c4b-muted);padding:9px 14px;cursor:pointer;white-space:nowrap;margin:0}
+.c4b-tabs button[aria-selected="true"]{color:var(--c4b-amber);background:var(--c4b-dim)}
+.c4b-tabs button:last-child{border-right:0}
+.c4b-code{position:relative;padding:16px 16px 14px;margin:0;border:0;background:transparent;font-size:12.5px;line-height:1.55;overflow-x:auto;color:var(--c4b-beige);white-space:pre;font-family:var(--font-stack)}
+.c4b-code .c4b-k{color:var(--c4b-amber);background:var(--c4b-dim);padding:0 3px}
+.c4b-code .c4b-cmt{color:var(--c4b-faint)}
+.c4b-copy{position:absolute;top:10px;right:10px;font:inherit;font-size:11.5px;border:1px solid var(--c4b-hair);background:#202020;color:var(--c4b-muted);padding:4px 9px;cursor:pointer;margin:0}
+.c4b-copy:hover{color:var(--font-color);border-color:var(--c4b-muted)}
+.c4b-foot{display:flex;justify-content:space-between;align-items:center;gap:12px;border-top:1px solid var(--c4b-hair);padding:9px 14px;font-size:12px;color:var(--c4b-muted)}
+.c4b-foot a{color:var(--c4b-cyan)}
+.c4b-x{position:absolute;top:14px;right:18px;font:inherit;font-size:20px;line-height:1;border:0;background:none;color:var(--c4b-muted);cursor:pointer;padding:4px 6px;margin:0}
+.c4b-x:hover{color:var(--font-color)}
+.c4b-hide{position:absolute;bottom:12px;right:20px;width:auto;display:flex;align-items:center;gap:7px;color:var(--c4b-faint);font-size:12px;cursor:pointer}
+.c4b-hide input{accent-color:var(--c4b-amber);margin:0;width:auto}
+
+/* ---- small: solid amber, dark ink ---- */
+.c4b-small{align-items:center;gap:14px;background:var(--c4b-amber);color:var(--c4b-ink);border-bottom:1px solid #a87a20;padding:0 24px;height:40px;font-size:13px}
+.c4b-star{color:var(--c4b-ink)}
+.c4b-t{color:var(--c4b-ink);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
+.c4b-t b{font-weight:700}
+.c4b-sp{flex:1}
+.c4b-go{color:var(--c4b-ink)!important;font-weight:700;white-space:nowrap;border-bottom:1px solid var(--c4b-ink)}
+.c4b-small button{font:inherit;font-size:12px;background:none;border:1px solid rgba(26,18,0,.45);color:var(--c4b-ink);padding:3px 9px;cursor:pointer;white-space:nowrap;margin:0}
+.c4b-small button:hover{background:rgba(26,18,0,.1)}
+
+@media (max-width:1100px){.c4b-in{grid-template-columns:1fr;gap:18px}.c4b-hide{position:static;width:auto;margin:10px 24px 14px}.c4b-wrap h2.c4b-title{font-size:24px}}
+@media (max-width:600px){.c4b-in{padding:20px 16px 14px}.c4b-small{height:auto;padding:8px 14px;flex-wrap:wrap;gap:8px}.c4b-t{white-space:normal}}
diff --git a/docs/md_v2/assets/cloud-banner.js b/docs/md_v2/assets/cloud-banner.js
new file mode 100644
index 00000000..11903ba0
--- /dev/null
+++ b/docs/md_v2/assets/cloud-banner.js
@@ -0,0 +1,73 @@
+/* The Crawl4AI Cloud banner: the paste block per client, the state per browser, the events.
+ State: `c4-cloud-banner` in localStorage = {version, state}; the pre-paint script in overrides/main.html
+ already set <html data-c4b>. Events go to the gate's beacon sink as one small POST per click (a click
+ usually leaves the page, so nothing is batched); DNT and GPC turn the events off, never the banner. */
+(function () {
+ "use strict";
+ /* the theme loads this file in <head>: wait for the markup when the page is still parsing */
+ if (document.readyState === "loading") { document.addEventListener("DOMContentLoaded", init); } else { init(); }
+ function init() {
+ var root = document.getElementById("c4b"); if (!root) return;
+ var html = document.documentElement, code = document.getElementById("c4b-code");
+ var STORE = "c4-cloud-banner", VERSION = 1, SINK = "https://gate.crawl4ai.com/v1/t";
+ var KEY = '<span class="c4b-k">YOUR_KEY</span>';
+ var BLOCKS = {
+ claude: '<span class="c4b-cmt"># Claude Code · one line</span>\nclaude mcp add --transport http crawl4ai https://gate.crawl4ai.com/mcp \\\n --header "Authorization: Bearer ' + KEY + '"',
+ codex: '<span class="c4b-cmt"># Codex · ~/.codex/config.toml</span>\n[mcp_servers.crawl4ai]\nurl = "https://gate.crawl4ai.com/mcp"\nhttp_headers = { Authorization = "Bearer ' + KEY + '" }',
+ opencode: '<span class="c4b-cmt"># OpenCode · opencode.json</span>\n{ "mcp": { "crawl4ai": {\n "type": "remote",\n "url": "https://gate.crawl4ai.com/mcp",\n "headers": { "Authorization": "Bearer ' + KEY + '" } } } }',
+ cursor: '<span class="c4b-cmt"># Cursor · .cursor/mcp.json</span>\n{ "mcpServers": { "crawl4ai": {\n "url": "https://gate.crawl4ai.com/mcp",\n "headers": { "Authorization": "Bearer ' + KEY + '" } } } }',
+ curl: '<span class="c4b-cmt"># curl · one request</span>\ncurl -s "https://gate.crawl4ai.com/search?q=web+scraping+in+2026" \\\n -H "Authorization: Bearer ' + KEY + '"'
+ };
+
+ /* ---- the anonymous id (the same shape as the landing's beacon) and the event sender ---- */
+ var quiet = navigator.doNotTrack == "1" || navigator.doNotTrack == "yes" || window.globalPrivacyControl;
+ var anon = "";
+ try { anon = localStorage.getItem("c4a") || ""; if (!anon) { anon = Array.from(crypto.getRandomValues(new Uint8Array(8))).map(function (b) { return b.toString(16).padStart(2, "0"); }).join(""); localStorage.setItem("c4a", anon); } } catch (e) {}
+ function ev(name, props) {
+ if (quiet) return;
+ props = props || {}; props.pg = "docs"; props.path = location.pathname; props.state = html.getAttribute("data-c4b") || "big";
+ var body = JSON.stringify({ a: anon, e: [{ n: name, p: props }] });
+ try { if (navigator.sendBeacon) navigator.sendBeacon(SINK, new Blob([body], { type: "text/plain" })); else fetch(SINK, { method: "POST", body: body, keepalive: true, mode: "no-cors" }); } catch (e) {}
+ }
+ /* the anonymous id rides every link to crawl4ai.com, so the landing can tie the signup to this visitor */
+ if (anon && !quiet) root.querySelectorAll('a[href^="https://crawl4ai.com"]').forEach(function (a) { a.href += "&aid=" + anon; });
+
+ /* ---- the state ---- */
+ function save(state) { try { localStorage.setItem(STORE, JSON.stringify({ version: VERSION, state: state })); } catch (e) {} }
+ function show(state) { html.setAttribute("data-c4b", state); save(state); if (state !== "off") ev("banner_shown"); }
+
+ /* ---- the paste block ---- */
+ function pick(client) {
+ root.querySelectorAll(".c4b-tabs button").forEach(function (b) { b.setAttribute("aria-selected", b.getAttribute("data-c4b-client") === client); });
+ code.innerHTML = BLOCKS[client] + '<button type="button" class="c4b-copy" data-c4b-act="copy">copy</button>';
+ code.setAttribute("data-client", client);
+ }
+
+ root.addEventListener("click", function (e) {
+ var t = e.target.closest("[data-c4b-act],[data-c4b-client],[data-c4b-ev]"); if (!t) return;
+ if (t.hasAttribute("data-c4b-ev")) { ev(t.getAttribute("data-c4b-ev")); return; }
+ var client = t.getAttribute("data-c4b-client"), act = t.getAttribute("data-c4b-act");
+ if (client) { pick(client); ev("banner_client_picked", { client: client }); }
+ if (act === "copy") {
+ var txt = code.innerText.replace(/copy$/, "").trim();
+ try { navigator.clipboard.writeText(txt); } catch (e) {}
+ t.textContent = "copied"; setTimeout(function () { t.textContent = "copy"; }, 1200);
+ ev("banner_copy_clicked", { client: code.getAttribute("data-client") });
+ }
+ if (act === "close") { if (document.getElementById("c4b-never").checked) { ev("banner_hidden_forever"); show("off"); } else { ev("banner_closed"); show("small"); } }
+ if (act === "expand") { ev("banner_expanded"); show("big"); }
+ });
+
+ /* the fixed side panel starts under the header; while the banner is in view it must start under the
+ banner too: --c4b-offset = the banner height still on screen, updated on scroll and resize */
+ function offset() { var h = root.getBoundingClientRect().height, y = window.scrollY || 0; html.style.setProperty("--c4b-offset", Math.max(0, h - y) + "px"); }
+ var tick = false;
+ function onScroll() { if (tick) return; tick = true; requestAnimationFrame(function () { offset(); tick = false; }); }
+ addEventListener("scroll", onScroll, { passive: true }); addEventListener("resize", onScroll);
+ new MutationObserver(offset).observe(html, { attributes: true, attributeFilter: ["data-c4b"] });
+ offset();
+
+ pick("claude");
+ if ((html.getAttribute("data-c4b") || "big") !== "off") ev("banner_shown");
+ }
+})();
diff --git a/docs/md_v2/overrides/main.html b/docs/md_v2/overrides/main.html
index a072d48e..79fce59a 100644
--- a/docs/md_v2/overrides/main.html
+++ b/docs/md_v2/overrides/main.html
@@ -6,6 +6,13 @@
<script>
document.documentElement.setAttribute("data-theme", "dark");
</script>
+<script>
+/* the cloud banner's state before the first paint: big (default) · small (after close) · off (after
+ "don't show this again"); a signed-in cloud user (the c4_user marker cookie on .crawl4ai.com) gets small */
+(function(){try{var v=JSON.parse(localStorage.getItem("c4-cloud-banner")||"null");var s=(v&&v.version===1)?v.state:"big";
+if(s==="big"&&/(^|; )c4_user=1(;|$)/.test(document.cookie))s="small";document.documentElement.setAttribute("data-c4b",s);}
+catch(e){document.documentElement.setAttribute("data-c4b","big");}})();
+</script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/pushfeedback/dist/pushfeedback/pushfeedback.css">
<style>
@@ -39,6 +46,11 @@
src="https://cdn.jsdelivr.net/npm/pushfeedback@latest/dist/pushfeedback/pushfeedback.esm.js"></script>
{% endblock %}
+{% block top_nav %}
+{{ super() }}
+{% include "partials/cloud-banner.html" %}
+{% endblock %}
+
{% block footer %}
<feedback-button project="w8plzp8vjp" button-style="dark" button-position="center-right" modal-position="sidebar-right">
>
diff --git a/docs/md_v2/overrides/partials/cloud-banner.html b/docs/md_v2/overrides/partials/cloud-banner.html
new file mode 100644
index 00000000..8826d11b
--- /dev/null
+++ b/docs/md_v2/overrides/partials/cloud-banner.html
@@ -0,0 +1,45 @@
+{#- The Crawl4AI Cloud announcement: a big banner (the news + the paste block for an agent), a small
+ one-line banner after "close", nothing after "don't show this again". The state lives per browser
+ in localStorage (`c4-cloud-banner`, with a version so a later announcement can return once); the
+ pre-paint script in main.html sets `data-c4b` on <html> so the right state renders without a flash.
+ Styles: assets/cloud-banner.css · behaviour + events: assets/cloud-banner.js -#}
+<div id="c4b" class="c4b-wrap">
+
+ <section class="c4b-big" aria-label="Crawl4AI Cloud is live">
+ <div class="c4b-in">
+ <div class="c4b-text">
+ <div class="c4b-eyebrow"><span class="c4b-tag">New</span> good news for everyone who runs Crawl4AI</div>
+ <h2 class="c4b-title">Crawl4AI <em>Cloud</em> is live.<br>The same crawler, hosted.</h2>
+ <p class="c4b-lead">No browsers to run, no proxies to buy, no cookies to babysit. One key with <b>$5 of free credit</b>, and your AI agent can <b>search, scrape, crawl and extract</b> the web through the same engine you already use.</p>
+ <p class="c4b-oss"><b>Always open source, forever.</b> The library stays here and stays free. The cloud is for the days you want to build fast and let us run the infrastructure.</p>
+ <div class="c4b-cta">
+ <a class="c4b-btn" href="https://crawl4ai.com/?ref=docs-banner" data-c4b-ev="banner_key_clicked">Get a key + $5 free credit →</a>
+ <a class="c4b-btn c4b-ghost" href="https://crawl4ai.com/?ref=docs-banner" data-c4b-ev="banner_cloud_clicked">See Crawl4AI Cloud</a>
+ </div>
+ <div class="c4b-meta"><span>no card</span><span><b>$5 free credit</b> to start</span><span>EU · Singapore · US</span><span>MCP built in</span></div>
+ </div>
+ <div class="c4b-paste" aria-label="Paste this into your agent">
+ <div class="c4b-tabs" role="tablist">
+ <button type="button" role="tab" aria-selected="true" data-c4b-client="claude">Claude Code</button>
+ <button type="button" role="tab" aria-selected="false" data-c4b-client="codex">Codex</button>
+ <button type="button" role="tab" aria-selected="false" data-c4b-client="opencode">OpenCode</button>
+ <button type="button" role="tab" aria-selected="false" data-c4b-client="cursor">Cursor</button>
+ <button type="button" role="tab" aria-selected="false" data-c4b-client="curl">curl</button>
+ </div>
+ <pre class="c4b-code" id="c4b-code"></pre>
+ <div class="c4b-foot"><span>Paste it once. Your agent gets the whole web.</span><a href="https://crawl4ai.com/docs?ref=docs-banner" data-c4b-ev="banner_docs_clicked">cloud docs →</a></div>
+ </div>
+ </div>
+ <button type="button" class="c4b-x" aria-label="Close" data-c4b-act="close">×</button>
+ <label class="c4b-hide"><input type="checkbox" id="c4b-never"> don't show this again</label>
+ </section>
+
+ <div class="c4b-small">
+ <span class="c4b-star">★</span>
+ <span class="c4b-t"><b>Crawl4AI Cloud is live</b> — the same crawler, hosted. Get a key with $5 free credit and paste one line into your agent.</span>
+ <span class="c4b-sp"></span>
+ <a class="c4b-go" href="https://crawl4ai.com/?ref=docs-banner" data-c4b-ev="banner_key_clicked">Get a key →</a>
+ <button type="button" data-c4b-act="expand">show</button>
+ </div>
+
+</div>
diff --git a/mkdocs.yml b/mkdocs.yml
index d821526c..cb26bb8d 100644
--- a/mkdocs.yml
+++ b/mkdocs.yml
@@ -113,6 +113,7 @@ extra_css:
- assets/dmvendor.css
- assets/feedback-overrides.css
- assets/page_actions.css
+ - assets/cloud-banner.css
extra_javascript:
- https://www.googletagmanager.com/gtag/js?id=G-58W0K2ZQ25
@@ -126,4 +127,5 @@ extra_javascript:
- assets/copy_code.js
- assets/floating_ask_ai_button.js
- assets/mobile_menu.js
+ - assets/cloud-banner.js
- assets/page_actions.js?v=20251006
\ No newline at end of file