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.

HTTPSJSONPREPAIDNON-STREAMINGAPI KEY AUTH
01

Quickstart

Create an API key in the console, then call any enabled model through the OpenAI-compatible endpoint. Use GET /v1/models with the same key to discover available IDs.

POST/v1/chat/completionsOpenAI compatible
curl https://api.instamodel.ai/v1/chat/completions \
  -H "Authorization: Bearer $INSTAMODEL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "'"$INSTAMODEL_MODEL_ID"'",
    "messages": [{"role": "user", "content": "Hello"}],
    "stream": false
  }'

Prepaid project keys currently accept non-streaming text requests only. Requests with stream: true fail before provider dispatch.

Key security

Keys are shown once, stored as one-way hashes, and can be revoked from the console. Keep keys server-side and never expose them in browser bundles.

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.

Aliaspublisher/model-nameMoves only through an explicit publish action
Immutablepublisher/model-name@revisionStable 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": "publisher/model-name",
  "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 provider protocols. The gateway owns routing, request IDs, usage records, and canonical errors. Some operational routes support SSE internally, but prepaid project keys remain non-streaming in this MVP.

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

Streaming is not activated for prepaid project keys. Before any future activation, a provider must pass streaming, tool-call, Unicode, usage, cancellation, context-limit, and error-mapping conformance tests.

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. 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

Artifact sources

Submit an immutable Hugging Face or S3-compatible artifact reference with its SHA-256 digest. Direct browser uploads are not accepted in this build: all /api/publisher/uploads routes fail closed until private Blob ingestion and an isolated scanning pipeline are deployed.

POST/api/publisher/modelsRecord artifact reference

An operator must independently verify the digest, license, runtime compatibility, and smoke-generation evidence before a revision can be activated. Pickle, remote code, custom Python, custom kernels, and uploader-provided runtime images are outside the trust boundary.

07

Metering & settlement

Console API keys use prepaid credit. Instamodel reserves the maximum token cost before dispatch, requires consistent terminal usage, and finalizes the measured charge before returning a paid response. For activated post-trained models, the wallet charge, request, attempt, token usage, and balanced royalty journal post atomically. Missing pricing, unsupported billable features, incomplete usage, or an ambiguous financial result fails closed.

gross_usage_charge = measured tokens × versioned retail rates
provisional_owner_accrual = gross_usage_charge × royalty_bps / 10,000
host_cost_entry = measured_units × versioned_host_rate
platform_entry = gross_usage_charge - owner_accrual - host_cost

Inference expense is kept separate from the model owner's percentage, so a routing change cannot silently alter creator economics. Purchase-level refunds and disputes are not yet attributed to usage entries, so every publisher figure is provisional rather than cash-backed, net, payable, or payout-ready. Statement closing and cash payouts are disabled.

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"
  }
}