Documentation
Reference for the batch AI routing marketplace: quote async jobs, create batches, route work units through provider lanes, track route receipts, deliver artifacts, and settle credits.
Sections
Jump to the relevant reference block.
What the platform is
BatchRouter is a batch AI routing marketplace. It validates manifests, quotes model or workflow routes, reserves credits, dispatches work through provider adapters, and returns finished artifacts.
Workflow products
Workflow products are curated batch job types. Customers buy the outcome while BatchRouter chooses the provider and model mix behind the accepted quote.
List packaged workflow products with their preset manifests, default route products, artifact expectations, webhook contract, and success SLA.
Fetch one workflow product when you want to render or automate a specific packaged job.
Start in the browser
Use the browser console for account setup and manual testing before you integrate the API.
Agent quickstart
Register, verify, and submit your first batch job via curl. No browser required.
API quickstart
Generate an API key in the console, then use the same manifest to quote, submit, poll a batch, and read its optimization report. This is the safe migration path from existing async AI jobs into managed batch routing.
export BASE_URL="https://batchrouter.com"
export OB_API_KEY="ob_live_your_api_key"
export MANIFEST='{"sla_tier":"standard","routing_mode":"sla_aware","privacy_tier":"standard","allowed_regions":["global"],"items":[{"customer_item_id":"support_rollup_001","operation":"responses","model":"gpt-5.4-mini","model_options":["gpt-5.4-mini","gpt-5.4"],"input":{"input":[{"role":"user","content":"Summarize yesterday'\''s support queue into five bullets."}]}}]}'
curl -sS "$BASE_URL/v1/batches/quote" \
-X POST \
-H "Authorization: Bearer $OB_API_KEY" \
-H "Content-Type: application/json" \
-d "$MANIFEST"
curl -sS "$BASE_URL/v1/batches" \
-X POST \
-H "Authorization: Bearer $OB_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: quickstart-batch-001" \
-d "$MANIFEST"
curl -sS "$BASE_URL/v1/batches/{batch_id}" \
-H "Authorization: Bearer $OB_API_KEY"
curl -sS "$BASE_URL/v1/batches/{batch_id}/results" \
-H "Authorization: Bearer $OB_API_KEY"
curl -sS "$BASE_URL/v1/batches/optimization-report?import_provider=openai" \
-H "Authorization: Bearer $OB_API_KEY"Automate workflows with the API
Use the API when a workflow should run from your own scheduler, queue, integration platform, or data pipeline instead of the browser UI.
const BASE_URL = "https://batchrouter.com";
const API_KEY = process.env.BATCHROUTER_API_KEY ?? "ob_live_your_api_key";
const manifest = {
sla_tier: "standard",
routing_mode: "sla_aware",
privacy_tier: "standard",
allowed_regions: ["global"],
delivery: {
webhook_url: "https://example.com/batchrouter/webhook"
},
items: [
{
customer_item_id: "ticket_digest_001",
operation: "responses",
model: "gpt-5.4-mini",
model_options: ["gpt-5.4-mini", "gpt-5.4"],
input: {
input: [
{
role: "user",
content: "Summarize today's open support tickets into priorities."
}
]
}
}
]
};
async function batchrouter(path, options = {}) {
const response = await fetch(`${BASE_URL}${path}`, {
...options,
headers: {
Authorization: `Bearer ${API_KEY}`,
"Content-Type": "application/json",
...options.headers
}
});
const body = await response.json();
if (!response.ok) throw new Error(JSON.stringify(body));
return body;
}
const quote = await batchrouter("/v1/batches/quote", {
method: "POST",
body: JSON.stringify(manifest)
});
console.log("quoted", quote.pricing_estimate?.total ?? quote.pricingEstimate?.total);
const created = await batchrouter("/v1/batches", {
method: "POST",
headers: { "Idempotency-Key": "support-digest-" + new Date().toISOString().slice(0, 10) },
body: JSON.stringify(manifest)
});
let batch = created.batch ?? created;
while (!["completed", "failed", "canceled"].includes(batch.state)) {
await new Promise((resolve) => setTimeout(resolve, 30_000));
batch = await batchrouter(`/v1/batches/${batch.id}`, { method: "GET" });
}
if (batch.state !== "completed") {
throw new Error(`Batch ended as ${batch.state}`);
}
const results = await batchrouter(`/v1/batches/${batch.id}/results`, { method: "GET" });
console.log(results);Submit your first batch
The core API flow turns async demand into a settled artifact: validate and quote the manifest, create the batch, poll status, then fetch rows, route receipts, or files after completion.
Validate the manifest, resolve workflow products or custom model_options, select provider lanes, and return estimated totals plus a funding preview.
Submit the quoted batch. The route reserves the estimate immediately and returns 402 insufficient_credits when available balance is too low.
Example manifest
{
"sla_tier": "standard",
"routing_mode": "public_only",
"privacy_tier": "standard",
"allowed_regions": [
"global"
],
"items": [
{
"customer_item_id": "support_rollup_001",
"operation": "responses",
"model": "gpt-5.4-mini",
"model_options": [
"gpt-5.4-mini",
"gpt-5.4"
],
"input": {
"input": [
{
"role": "user",
"content": "Summarize yesterday's support queue into five bullets."
}
]
}
}
]
}Example funding preview
{
"available": {
"amount": "14.60",
"currency": "usd"
},
"reserved": {
"amount": "4.25",
"currency": "usd"
},
"quote_total": {
"amount": "0.42",
"currency": "usd"
},
"shortfall": {
"amount": "0.00",
"currency": "usd"
},
"can_fund": true
}Example route decision preview
{
"selected_provider": "openai",
"quality_score": 0.92,
"reliability_prior_score": 0.985,
"observed_confidence_score": 0.971,
"observed_confidence_basis": "routing_outcomes",
"trust_score": 0.971,
"fallback_order": [
"openai"
],
"rejected_providers": []
}Return batch state, work units, pricing estimate, route version, deadline, route receipt link, and provider execution summary.
Return normalized per-item output rows after completion. Use file endpoints when you want bulk output or error artifacts.
Read the current customer-quality signal and the provider attribution slice that similar workloads will learn from.
Record business-quality feedback after review so routing can learn which providers actually create value for this workload.
Generate the imported OpenAI or Anthropic optimization_report: baseline cost trend, optimized cost trend, savings realized, provider quality drift, fallback frequency, verification failures, and recommended next route change.
Download a signed artifact generated from finalized batch output, route receipt, review, or error files.
Credits and billing
Customer spend is prepaid. Quote checks available balance, submission reserves estimated spend, and finalization settles against actual usage.
Return billing profile, available credit packs, balance summary, recent ledger entries, reservations, and top-ups for the current org.
Update the billing email reused for hosted checkout sessions.
Create a hosted Stripe Checkout Session for a fixed credit pack for the authenticated org.
Read checkout status on the return path so the UI can confirm when credits were posted by the webhook.
Hosted checkout request
{
"pack_code": "credit_25"
}Auth and sessions
Customer auth is email-and-password with verification and reset flows. Browser usage relies on session cookies. Direct API usage relies on customer API keys.
Create a new customer user and org, then send a verification email through Resend.
Authenticate a verified customer email and issue a browser session cookie.
Request a password reset email. The reset flow invalidates older user sessions after completion.
Return the current browser session, actor type, auth method, org, and capabilities, or null when no session is active.
Catalog surfaces and public APIs
Workflow products are the main discovery path. The model catalog and provider directory expose available models, and settled-demand rankings show where real batch work is flowing.
List workflow-level packages when you want to start from a finished job shape instead of a model profile.
List public model profiles when you need coverage, price, privacy, and routing detail after the workflow shape is already clear.
Fetch one workflow product by slug, including its preset manifest and delivery contract.
Fetch one model profile when you need a deeper provider, routing, or example-manifest reference.
Return public settled-demand signals for workflow products and models, filtered by time window, provider, and operation. Most useful once live production traffic exists.
Return runtime capability flags so the frontend can expose when email, checkout, or other optional features are unavailable.
