Production posture
Built for stable production-scale text and multimodal traffic.
Complete docs organized around quick start, API reference, tutorials, and cookbook content.
Production posture
Built for stable production-scale text and multimodal traffic.
Capability mix
Text and multimodal traffic share one Model API contract.
Agent protocols
OpenAI-compatible access, MCP, and llms.txt are exposed together.
Traffic policy
TTFT, backpressure, slow-consumer isolation, and regional rate limits.
OpenAPI
https://api.batchin.tech/openapi.json
API base
https://api.batchin.tech/v1
MCP
https://api.batchin.tech/v1/mcp
Public endpoints
/v1/chat/completions · /v1/responses · /v1/embeddings · /v1/images · /v1/audio/* · /v1/videos
1) Install
pip install openai2) First Request
from openai import OpenAI
client = OpenAI(
base_url="https://api.batchin.tech/v1",
api_key="YOUR_API_KEY"
)
resp = client.chat.completions.create(
model="deepseek-v4-pro",
messages=[{"role": "user", "content": "Hello from BatchIn"}]
)
print(resp.choices[0].message.content)3) Streaming
stream = client.chat.completions.create(
model="deepseek-v4-pro",
messages=[{"role": "user", "content": "Write a fast python async worker"}],
stream=True
)
for chunk in stream:
delta = chunk.choices[0].delta.content
if delta:
print(delta, end="")See the self-serve path for dedicated endpoints, private throughput usage, billing, and settlement.
Understand dedicated endpoints, private deployment boundaries, key formats, and usage separation before you start a capacity rollout.
Review how BatchIn positions route control, batch lanes, and fallback behavior before moving production traffic.
Open the public verification flow, inspect a signed evidence pack, and reproduce the trust check in the browser.
Review the reserved OTLP ingest/export surface and the planned bridge from native traces into external observability tools.
Get current user profile for authenticated API key.
curl -X GET https://api.batchin.tech/v1/users/me \
-H "Authorization: Bearer $BATCHIN_API_KEY" \Create a new API key with optional rate limit and monthly budget.
curl -X POST https://api.batchin.tech/v1/keys \
-H "Authorization: Bearer $BATCHIN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Production Key",
"rate_limit_rpm": 120,
"monthly_budget_cents": 500000
}'| Name | Type | Required | Description |
|---|---|---|---|
| name | string | No | Key name |
| rate_limit_rpm | number | No | Requests per minute limit |
| monthly_budget_cents | number | No | Monthly budget in cents |
List all API keys for current user.
curl -X GET https://api.batchin.tech/v1/keys \
-H "Authorization: Bearer $BATCHIN_API_KEY" \Delete one API key by id.
curl -X DELETE https://api.batchin.tech/v1/keys/{id} \
-H "Authorization: Bearer $BATCHIN_API_KEY" \| Name | Type | Required | Description |
|---|---|---|---|
| id | path:uuid | Yes | API key id |
Text and multi-turn chat completion with SSE streaming support.
curl -X POST https://api.batchin.tech/v1/chat/completions \
-H "Authorization: Bearer $BATCHIN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen3.5-27b",
"messages": [{"role":"user","content":"Explain attention in 3 bullets"}],
"temperature": 0.7,
"stream": false
}'| Name | Type | Required | Description |
|---|---|---|---|
| model | string | Yes | Model ID |
| messages | array | Yes | Chat message array |
| temperature | number | No | Sampling temperature |
| max_tokens | number | No | Max output tokens |
| stream | boolean | No | Enable streaming |
Responses API compatibility layer with non-streaming response objects, SSE streaming events, and runtime receipt headers.
curl -X POST https://api.batchin.tech/v1/responses \
-H "Authorization: Bearer $BATCHIN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen3.5-27b",
"input": "Explain batch inference in 3 bullets",
"max_output_tokens": 256
}'| Name | Type | Required | Description |
|---|---|---|---|
| model | string | Yes | Model ID |
| input | string|array | Yes | Input text or message array |
| max_output_tokens | number | No | Max output tokens |
| stream | boolean | No | Return Responses events as text/event-stream. |
OpenAI-compatible text completions with prefix/suffix FIM-style passthrough.
curl -X POST https://api.batchin.tech/v1/completions \
-H "Authorization: Bearer $BATCHIN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen3.5-27b",
"prompt": "Complete this sentence: Batch processing helps",
"suffix": "for large workloads.",
"max_tokens": 128
}'| Name | Type | Required | Description |
|---|---|---|---|
| model | string | Yes | Completion model id |
| prompt | string|array | Yes | Prompt or prefix content |
| suffix | string | No | FIM suffix |
| max_tokens | number | No | Max completion tokens |
Convert text into embeddings.
curl -X POST https://api.batchin.tech/v1/embeddings \
-H "Authorization: Bearer $BATCHIN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "bge-m3",
"input": ["batch inference", "retrieval augmented generation"]
}'| Name | Type | Required | Description |
|---|---|---|---|
| model | string | Yes | Embedding model id |
| input | string|array | Yes | Text input to embed |
Convert text into synthesized speech with standard TTS-compatible speech engines.
curl -X POST https://api.batchin.tech/v1/audio/speech \
-H "Authorization: Bearer $BATCHIN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "tts-1",
"input": "Welcome to BatchIn",
"voice": "alloy",
"response_format": "mp3"
}'| Name | Type | Required | Description |
|---|---|---|---|
| model | string | Yes | Speech model id |
| input | string | Yes | Text to synthesize |
| voice | string | No | Voice preset |
| response_format | string | No | Audio response format |
Transcribe speech or audio files into text, with compact or verbose segment-aware output.
curl -X POST https://api.batchin.tech/v1/audio/transcriptions \
-H "Authorization: Bearer $BATCHIN_API_KEY" \
-F "file=@meeting.wav" \
-F "model=whisper-large-v3-turbo" \
-F "response_format=verbose_json" \
-F "language=en"| Name | Type | Required | Description |
|---|---|---|---|
| file | binary | Yes | Audio file upload |
| model | string | Yes | Transcription model id |
| language | string | No | Language code |
| prompt | string | No | Transcription prompt |
| response_format | string | No | Response format |
| temperature | number|string | No | Sampling temperature |
Submit video generation jobs through the unified Model API video entry.
curl -X POST https://api.batchin.tech/v1/videos \
-H "Authorization: Bearer $BATCHIN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "wan-2.2",
"prompt": "Create a product teaser for an AI cloud launch",
"duration_seconds": 6
}'| Name | Type | Required | Description |
|---|---|---|---|
| model | string | Yes | Video model id |
| prompt | string | Yes | Video prompt |
| duration_seconds | number | No | Video duration in seconds |
| aspect_ratio | string | No | Aspect ratio |
Generate images from text prompts through the unified Model API image entry.
curl -X POST https://api.batchin.tech/v1/images \
-H "Authorization: Bearer $BATCHIN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "flux-schnell",
"prompt": "A futuristic city at sunrise",
"size": "1024x1024"
}'| Name | Type | Required | Description |
|---|---|---|---|
| model | string | Yes | Image model id |
| prompt | string | Yes | Image prompt |
| size | string | No | Output size |
Returns model status, pricing, context length, and license metadata.
curl -X GET https://api.batchin.tech/v1/models \Submit batch jobs with mixed-model tasks and priorities.
curl -X POST https://api.batchin.tech/v1/batches \
-H "Authorization: Bearer $BATCHIN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"priority": "fill",
"webhook_url": "https://your-domain.com/webhooks/batchin",
"tasks": [
{"custom_id":"task-1","model":"qwen3.5-27b","request_body":{"messages":[{"role":"user","content":"translate this"}]}},
{"custom_id":"task-2","model":"glm-5.1","request_body":{"messages":[{"role":"user","content":"summarize this"}]}}
]
}'| Name | Type | Required | Description |
|---|---|---|---|
| tasks | array | Yes | Task array (each task can set its own model) |
| priority | string(high|low|fill) | No | Scheduling priority |
| webhook_url | string(url) | No | Webhook callback URL |
List batch jobs for current user.
curl -X GET https://api.batchin.tech/v1/batches \
-H "Authorization: Bearer $BATCHIN_API_KEY" \Get batch detail including task results.
curl -X GET https://api.batchin.tech/v1/batches/{id} \
-H "Authorization: Bearer $BATCHIN_API_KEY" \| Name | Type | Required | Description |
|---|---|---|---|
| id | path:uuid | Yes | Batch id |
Cancel a pending or running batch job.
curl -X POST https://api.batchin.tech/v1/batches/{id}/cancel \
-H "Authorization: Bearer $BATCHIN_API_KEY" \| Name | Type | Required | Description |
|---|---|---|---|
| id | path:uuid | Yes | Batch id |
Create an Alipay checkout session for Chinese-site credit top-up.
curl -X POST https://api.batchin.tech/v1/topup/alipay/checkout \
-H "Authorization: Bearer $BATCHIN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"amount_cents": 5000,
"currency": "cny",
"locale": "zh-CN"
}'| Name | Type | Required | Description |
|---|---|---|---|
| amount_cents | number | Yes | Top-up amount in CNY cents |
| locale | string | No | Chinese locale, zh-CN or zh-HK |
Create Stripe checkout session for credit top-up.
curl -X POST https://api.batchin.tech/v1/topup/stripe/checkout \
-H "Authorization: Bearer $BATCHIN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"amount_cents": 5000
}'| Name | Type | Required | Description |
|---|---|---|---|
| amount_cents | number | Yes | Top-up amount in cents |
Get top-up transaction history.
curl -X GET https://api.batchin.tech/v1/topup/history \
-H "Authorization: Bearer $BATCHIN_API_KEY" \Get supported USDC chains and deposit addresses.
curl -X GET https://api.batchin.tech/v1/topup/usdc/chains \
-H "Authorization: Bearer $BATCHIN_API_KEY" \List request-level usage logs.
curl -X GET https://api.batchin.tech/v1/usage/logs?limit=50&offset=0 \
-H "Authorization: Bearer $BATCHIN_API_KEY" \| Name | Type | Required | Description |
|---|---|---|---|
| limit | query:number | No | Page size (1-500) |
| offset | query:number | No | Offset |
Get total requests, tokens, and cost summary.
curl -X GET https://api.batchin.tech/v1/usage/summary \
-H "Authorization: Bearer $BATCHIN_API_KEY" \Aggregate usage by model dimension.
curl -X GET https://api.batchin.tech/v1/usage/by-model \
-H "Authorization: Bearer $BATCHIN_API_KEY" \Create verifiable audit record and signature.
curl -X POST https://api.batchin.tech/v1/vaas \
-H "Authorization: Bearer $BATCHIN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input_text": "What is a zero-knowledge proof?",
"output_text": "A cryptographic method...",
"model_id": "qwen3.5-27b",
"gpu_id": "execution-a19c-42ef"
}'| Name | Type | Required | Description |
|---|---|---|---|
| input_text | string | Yes | Input text |
| output_text | string | Yes | Output text |
| model_id | string | Yes | Model id |
| gpu_id | string | No | Masked execution environment identifier |
Fetch audit details by audit_id.
curl -X GET https://api.batchin.tech/v1/vaas/{id} \| Name | Type | Required | Description |
|---|---|---|---|
| id | path:uuid | Yes | Audit id |
Verify audit signature validity.
curl -X GET https://api.batchin.tech/v1/vaas/{id}/verify \| Name | Type | Required | Description |
|---|---|---|---|
| id | path:uuid | Yes | Audit id |
Return the audit evidence pack used for browser verification and export workflows.
curl -X GET https://api.batchin.tech/v1/vaas/{id}/evidence \| Name | Type | Required | Description |
|---|---|---|---|
| id | path:uuid | Yes | Audit id |
Get public key used for browser-side signature verification.
curl -X GET https://api.batchin.tech/v1/vaas/pubkey/current \List native runtime traces with route, prompt-version, and audit linkage.
curl -X GET https://api.batchin.tech/v1/traces?limit=20 \
-H "Authorization: Bearer $BATCHIN_API_KEY" \| Name | Type | Required | Description |
|---|---|---|---|
| limit | query:number | No | Page size (1-100) |
Fetch one native runtime trace by trace_id.
curl -X GET https://api.batchin.tech/v1/traces/{trace_id} \
-H "Authorization: Bearer $BATCHIN_API_KEY" \| Name | Type | Required | Description |
|---|---|---|---|
| trace_id | path:string | Yes | Trace ID |
Return prompt registries with promoted versions, latest observed versions, and version details.
curl -X GET https://api.batchin.tech/v1/prompts \
-H "Authorization: Bearer $BATCHIN_API_KEY" \Return automatic sampled-replay regression runs with sample counts, similarity, and latency summaries.
curl -X GET https://api.batchin.tech/v1/prompt-regressions \
-H "Authorization: Bearer $BATCHIN_API_KEY" \Return automatic experiments for candidate prompt versions, including replay state and auto-promotion results.
curl -X GET https://api.batchin.tech/v1/experiments \
-H "Authorization: Bearer $BATCHIN_API_KEY" \Accept OTLP/HTTP JSON or protobuf traces and merge spans into the unified trace view.
curl -X POST https://api.batchin.tech/v1/otlp/traces \
-H "Authorization: Bearer $BATCHIN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"resourceSpans": []
}'Export spans from the unified trace view as OTLP protobuf or JSON.
curl -X GET https://api.batchin.tech/v1/otlp/export \
-H "Authorization: Bearer $BATCHIN_API_KEY" \Service health probe endpoint.
curl -X GET https://api.batchin.tech/health \