Modelflare Blog

Modelflare Blog

Engineering notes and setup guides for Modelflare, the API gateway for text, image, and video models, and for Castaly, the studio built on it.

Diagram: one entry point routed to several model backends

Introducing Modelflare: one API key for text, image, and video models

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.

Diagram: a request passing through a compatible interface

Switching the OpenAI SDK to Modelflare (Python, JavaScript, curl)

Existing OpenAI SDK code works with Modelflare after changing the base URL to https://modelflare.dev/v1 and supplying a Modelflare key.

Diagram: a coding agent connected through a gateway to several services

Configuring coding agents with Modelflare: Claude Code, Codex, OpenCode, Gemini CLI, CC-Switch, and Grok Build

Claude Code connects through Anthropic Messages at https://modelflare.dev, Codex, OpenCode, and Grok Build through https://modelflare.dev/v1, and Gemini CLI through GOOGLE_GEMINI_BASE_URL. All of them use the same Modelflare key.

Diagram: parallel routes converging with fallback paths

Modelflare API recipes: streaming, routing fallback, images, and async video

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.

Illustration: a key module feeding a single route

Smart API Keys: one key for every model your account can use

A Smart API Key is bound to auto instead of a fixed routing group. It resolves a group on each request and orders candidates by a routing strategy that you choose.

Illustration: parallel routes converging on one output

Model groups and failover: how Modelflare routes a request

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.

Illustration: a balance weighing request units

Usage and cost records: reading what each request cost

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.

Illustration: media inputs feeding a processing unit and a film strip

The Modelflare Media Skill: image and video generation from coding agents

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.

Illustration: image and media tiles feeding a central processing unit

The Seedance asset library: uploading reference media and using asset:// IDs

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 Active, and reference it as asset://<ID> in a video request.

Illustration: a keypad module sending requests through a panel to several backends

Codex CLI on Modelflare in depth: installer, config.toml, auth.json, and common problems

Codex connects over the Responses API at https://modelflare.dev/v1. This guide covers the installer and the root/VPS variant with MODELFLARE_ALLOW_ROOT=1, every key in config.toml, the auth.json format, and the four documented problems.

Illustration: a stack of request cards routed through one panel to several modules

Claude Code on Modelflare in depth: installer, settings.json, model slots, and troubleshooting

Claude Code connects through Anthropic Messages with ANTHROPIC_BASE_URL set to https://modelflare.dev. This guide covers the installer and the root/VPS variant with MODELFLARE_ALLOW_ROOT=1, the env block in settings.json, the four model slots, and the documented error codes.

Castaly cover: orbital ring city

Castaly: an AI video and image studio built on Modelflare

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.

Illustration: a visual input panel wired through a reasoning dial to pointer tiles, above a long context strip

GPT-6.1 Terra: Capabilities, Parameters, Pricing, and Model Comparison

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.

Illustration for LLM API load testing guide

Load Test an LLM API Without Misleading Results

Production guide: Load Test an LLM API Without Misleading Results. It includes a deterministic artifact, failure boundaries, rollout checks, and source-qualified limitations.

Illustration: a request passing through one central module that fans out to several tool modules

Function Calling: Responses API vs Chat Completions

A wire-level comparison of function definitions, Call IDs, result messages, streaming arguments, authorization, idempotency, and route compatibility.

Cover for Kimi K3.1 Pro review

Kimi K3.1 Pro: Parameters, Capabilities, Prices, and Model Comparisons

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.

Cover for Apply Backpressure to AI API Workloads

Apply Backpressure to AI API Workloads

A production guide to backpressure for AI API workloads: bounded in-flight work, deadline-aware queues, load shedding, fairness, failure tests, and stop signals.

Cover for Trace an AI API Request Across Every Attempt

Trace an AI API Request Across Every Attempt

Trace an AI API Request Across Every Attempt: reproducible evidence, failure checks, bounded rollout, and clear production limits.

Cover for Make AI API Operations Idempotent

Make AI API Operations Idempotent

Make AI API Operations Idempotent with a practical artifact, failure boundaries, verification steps, and production-ready operating controls.

Cover for Handle 429s Without Retry Storms

Handle 429s Without Retry Storms

Handle 429s Without Retry Storms: reproducible evidence, failure checks, bounded rollout, and clear production limits.

Cover for Calculate LLM Token Cost Per Request

Calculate LLM Token Cost Per Request

Calculate LLM Token Cost Per Request: reproducible evidence, failure checks, bounded rollout, and clear production limits.

Cover for Haiku 5.5: Anthropic Is Turning Model Capability into a Division of Labor

Haiku 5.5: Anthropic Is Turning Model Capability into a Division of Labor

The value of Claude Haiku 5.5 is not only that it answers faster and costs less, but that it begins to turn model calls into infrastructure that can be deployed at scale.

Cover for Claude Fable 5.2: Benchmarks, Pricing and Opus 5.5 Comparison

Claude Fable 5.2: Benchmarks, Pricing and Opus 5.5 Comparison

A deep analysis of Claude Fable 5.2: 1M context, $8/$40 pricing, published benchmarks against Fable 5.1, Opus 5.5, GPT-6 Astra and Gemini 4 Carbon, cost per task, API breaking changes and Modelflare routes.

Cover for Enforce AI API Budgets Before Spend

Enforce AI API Budgets Before Spend

Enforce AI API Budgets Before Spend: reproducible evidence, failure checks, bounded rollout, and clear production limits.

Cover for GPT-6.2 Astra vs. Sol: Capabilities, Benchmarks and API Pricing

GPT-6.2 Astra vs. Sol: Capabilities, Benchmarks and API Pricing

Explore GPT-6.2 Astra and Sol through coding and reasoning benchmarks, long-context and cache costs, and a breakdown of Modelflare prices by group.

Cover for Route Across Models by Cost and Quality

Route Across Models by Cost and Quality

Route Across Models by Cost and Quality with a practical artifact, failure boundaries, verification steps, and production-ready operating controls.

Cover for Gemini 4 Deep Dive on Reasoning, Coding, and Long Context

Gemini 4 Deep Dive on Reasoning, Coding, and Long Context

Analyze Gemini 4 Argon, Carbon, Hydrogen, and Neon using public benchmark methods, coding scores, million-token context tests, and inference economics.

Cover for Allocate AI API Cost by Team and Workload

Allocate AI API Cost by Team and Workload

Allocate AI API Cost by Team and Workload: reproducible evidence, failure checks, bounded rollout, and clear production limits.

Cover for Detect AI API Cost Anomalies

Detect AI API Cost Anomalies

Detect AI API Cost Anomalies with a practical artifact, failure boundaries, verification steps, and production-ready operating controls.

Cover for Forecast LLM Usage and Spend

Forecast LLM Usage and Spend

Forecast LLM Usage and Spend: a production guide with an explicit decision, reusable artifact, failure tests, operating signals, and source-qualified limits.

Cover for Rotate AI API Keys Without Downtime

Rotate AI API Keys Without Downtime

Rotate AI API Keys Without Downtime: reproducible evidence, failure checks, bounded rollout, and clear production limits.