API REFERENCE / 2026-08

Build once.
Route anywhere.

Instamodel exposes an OpenAI-compatible data plane and a separate control plane for immutable model publishing. This page documents the implemented MVP contract.

HTTPSJSONSSE STREAMINGPUBLIC DEMO
01

Quickstart

Call the deterministic modelrelay/demo route without an account or key. Paid models are unavailable until project funding and usage accounting are enabled.

POST/v1/chat/completionsOpenAI compatible
curl https://api.instamodel.ai/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "modelrelay/demo",
    "messages": [{"role": "user", "content": "Confirm the gateway is alive"}],
    "stream": false
  }'
Production safety

The public demo is deterministic and incurs no upstream spend. Every non-demo route still requires bearer authentication; paid traffic remains fail-closed until checkout, balances, and durable ledger posting are connected.

02

Model IDs & versions

A gateway model ID currently maps to one configured upstream deployment. Paid publisher aliases must additionally snapshot the immutable revision, price, and terms before they are activated.

Aliasnorthstar-demo/clauseguard-32bMoves only through an explicit publish action
Immutablenorthstar-demo/clauseguard-32b@2026-08-17.1Stable weights, tokenizer, price, and terms

List models through GET /v1/models. Catalog metadata distinguishes platform-verified results from publisher-reported claims.

03

Routing controls

Instamodel-specific options live under the namespaced routing object, so standard OpenAI clients remain compatible.

{
  "model": "northstar-demo/clauseguard-32b",
  "routing": {
    "strategy": "balanced",
    "region": "us",
    "zero_retention": true,
    "allow_fallback": true
  }
}
Resolve explicitlyThe public model ID maps to one configured upstream deployment.
Fail closedCapabilities, provider hint, region, and retention are checked before dispatch.
Return a receiptThe MVP records strategy and fallback preference; automatic provider switching is not enabled yet.
04

Provider adapters

Adapters translate protocols. The gateway owns routing, request IDs, usage records, canonical errors, and customer-facing SSE.

NativeOpenAI, Anthropic, Google GeminiConfigured by environment
OpenAI-compatibleTogether, Fireworks, Groq, Mistral, DeepSeek, xAI, Cerebras, SambaNovaConfigured by environment
Custom deploymentsApproved vLLM or SGLang inference partnersConfigured by environment

A provider is production-ready only after streaming, tool-call, Unicode, usage, cancellation, context-limit, and error-mapping conformance tests pass.

05

Publish a specialist

The browser flow submits to POST /api/publisher/models. Each submission creates a model, an immutable revision, a price version, and a commercial-terms version together. Its agreement digest commits the license identifier, artifact reference, runtime declaration, prices, royalty, and exact attestation version. Private-alpha organizations are quota-limited; validation, deployment, and alias activation remain operator approval gates.

  1. 01DraftMetadata, license, base model, and task claims
  2. 02QuarantinedArtifact present but not trusted or executable
  3. 03ValidatingIntegrity, tokenizer, license, safety, smoke generation
  4. 04DeployingApproved host receives digest-scoped artifact access
  5. 05CanaryHealth, latency, output, and metering checks
  6. 06LiveEligible for routing under the published alias
Accepted MVP artifacts

.safetensors full weights and allowlisted LoRA/PEFT adapters with declarative configs. Pickle, remote code, custom Python, custom kernels, and uploader runtime images are rejected.

06

Resumable artifact uploads

For large weights, create a multipart upload, send numbered parts of at most 50 MiB with an explicit Content-Length, then complete it with the returned ETags. Bytes land in a private quarantine bucket. Operators must explicitly enable direct uploads; defaults allow three active uploads, 50 GiB per artifact, and 100 GiB of declared artifacts per organization.

POST/api/publisher/uploadsCreate upload
PUT/api/publisher/uploads/:id/parts/:partUpload part
POST/api/publisher/uploads/:id/completeSeal artifact

Clients declare size and SHA-256 before upload. Completion deletes and rejects an object whose actual size differs; an isolated validator must still independently hash and inspect the object before approval.

07

Metering & settlement

The paid-release ledger contract allows several provider attempts but exactly one final usage charge. Posted records are immutable and corrections use reversal entries. Automatic posting is still a release gate, so real-provider calls from console keys fail closed by default.

eligible_revenue = cash_backed_usage - refunds - fraud_reversals
owner_royalty  = eligible_revenue × royalty_bps / 10,000
host_payable   = measured_units × versioned_host_rate
platform_margin = eligible_revenue - owner_royalty - host_payable

Inference expense is kept separate from the model owner's percentage, so a routing change cannot silently alter creator economics.

08

Errors & request IDs

Errors use the OpenAI object shape and every response carries x-request-id. Preserve that ID when opening a support issue or reconciling a usage line.

{
  "error": {
    "message": "No eligible deployment satisfies region=eu.",
    "type": "routing_error",
    "code": "no_eligible_deployment",
    "param": "routing.region"
  }
}