Quickstart
Code that calls OpenRouter calls InferFlux after two changes: the base URL and the key. The model slugs, the request and response shapes, streaming, errors and the provider routing object stay as they are.
The two changes
- Base URL
- https://testnet.inferflux.xyz/api/v1
- Key
- One of your keys, from the keys page, kept in INFERFLUX_API_KEY. Keys begin with sk-ifx-, so secret scanners still find them.
Before and after
Lines marked with a minus are OpenRouter's; lines marked with a plus replace them. The rest does not change.
import os
from openai import OpenAI
client = OpenAI(
base_url="https://openrouter.ai/api/v1",
api_key=os.environ["OPENROUTER_API_KEY"],
base_url="https://testnet.inferflux.xyz/api/v1",
api_key=os.environ["INFERFLUX_API_KEY"],
)
completion = client.chat.completions.create(
model="deepseek/deepseek-v4.1-flash-1017",
messages=[{"role": "user", "content": "Hello"}],
)
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://openrouter.ai/api/v1",
apiKey: process.env.OPENROUTER_API_KEY,
baseURL: "https://testnet.inferflux.xyz/api/v1",
apiKey: process.env.INFERFLUX_API_KEY,
});
const completion = await client.chat.completions.create({
model: "deepseek/deepseek-v4.1-flash-1017",
messages: [{ role: "user", content: "Hello" }],
});
curl https://openrouter.ai/api/v1/chat/completions \
-H "Authorization: Bearer $OPENROUTER_API_KEY" \
curl https://testnet.inferflux.xyz/api/v1/chat/completions \
-H "Authorization: Bearer $INFERFLUX_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "deepseek/deepseek-v4.1-flash-1017", "messages": [{"role": "user", "content": "Hello"}]}'
What stays the same
- Model slugs, as the model list shows them, with :free for free endpoints.
- The provider object: order, only, ignore, allow_fallbacks, require_parameters, data_collection, zdr, quantizations and sort, plus two of ours: class and min_score.
- Streaming, with usage at the end when the request includes it, and the error shapes.
- The HTTP-Referer and X-Title headers that name your app.
What you get besides
- Each provider's measured latency, throughput, uptime and floor score on every model's page, beside its price.
- A receipt for every request, in Logs, and a report button that refunds a generation the validators find was not the model.
- A balance in USDC that is yours, with limits on each key that the chain enforces.
In a framework
The same two changes, in three common ones.
import os
from langchain_openai import ChatOpenAI
llm = ChatOpenAI(model="deepseek/deepseek-v4.1-flash-1017", base_url="https://testnet.inferflux.xyz/api/v1", api_key=os.environ["INFERFLUX_API_KEY"])import os
import litellm
response = litellm.completion(
model="openai/deepseek/deepseek-v4.1-flash-1017",
api_base="https://testnet.inferflux.xyz/api/v1",
api_key=os.environ["INFERFLUX_API_KEY"],
messages=[{"role": "user", "content": "Hello"}],
)import { createOpenAI } from "@ai-sdk/openai";
import { generateText } from "ai";
const inferflux = createOpenAI({ baseURL: "https://testnet.inferflux.xyz/api/v1", apiKey: process.env.INFERFLUX_API_KEY });
const { text } = await generateText({ model: inferflux.chat("deepseek/deepseek-v4.1-flash-1017"), prompt: "Hello" });