Spaces:
Running
Running
Add ai-api-request-tracing
Browse files- ai-api-request-tracing.html +147 -0
- index.html +1 -1
ai-api-request-tracing.html
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
| 6 |
+
<title>Trace an AI API Request Across Every Attempt | Modelflare Blog</title>
|
| 7 |
+
<meta name="description" content="Trace an AI API Request Across Every Attempt: reproducible evidence, failure checks, bounded rollout, and clear production limits."><meta property="og:image" content="https://modelflare-blog.static.hf.space/images/ai-api-request-tracing-cover.jpg"><meta property="og:image:width" content="1200"><meta property="og:image:height" content="675"><meta property="og:title" content="Trace an AI API Request Across Every Attempt"><meta property="og:description" content="Trace an AI API Request Across Every Attempt: reproducible evidence, failure checks, bounded rollout, and clear production limits."><meta property="og:type" content="article"><meta property="og:url" content="https://modelflare-blog.static.hf.space/ai-api-request-tracing.html"><meta property="og:site_name" content="Modelflare Blog"><meta property="article:published_time" content="2026-10-31"><link rel="canonical" href="https://modelflare.dev/articles/ai-api-request-tracing"><meta name="twitter:card" content="summary_large_image"><meta name="twitter:title" content="Trace an AI API Request Across Every Attempt"><meta name="twitter:description" content="Trace an AI API Request Across Every Attempt: reproducible evidence, failure checks, bounded rollout, and clear production limits."><meta name="twitter:image" content="https://modelflare-blog.static.hf.space/images/ai-api-request-tracing-cover.jpg">
|
| 8 |
+
<style>
|
| 9 |
+
:root{--bg:#0b1020;--card:#121a2f;--text:#e8ecf7;--muted:#9aa6c2;--accent:#8b5cf6;--accent2:#ec4899;--border:rgba(255,255,255,.08)}
|
| 10 |
+
*{box-sizing:border-box}
|
| 11 |
+
body{margin:0;font-family:ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,sans-serif;background:radial-gradient(1200px 600px at 10% -10%,#2a1850 0%,transparent 50%),radial-gradient(900px 500px at 100% 0%,#3b0f2e 0%,transparent 45%),var(--bg);color:var(--text);min-height:100vh;line-height:1.65}
|
| 12 |
+
.wrap{max-width:860px;margin:0 auto;padding:28px 18px 64px}
|
| 13 |
+
header.top{display:flex;flex-wrap:wrap;gap:14px;align-items:center;justify-content:space-between;margin-bottom:28px;font-size:14px}
|
| 14 |
+
header.top a{color:var(--muted);text-decoration:none}header.top a:hover{color:#fff}
|
| 15 |
+
header.top .brand{color:#fff;font-weight:700;font-size:16px}
|
| 16 |
+
header.top nav{display:flex;flex-wrap:wrap;gap:14px}
|
| 17 |
+
h1{font-size:clamp(26px,4.6vw,38px);line-height:1.2;margin:0 0 12px}
|
| 18 |
+
h2{font-size:22px;margin:36px 0 10px}h3{font-size:17px;margin:24px 0 8px;color:#d6c7ff}
|
| 19 |
+
p,li{color:#cfd6e8}a{color:#c4b5fd}
|
| 20 |
+
.lead{color:var(--muted);font-size:17px}
|
| 21 |
+
article img{max-width:100%;height:auto;border-radius:12px;border:1px solid var(--border);display:block;margin:18px auto 6px}
|
| 22 |
+
article p em:only-child{display:block;text-align:center;color:var(--muted);font-size:14px}
|
| 23 |
+
pre{background:#070b16;border:1px solid var(--border);border-radius:12px;padding:0;overflow-x:auto}
|
| 24 |
+
pre code.hljs{background:transparent;padding:14px 16px;font-size:13.5px;line-height:1.55}
|
| 25 |
+
code{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:.92em}
|
| 26 |
+
p code,li code,td code{background:rgba(139,92,246,.14);padding:1px 5px;border-radius:5px}
|
| 27 |
+
table{border-collapse:collapse;width:100%;font-size:14px;margin:14px 0;display:block;overflow-x:auto}
|
| 28 |
+
th,td{border:1px solid var(--border);padding:8px 10px;text-align:left;vertical-align:top}th{background:var(--card)}
|
| 29 |
+
hr{border:0;border-top:1px solid var(--border);margin:32px 0}
|
| 30 |
+
.list{display:grid;gap:14px}
|
| 31 |
+
.card{display:flex;gap:16px;background:var(--card);border:1px solid var(--border);border-radius:16px;padding:18px;text-decoration:none;color:inherit}
|
| 32 |
+
.card:hover{border-color:rgba(139,92,246,.5)}
|
| 33 |
+
.card img{width:200px;height:105px;object-fit:cover;border-radius:10px;flex-shrink:0}
|
| 34 |
+
.card h2{font-size:18px;margin:0 0 6px;color:#fff}.card p{margin:0;color:var(--muted);font-size:14px}
|
| 35 |
+
footer{margin-top:48px;padding-top:18px;border-top:1px solid var(--border);color:var(--muted);font-size:13px}
|
| 36 |
+
footer a{color:var(--muted)}
|
| 37 |
+
@media(max-width:600px){.card{flex-direction:column}.card img{width:100%;height:auto;aspect-ratio:1200/630}}
|
| 38 |
+
</style>
|
| 39 |
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@highlightjs/cdn-assets@11.9.0/styles/github-dark.min.css"><script src="https://cdn.jsdelivr.net/npm/@highlightjs/cdn-assets@11.9.0/highlight.min.js"></script><script>document.addEventListener("DOMContentLoaded",()=>hljs.highlightAll());</script>
|
| 40 |
+
</head>
|
| 41 |
+
<body><div class="wrap"><header class="top"><a class="brand" href="index.html">Modelflare Blog</a><nav><a href="https://modelflare.dev/?utm_source=huggingface&utm_medium=space&utm_campaign=blog">modelflare.dev</a><a href="https://docs.modelflare.dev/?utm_source=huggingface&utm_medium=space&utm_campaign=blog">Docs</a><a href="https://castaly.modelflare.dev/?utm_source=huggingface&utm_medium=space&utm_campaign=blog">Castaly</a><a href="https://huggingface.co/Modelflare" target="_top">Hugging Face org</a></nav></header>
|
| 42 |
+
<article><h1>Trace an AI API Request Across Every Attempt</h1>
|
| 43 |
+
<p class="lead">Trace an AI API Request Across Every Attempt: reproducible evidence, failure checks, bounded rollout, and clear production limits.</p>
|
| 44 |
+
<img src="images/ai-api-request-tracing-cover.jpg" alt="Cover for Trace an AI API Request Across Every Attempt">
|
| 45 |
+
<hr />
|
| 46 |
+
<p>Disclosure: I work on <a href="https://modelflare.dev/?source=hf-blog">Modelflare</a>, an OpenAI-compatible AI API gateway. The canonical version of this article lives on <a href="https://modelflare.dev/articles/ai-api-request-tracing?source=hf-blog">modelflare.dev</a>.</p>
|
| 47 |
+
<h2>Decision first</h2>
|
| 48 |
+
<p><strong>Trace an AI API Request Across Every Attempt</strong> is an explicit production contract, not an isolated code change. Define the success signal, terminal failure state, and rollback condition before moving traffic. The artifact below separates evidence from assumption and keeps every attempt attributable.</p>
|
| 49 |
+
<p>Start with <code>request</code>, prove <code>attempt</code> under a deterministic case, and make <code>privacy</code> a release gate rather than a follow-up task.</p>
|
| 50 |
+
<h2>The reusable artifact</h2>
|
| 51 |
+
<p>Use this table as the review record. A row passes only when its evidence comes from the same request, test window, or configuration snapshot.</p>
|
| 52 |
+
<table>
|
| 53 |
+
<thead>
|
| 54 |
+
<tr>
|
| 55 |
+
<th>Checkpoint</th>
|
| 56 |
+
<th>Evidence to capture</th>
|
| 57 |
+
<th>Pass condition</th>
|
| 58 |
+
</tr>
|
| 59 |
+
</thead>
|
| 60 |
+
<tbody>
|
| 61 |
+
<tr>
|
| 62 |
+
<td><code>request</code></td>
|
| 63 |
+
<td><code>request_id,tenant_pseudonym,operation,accepted_at</code></td>
|
| 64 |
+
<td>The record joins to one logical request and one concrete attempt.</td>
|
| 65 |
+
</tr>
|
| 66 |
+
<tr>
|
| 67 |
+
<td><code>attempt</code></td>
|
| 68 |
+
<td><code>attempt_number,route_version,model,channel_pseudonym</code></td>
|
| 69 |
+
<td>The record joins to one logical request and one concrete attempt.</td>
|
| 70 |
+
</tr>
|
| 71 |
+
<tr>
|
| 72 |
+
<td><code>timing</code></td>
|
| 73 |
+
<td><code>connect,headers,first_event,first_output,idle,total</code></td>
|
| 74 |
+
<td>The value is exact, preserved, and compared at the wire boundary.</td>
|
| 75 |
+
</tr>
|
| 76 |
+
<tr>
|
| 77 |
+
<td><code>terminal</code></td>
|
| 78 |
+
<td><code>HTTP,provider_class,cancellation_source,retry_decision</code></td>
|
| 79 |
+
<td>The owner, source, checked date, and known limitation are recorded.</td>
|
| 80 |
+
</tr>
|
| 81 |
+
<tr>
|
| 82 |
+
<td><code>usage</code></td>
|
| 83 |
+
<td><code>normalized_input/output/cache_categories_and_provenance</code></td>
|
| 84 |
+
<td>Reserved, observed, and final values reconcile through one durable ledger.</td>
|
| 85 |
+
</tr>
|
| 86 |
+
<tr>
|
| 87 |
+
<td><code>privacy</code></td>
|
| 88 |
+
<td><code>allowlisted_attributes_only;no_prompt,secret,or_raw_arguments</code></td>
|
| 89 |
+
<td>The limit is explicit and the request fails closed when it is exceeded.</td>
|
| 90 |
+
</tr>
|
| 91 |
+
</tbody>
|
| 92 |
+
</table>
|
| 93 |
+
<h2>Worked example</h2>
|
| 94 |
+
<p>The example is synthetic and deterministic. Replace identifiers and thresholds with reviewed values from your own workload; never paste production secrets or customer prompts into a test fixture.</p>
|
| 95 |
+
<pre><code>trace_id: 7f3a...synthetic
|
| 96 |
+
request_id: req_demo_001
|
| 97 |
+
operation: responses
|
| 98 |
+
attempts:
|
| 99 |
+
- attempt: 1
|
| 100 |
+
route_version: rv_42
|
| 101 |
+
model: model_alias
|
| 102 |
+
timings_ms: { headers: 812, first_output: 1240, total: 3100 }
|
| 103 |
+
terminal: upstream_503
|
| 104 |
+
- attempt: 2
|
| 105 |
+
timings_ms: { headers: 620, first_output: 980, total: 2400 }
|
| 106 |
+
terminal: success
|
| 107 |
+
usage: { input: 1800, output: 220, source: provider_normalized }
|
| 108 |
+
</code></pre>
|
| 109 |
+
<h2>Implementation procedure</h2>
|
| 110 |
+
<ol>
|
| 111 |
+
<li>Freeze the current request, response, configuration, and observable baseline before changing behavior.</li>
|
| 112 |
+
<li>Run one deterministic positive case and retain the complete client-visible result.</li>
|
| 113 |
+
<li>Run the paired negative or limit case so failure behavior is proved rather than inferred.</li>
|
| 114 |
+
<li>Join every attempt to one logical request ID, then record timing, terminal state, and usage without sensitive content.</li>
|
| 115 |
+
<li>Roll out through a bounded cohort with explicit stop conditions; do not widen traffic merely because the happy path passed.</li>
|
| 116 |
+
<li>Re-read the durable state and public behavior after the change, and execute the prepared rollback if any invariant fails.</li>
|
| 117 |
+
</ol>
|
| 118 |
+
<h2>Failure modes</h2>
|
| 119 |
+
<p>The following failures invalidate the result even when the outer HTTP request appears successful:</p>
|
| 120 |
+
<ul>
|
| 121 |
+
<li>Prompts, credentials, raw tool arguments, or provider payloads are copied into high-cardinality telemetry.</li>
|
| 122 |
+
<li>Parallel calls or streamed fragments are correlated by array position instead of a stable call identifier.</li>
|
| 123 |
+
<li>The integration reads one convenience field and silently drops typed output items, tool calls, refusals, or partial results.</li>
|
| 124 |
+
<li>Percentiles are published without the workload distribution, concurrency, failures, region, and sample window.</li>
|
| 125 |
+
</ul>
|
| 126 |
+
<h2>Modelflare boundary</h2>
|
| 127 |
+
<p>Modelflare can centralize OpenAI-compatible routing, keys, groups, usage records, and failure handling, but a configured route is not proof that every upstream supports every optional field. Verify the selected model and channel with the native protocol path. Keep provider prices in the current pricing source, preserve explicit zero values, and treat the final durable settlement鈥攏ot an estimate鈥攁s billing truth.</p>
|
| 128 |
+
<p>Use the <a href="https://modelflare.dev/articles/ai-api-latency-metrics?source=hf-blog">parent guide</a> for the broader decision boundary and the <a href="https://modelflare.dev/docs?source=hf-blog">setup documents</a> for current client configuration.</p>
|
| 129 |
+
<h2>Publication checklist</h2>
|
| 130 |
+
<ul>
|
| 131 |
+
<li>The main question is answered before background material.</li>
|
| 132 |
+
<li>Every request field, status, metric, and formula has one named owner.</li>
|
| 133 |
+
<li>Examples use synthetic identifiers and contain no credential or customer data.</li>
|
| 134 |
+
<li>All supported locales preserve the same headings, tables, code, limits, and caveats.</li>
|
| 135 |
+
<li>Volatile API contracts, model support, and prices are rechecked at T-1 day; an invalidated claim moves the publication date.</li>
|
| 136 |
+
<li>Before the scheduled time, the public API, localized routes, and sitemap still exclude the article.</li>
|
| 137 |
+
</ul>
|
| 138 |
+
<h2>Sources and verification date</h2>
|
| 139 |
+
<p>Sources were checked on <strong>2026-08-07</strong>. They establish the external contract or operating principle; they do not prove support on an untested provider route.</p>
|
| 140 |
+
<ul>
|
| 141 |
+
<li><a href="https://www.w3.org/TR/trace-context/">W3C Trace Context</a></li>
|
| 142 |
+
<li><a href="https://opentelemetry.io/docs/specs/semconv/http/">OpenTelemetry HTTP semantic conventions</a></li>
|
| 143 |
+
</ul>
|
| 144 |
+
<hr />
|
| 145 |
+
<p>Canonical: https://modelflare.dev/articles/ai-api-request-tracing</p></article><p><a href="index.html">← All articles</a></p>
|
| 146 |
+
<footer>Modelflare on Hugging Face: <a href="https://huggingface.co/spaces/Modelflare/start" target="_top">start</a> 路 <a href="https://huggingface.co/spaces/Modelflare/openai-sdk" target="_top">openai-sdk</a> 路 <a href="https://huggingface.co/spaces/Modelflare/coding-agents" target="_top">coding-agents</a> 路 <a href="https://huggingface.co/spaces/Modelflare/api-recipes" target="_top">api-recipes</a> 路 <a href="https://huggingface.co/datasets/Modelflare/api-examples" target="_top">api-examples dataset</a><br>Business: <a href="mailto:business@modelflare.dev">business@modelflare.dev</a></footer></div></body>
|
| 147 |
+
</html>
|
index.html
CHANGED
|
@@ -39,6 +39,6 @@ footer a{color:var(--muted)}
|
|
| 39 |
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@highlightjs/cdn-assets@11.9.0/styles/github-dark.min.css"><script src="https://cdn.jsdelivr.net/npm/@highlightjs/cdn-assets@11.9.0/highlight.min.js"></script><script>document.addEventListener("DOMContentLoaded",()=>hljs.highlightAll());</script>
|
| 40 |
</head>
|
| 41 |
<body><div class="wrap"><header class="top"><a class="brand" href="index.html">Modelflare Blog</a><nav><a href="https://modelflare.dev/?utm_source=huggingface&utm_medium=space&utm_campaign=blog">modelflare.dev</a><a href="https://docs.modelflare.dev/?utm_source=huggingface&utm_medium=space&utm_campaign=blog">Docs</a><a href="https://castaly.modelflare.dev/?utm_source=huggingface&utm_medium=space&utm_campaign=blog">Castaly</a><a href="https://huggingface.co/Modelflare" target="_top">Hugging Face org</a></nav></header>
|
| 42 |
-
<h1>Modelflare Blog</h1><p class="lead">Engineering notes and setup guides for Modelflare, the API gateway for text, image, and video models, and for Castaly, the studio built on it.</p><div class="list"><a class="card" href="introducing-modelflare.html"><img src="images/introducing-modelflare-cover.jpg" alt="Diagram: one entry point routed to several model backends"><div><h2>Introducing Modelflare: one API key for text, image, and video models</h2><p>Modelflare is an API gateway that serves text, image, and video models behind one key, with OpenAI-compatible, Anthropic, and Gemini endpoints and per-request cost records.</p></div></a><a class="card" href="openai-sdk-one-line.html"><img src="images/openai-sdk-one-line-cover.jpg" alt="Diagram: a request passing through a compatible interface"><div><h2>Switching the OpenAI SDK to Modelflare (Python, JavaScript, curl)</h2><p>Existing OpenAI SDK code works with Modelflare after changing the base URL to <code>https://modelflare.dev/v1</code> and supplying a Modelflare key.</p></div></a><a class="card" href="coding-agents-modelflare.html"><img src="images/coding-agents-modelflare-cover.jpg" alt="Diagram: a coding agent connected through a gateway to several services"><div><h2>Configuring coding agents with Modelflare: Claude Code, Codex, OpenCode, Gemini CLI, CC-Switch, and Grok Build</h2><p>Claude Code connects through Anthropic Messages at <code>https://modelflare.dev</code>, Codex, OpenCode, and Grok Build through <code>https://modelflare.dev/v1</code>, and Gemini CLI through <code>GOOGLE_GEMINI_BASE_URL</code>. All of them use the same Modelflare key.</p></div></a><a class="card" href="api-recipes-streaming-fallback.html"><img src="images/api-recipes-streaming-fallback-cover.jpg" alt="Diagram: parallel routes converging with fallback paths"><div><h2>Modelflare API recipes: streaming, routing fallback, images, and async video</h2><p>Request examples for streaming chat, gateway-side fallback with group failover and Smart API Keys, client-side model fallback, image generation, and the asynchronous video task flow.</p></div></a><a class="card" href="smart-api-key.html"><img src="images/smart-api-key-cover.jpg" alt="Illustration: a key module feeding a single route"><div><h2>Smart API Keys: one key for every model your account can use</h2><p>A Smart API Key is bound to <code>auto</code> instead of a fixed routing group. It resolves a group on each request and orders candidates by a routing strategy that you choose.</p></div></a><a class="card" href="model-groups-and-failover.html"><img src="images/model-groups-and-failover-cover.jpg" alt="Illustration: parallel routes converging on one output"><div><h2>Model groups and failover: how Modelflare routes a request</h2><p>Every request depends on two identifiers: the exact model ID in the body and the routing group on the key. Ordinary keys add ordered fallback groups that take over when a route cannot serve the request.</p></div></a><a class="card" href="usage-and-cost-records.html"><img src="images/usage-and-cost-records-cover.jpg" alt="Illustration: a balance weighing request units"><div><h2>Usage and cost records: reading what each request cost</h2><p>Modelflare records token usage and cost for every request. This guide covers where those records live, how billing units differ between text, image, and video, the cache hit guarantee, and how long logs are kept.</p></div></a><a class="card" href="media-skill-for-agents.html"><img src="images/media-skill-for-agents-cover.jpg" alt="Illustration: media inputs feeding a processing unit and a film strip"><div><h2>The Modelflare Media Skill: image and video generation from coding agents</h2><p>The Media Skill is an installable SKILL.md package. With it, Claude Code, Codex, and other skill-aware agents can choose a Modelflare image or video model, quote its price, send the request, and save the result.</p></div></a><a class="card" href="seedance-asset-library.html"><img src="images/seedance-asset-library-cover.jpg" alt="Illustration: image and media tiles feeding a central processing unit"><div><h2>The Seedance asset library: uploading reference media and using asset:// IDs</h2><p>Seedance 2.0 and 2.5 do not accept a photorealistic person or a realistic face as an image URL. Upload the media to the asset library, poll until it is <code>Active</code>, and reference it as <code>asset://<ID></code> in a video request.</p></div></a><a class="card" href="codex-cli-in-depth.html"><img src="images/codex-cli-in-depth-cover.jpg" alt="Illustration: a keypad module sending requests through a panel to several backends"><div><h2>Codex CLI on Modelflare in depth: installer, config.toml, auth.json, and common problems</h2><p>Codex connects over the Responses API at <code>https://modelflare.dev/v1</code>. This guide covers the installer and the root/VPS variant with <code>MODELFLARE_ALLOW_ROOT=1</code>, every key in <code>config.toml</code>, the <code>auth.json</code> format, and the four documented problems.</p></div></a><a class="card" href="claude-code-in-depth.html"><img src="images/claude-code-in-depth-cover.jpg" alt="Illustration: a stack of request cards routed through one panel to several modules"><div><h2>Claude Code on Modelflare in depth: installer, settings.json, model slots, and troubleshooting</h2><p>Claude Code connects through Anthropic Messages with <code>ANTHROPIC_BASE_URL</code> set to <code>https://modelflare.dev</code>. This guide covers the installer and the root/VPS variant with <code>MODELFLARE_ALLOW_ROOT=1</code>, the <code>env</code> block in <code>settings.json</code>, the four model slots, and the documented error codes.</p></div></a><a class="card" href="castaly-image-video-studio.html"><img src="images/castaly-cover.jpg" alt="Castaly cover: orbital ring city"><div><h2>Castaly: an AI video and image studio built on Modelflare</h2><p>Castaly is a browser studio for AI image and video generation. Models are compared by specification and price, generations are paid from a wallet shared with Modelflare, and every model is also available through the Modelflare API.</p></div></a><a class="card" href="gpt-6-1-terra-deep-analysis.html"><img src="images/gpt-6-1-terra-deep-analysis-cover.jpg" alt="Illustration: a visual input panel wired through a reasoning dial to pointer tiles, above a long context strip"><div><h2>GPT-6.1 Terra: Capabilities, Parameters, Pricing, and Model Comparison</h2><p>A source-backed guide to GPT-6.1 Terra's visual reasoning, computer use, context limits, reasoning controls, pricing, and trade-offs against Astra, Sol, Luna, Claude Sonnet 5.5, and Gemini 3.8 Flash.</p></div></a><a class="card" href="llm-api-load-testing.html"><img src="images/llm-api-load-testing-cover.jpg" alt="Illustration for LLM API load testing guide"><div><h2>Load Test an LLM API Without Misleading Results</h2><p>Production guide: Load Test an LLM API Without Misleading Results. It includes a deterministic artifact, failure boundaries, rollout checks, and source-qualified limitations.</p></div></a><a class="card" href="function-calling-responses-vs-chat-completions.html"><img src="images/function-calling-responses-vs-chat-completions-cover.jpg" alt="Illustration: a request passing through one central module that fans out to several tool modules"><div><h2>Function Calling: Responses API vs Chat Completions</h2><p>A wire-level comparison of function definitions, Call IDs, result messages, streaming arguments, authorization, idempotency, and route compatibility.</p></div></a><a class="card" href="kimi-k3-1-pro-review-pricing.html"><img src="images/kimi-k3-1-pro-review-pricing-cover.jpg" alt="Cover for Kimi K3.1 Pro review"><div><h2>Kimi K3.1 Pro: Parameters, Capabilities, Prices, and Model Comparisons</h2><p>A detailed, source-backed guide to Kimi K3.1 Pro and Highspeed: 1M context, disclosed architecture, reasoning and tool controls, USD/CNY prices, Claude/GLM/DeepSeek comparisons, and reproducible token budgets.</p></div></a><a class="card" href="ai-api-backpressure.html"><img src="images/ai-api-backpressure-cover.jpg" alt="Cover for Apply Backpressure to AI API Workloads"><div><h2>Apply Backpressure to AI API Workloads</h2><p>A production guide to backpressure for AI API workloads: bounded in-flight work, deadline-aware queues, load shedding, fairness, failure tests, and stop signals.</p></div></a></div>
|
| 43 |
<footer>Modelflare on Hugging Face: <a href="https://huggingface.co/spaces/Modelflare/start" target="_top">start</a> 路 <a href="https://huggingface.co/spaces/Modelflare/openai-sdk" target="_top">openai-sdk</a> 路 <a href="https://huggingface.co/spaces/Modelflare/coding-agents" target="_top">coding-agents</a> 路 <a href="https://huggingface.co/spaces/Modelflare/api-recipes" target="_top">api-recipes</a> 路 <a href="https://huggingface.co/datasets/Modelflare/api-examples" target="_top">api-examples dataset</a><br>Business: <a href="mailto:business@modelflare.dev">business@modelflare.dev</a></footer></div></body>
|
| 44 |
</html>
|
|
|
|
| 39 |
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@highlightjs/cdn-assets@11.9.0/styles/github-dark.min.css"><script src="https://cdn.jsdelivr.net/npm/@highlightjs/cdn-assets@11.9.0/highlight.min.js"></script><script>document.addEventListener("DOMContentLoaded",()=>hljs.highlightAll());</script>
|
| 40 |
</head>
|
| 41 |
<body><div class="wrap"><header class="top"><a class="brand" href="index.html">Modelflare Blog</a><nav><a href="https://modelflare.dev/?utm_source=huggingface&utm_medium=space&utm_campaign=blog">modelflare.dev</a><a href="https://docs.modelflare.dev/?utm_source=huggingface&utm_medium=space&utm_campaign=blog">Docs</a><a href="https://castaly.modelflare.dev/?utm_source=huggingface&utm_medium=space&utm_campaign=blog">Castaly</a><a href="https://huggingface.co/Modelflare" target="_top">Hugging Face org</a></nav></header>
|
| 42 |
+
<h1>Modelflare Blog</h1><p class="lead">Engineering notes and setup guides for Modelflare, the API gateway for text, image, and video models, and for Castaly, the studio built on it.</p><div class="list"><a class="card" href="introducing-modelflare.html"><img src="images/introducing-modelflare-cover.jpg" alt="Diagram: one entry point routed to several model backends"><div><h2>Introducing Modelflare: one API key for text, image, and video models</h2><p>Modelflare is an API gateway that serves text, image, and video models behind one key, with OpenAI-compatible, Anthropic, and Gemini endpoints and per-request cost records.</p></div></a><a class="card" href="openai-sdk-one-line.html"><img src="images/openai-sdk-one-line-cover.jpg" alt="Diagram: a request passing through a compatible interface"><div><h2>Switching the OpenAI SDK to Modelflare (Python, JavaScript, curl)</h2><p>Existing OpenAI SDK code works with Modelflare after changing the base URL to <code>https://modelflare.dev/v1</code> and supplying a Modelflare key.</p></div></a><a class="card" href="coding-agents-modelflare.html"><img src="images/coding-agents-modelflare-cover.jpg" alt="Diagram: a coding agent connected through a gateway to several services"><div><h2>Configuring coding agents with Modelflare: Claude Code, Codex, OpenCode, Gemini CLI, CC-Switch, and Grok Build</h2><p>Claude Code connects through Anthropic Messages at <code>https://modelflare.dev</code>, Codex, OpenCode, and Grok Build through <code>https://modelflare.dev/v1</code>, and Gemini CLI through <code>GOOGLE_GEMINI_BASE_URL</code>. All of them use the same Modelflare key.</p></div></a><a class="card" href="api-recipes-streaming-fallback.html"><img src="images/api-recipes-streaming-fallback-cover.jpg" alt="Diagram: parallel routes converging with fallback paths"><div><h2>Modelflare API recipes: streaming, routing fallback, images, and async video</h2><p>Request examples for streaming chat, gateway-side fallback with group failover and Smart API Keys, client-side model fallback, image generation, and the asynchronous video task flow.</p></div></a><a class="card" href="smart-api-key.html"><img src="images/smart-api-key-cover.jpg" alt="Illustration: a key module feeding a single route"><div><h2>Smart API Keys: one key for every model your account can use</h2><p>A Smart API Key is bound to <code>auto</code> instead of a fixed routing group. It resolves a group on each request and orders candidates by a routing strategy that you choose.</p></div></a><a class="card" href="model-groups-and-failover.html"><img src="images/model-groups-and-failover-cover.jpg" alt="Illustration: parallel routes converging on one output"><div><h2>Model groups and failover: how Modelflare routes a request</h2><p>Every request depends on two identifiers: the exact model ID in the body and the routing group on the key. Ordinary keys add ordered fallback groups that take over when a route cannot serve the request.</p></div></a><a class="card" href="usage-and-cost-records.html"><img src="images/usage-and-cost-records-cover.jpg" alt="Illustration: a balance weighing request units"><div><h2>Usage and cost records: reading what each request cost</h2><p>Modelflare records token usage and cost for every request. This guide covers where those records live, how billing units differ between text, image, and video, the cache hit guarantee, and how long logs are kept.</p></div></a><a class="card" href="media-skill-for-agents.html"><img src="images/media-skill-for-agents-cover.jpg" alt="Illustration: media inputs feeding a processing unit and a film strip"><div><h2>The Modelflare Media Skill: image and video generation from coding agents</h2><p>The Media Skill is an installable SKILL.md package. With it, Claude Code, Codex, and other skill-aware agents can choose a Modelflare image or video model, quote its price, send the request, and save the result.</p></div></a><a class="card" href="seedance-asset-library.html"><img src="images/seedance-asset-library-cover.jpg" alt="Illustration: image and media tiles feeding a central processing unit"><div><h2>The Seedance asset library: uploading reference media and using asset:// IDs</h2><p>Seedance 2.0 and 2.5 do not accept a photorealistic person or a realistic face as an image URL. Upload the media to the asset library, poll until it is <code>Active</code>, and reference it as <code>asset://<ID></code> in a video request.</p></div></a><a class="card" href="codex-cli-in-depth.html"><img src="images/codex-cli-in-depth-cover.jpg" alt="Illustration: a keypad module sending requests through a panel to several backends"><div><h2>Codex CLI on Modelflare in depth: installer, config.toml, auth.json, and common problems</h2><p>Codex connects over the Responses API at <code>https://modelflare.dev/v1</code>. This guide covers the installer and the root/VPS variant with <code>MODELFLARE_ALLOW_ROOT=1</code>, every key in <code>config.toml</code>, the <code>auth.json</code> format, and the four documented problems.</p></div></a><a class="card" href="claude-code-in-depth.html"><img src="images/claude-code-in-depth-cover.jpg" alt="Illustration: a stack of request cards routed through one panel to several modules"><div><h2>Claude Code on Modelflare in depth: installer, settings.json, model slots, and troubleshooting</h2><p>Claude Code connects through Anthropic Messages with <code>ANTHROPIC_BASE_URL</code> set to <code>https://modelflare.dev</code>. This guide covers the installer and the root/VPS variant with <code>MODELFLARE_ALLOW_ROOT=1</code>, the <code>env</code> block in <code>settings.json</code>, the four model slots, and the documented error codes.</p></div></a><a class="card" href="castaly-image-video-studio.html"><img src="images/castaly-cover.jpg" alt="Castaly cover: orbital ring city"><div><h2>Castaly: an AI video and image studio built on Modelflare</h2><p>Castaly is a browser studio for AI image and video generation. Models are compared by specification and price, generations are paid from a wallet shared with Modelflare, and every model is also available through the Modelflare API.</p></div></a><a class="card" href="gpt-6-1-terra-deep-analysis.html"><img src="images/gpt-6-1-terra-deep-analysis-cover.jpg" alt="Illustration: a visual input panel wired through a reasoning dial to pointer tiles, above a long context strip"><div><h2>GPT-6.1 Terra: Capabilities, Parameters, Pricing, and Model Comparison</h2><p>A source-backed guide to GPT-6.1 Terra's visual reasoning, computer use, context limits, reasoning controls, pricing, and trade-offs against Astra, Sol, Luna, Claude Sonnet 5.5, and Gemini 3.8 Flash.</p></div></a><a class="card" href="llm-api-load-testing.html"><img src="images/llm-api-load-testing-cover.jpg" alt="Illustration for LLM API load testing guide"><div><h2>Load Test an LLM API Without Misleading Results</h2><p>Production guide: Load Test an LLM API Without Misleading Results. It includes a deterministic artifact, failure boundaries, rollout checks, and source-qualified limitations.</p></div></a><a class="card" href="function-calling-responses-vs-chat-completions.html"><img src="images/function-calling-responses-vs-chat-completions-cover.jpg" alt="Illustration: a request passing through one central module that fans out to several tool modules"><div><h2>Function Calling: Responses API vs Chat Completions</h2><p>A wire-level comparison of function definitions, Call IDs, result messages, streaming arguments, authorization, idempotency, and route compatibility.</p></div></a><a class="card" href="kimi-k3-1-pro-review-pricing.html"><img src="images/kimi-k3-1-pro-review-pricing-cover.jpg" alt="Cover for Kimi K3.1 Pro review"><div><h2>Kimi K3.1 Pro: Parameters, Capabilities, Prices, and Model Comparisons</h2><p>A detailed, source-backed guide to Kimi K3.1 Pro and Highspeed: 1M context, disclosed architecture, reasoning and tool controls, USD/CNY prices, Claude/GLM/DeepSeek comparisons, and reproducible token budgets.</p></div></a><a class="card" href="ai-api-backpressure.html"><img src="images/ai-api-backpressure-cover.jpg" alt="Cover for Apply Backpressure to AI API Workloads"><div><h2>Apply Backpressure to AI API Workloads</h2><p>A production guide to backpressure for AI API workloads: bounded in-flight work, deadline-aware queues, load shedding, fairness, failure tests, and stop signals.</p></div></a><a class="card" href="ai-api-request-tracing.html"><img src="images/ai-api-request-tracing-cover.jpg" alt="Cover for Trace an AI API Request Across Every Attempt"><div><h2>Trace an AI API Request Across Every Attempt</h2><p>Trace an AI API Request Across Every Attempt: reproducible evidence, failure checks, bounded rollout, and clear production limits.</p></div></a></div>
|
| 43 |
<footer>Modelflare on Hugging Face: <a href="https://huggingface.co/spaces/Modelflare/start" target="_top">start</a> 路 <a href="https://huggingface.co/spaces/Modelflare/openai-sdk" target="_top">openai-sdk</a> 路 <a href="https://huggingface.co/spaces/Modelflare/coding-agents" target="_top">coding-agents</a> 路 <a href="https://huggingface.co/spaces/Modelflare/api-recipes" target="_top">api-recipes</a> 路 <a href="https://huggingface.co/datasets/Modelflare/api-examples" target="_top">api-examples dataset</a><br>Business: <a href="mailto:business@modelflare.dev">business@modelflare.dev</a></footer></div></body>
|
| 44 |
</html>
|