/v1/chat/completionsUse this for chat, tools, JSON mode, and streaming with OpenAI SDKs.
Start with one copyable request, then follow the path that matches your job.
export INFERWAY_API_KEY="inferway_live_..." curl 'https://api.inferway.ai/v1/chat/completions' \ -H "Authorization: Bearer $INFERWAY_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "inferway/mimo-v2.6-flash", "stream": true, "messages": [ { "role": "user", "content": "Say hello in one short sentence." } ] }'
curl 'https://api.inferway.ai/v1/chat/completions' \
-H "Authorization: Bearer $INFERWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "inferway/mimo-v2.6-flash",
"stream": true,
"messages": [
{
"role": "user",
"content": "Say hello in one short sentence."
}
]
}'Non-streaming requests pass through a CDN with roughly a 100-second first-byte timeout, so any long output must set stream=true. Non-streaming is fine for short completions. IDE and agent clients can choose non-streaming internally without exposing any setting: Inferway caps such requests at 4,096 total candidate output tokens and reports the applied per-candidate cap in the X-Inferway-Max-Tokens-Applied and X-Inferway-Max-Tokens-Reason response headers; longer output should still use streaming wherever the client supports it.
https://api.inferway.ai/v1$INFERWAY_API_KEYinferway/mimo-v2.6-flashdata: {
"id": "chatcmpl_...",
"object": "chat.completion.chunk",
"model": "inferway/mimo-v2.6-flash",
"choices": [
{
"index": 0,
"delta": { "role": "assistant", "content": "Hello" },
"finish_reason": null
}
]
}
data: [DONE]Most first-run issues are configuration issues. Check these before changing application code.
| Symptom | Likely cause | Fast fix |
|---|---|---|
| 401 | The key is missing, revoked, copied incorrectly, or not exported in this shell. | Re-copy the key from Console → API keys, then run echo $INFERWAY_API_KEY locally before retrying. |
| 404 | The client is pointed at the wrong base URL or duplicated the /v1 path. | Use https://api.inferway.ai/v1 as the base URL and call /chat/completions once. |
| 429 | The request reached an account or anonymous quota, or a per-request size bound. | Check the error dimension. Reduce input or max_tokens for a request-size limit; otherwise follow Retry-After when present. |
| 504 / timeout | A long non-streaming output hit the roughly 100-second CDN first-byte timeout. | Set stream=true on the request. |
# For OpenAI-compatible clients that read OpenAI env vars export OPENAI_API_KEY="$INFERWAY_API_KEY" export OPENAI_BASE_URL='https://api.inferway.ai/v1' export INFERWAY_MODEL='inferway/mimo-v2.6-flash'
The served model does not emit reasoning (thinking) tokens unless the request opts in.
Reasoning tokens are billed as output tokens at the output price and are visible in usage.completion_tokens_details.reasoning_tokens.
Enable thinking per request with reasoning_effort=low|medium|high (none keeps it off), chat_template_kwargs.enable_thinking=true (OpenAI SDKs: via extra_body) or reasoning: {"enabled": true}.
The official OpenAI Python SDK works against any OpenAI-compatible base URL. Swap the base URL, keep your existing key. This non-streaming shape is fine for short completions; anything long must stream.
import os from openai import OpenAI client = OpenAI( base_url="https://api.inferway.ai/v1", api_key=os.environ["INFERWAY_API_KEY"], ) resp = client.chat.completions.create( model="inferway/mimo-v2.6-flash", messages=[{"role": "user", "content": "Say hello in one short sentence."}], max_tokens=64, ) print(resp.choices[0].message.content)
Choose a tool for setup and supported features. The configuration follows the model selected at the top of this page.
The first cURL request needs no dependencies. Install the OpenAI SDK only when you are ready to wire the integration into an application.
# Python pip install openai # TypeScript / Node.js npm install openai
Use Inferway as an OpenAI Compatible provider in Cline. Your account must have model access enabled before connecting.
Context 393,216 Max output 131,072
Verified on CLI 3.0.65, macOS 26.6.2 arm64, 2026-09-25: basic conversation, and file-read, file-edit and shell-command tool round trips against inferway/mimo-v2.6-flash.
Run once where the key is set. Cline saves the provider and key under ~/.cline; keep it out of source control. It appends /chat/completions to the base URL itself.
Set INFERWAY_API_KEY in the terminal used to launch the client. Keep the key out of the configuration file.
cline auth --provider openai-compatible \ --apikey "$INFERWAY_API_KEY" \ --modelid 'inferway/mimo-v2.6-flash' \ --baseurl 'https://api.inferway.ai/v1'
cline 'Reply with exactly: connected'To disconnect: revoke this tool's key in the Console and remove the Inferway provider from the client.
Standalone guideThe MCP endpoint is live. Point an MCP-capable client at the server URL below and authenticate with the same API key; tools are served over the standard protocol, and the same zero-retention rules apply.
Accounts with no spendable balance are routed to the free lane automatically instead of getting a 402 error — the same free tier as the REST API (90 requests/minute). Registered users are never treated worse than anonymous guests.
{
"mcpServers": {
"inferway": {
"url": "https://api.inferway.ai/v1/mcp/sse",
"headers": {
"Authorization": "Bearer $INFERWAY_API_KEY"
}
}
}
}Before you put traffic behind Inferway, start with the hub, then drill into live status and raw reports.
Inferway keeps the OpenAI-compatible path small and predictable, then exposes account, billing, usage, and agent operations as separate first-party endpoints.
/v1/chat/completionsUse this for chat, tools, JSON mode, and streaming with OpenAI SDKs.
/v1/interactionsUse this for video generation: durable background jobs you submit once and poll until the result is ready.
/v1/keys · /v1/billing · /v1/usage · /v1/requestsUse this for server-side key, wallet, usage, and request-metadata workflows.
| Endpoint | Method | Purpose |
|---|---|---|
| /v1/chat/completions | POST | OpenAI-compatible chat completions |
| /v1/interactions | POST | Asynchronous video generation jobs (four operations on one route) |
| /v1/models | GET | List published models with capability and pricing metadata |
| /v1/mcp/sse · /v1/mcp/messages | GET · POST | MCP server endpoint (live) |
| /v1/keys | GET / POST / DELETE | Manage direct API keys |
| /v1/billing | GET | Wallet summary and recent usage |
| /v1/billing/transactions | GET | Wallet ledger transactions |
| /v1/billing/checkout | POST | Create a Stripe Checkout top-up session |
| /v1/usage | GET | Aggregated usage for a time window |
| /v1/requests | GET | Request metadata history (no content) |
| /health | GET | Gateway and backend health status |
| /v1/stats | GET | Public status page payload |
Video generation does not return inline. Every call goes to POST /v1/interactions and names the operation in the body's op field; the job is durable, so a dropped connection never loses work already paid for.
| op | Purpose |
|---|---|
| prepare_upload | Request a short-lived, size-bounded upload contract for input media. |
| create | Submit a generation intent and receive an interaction id. Charged once, at the ordered duration. |
| get | Read the durable state, the current stage, and — once delivery commits — the result and its download URL. |
| cancel | Best-effort cancellation of a queued or in-flight job. |
Supported public endpoints are POST /v1/chat/completions, POST /v1/interactions and GET /v1/models. The legacy POST /v1/completions is not served: it answers 501 (not implemented) and names the chat completions route to use instead. POST /v1/messages (Anthropic-format) is served and open to API keys; every request must carry the anthropic-version: 2023-06-01 header.
Choose a model to see its published capability facts. API examples and tool setup use the same selection.
For pricing and regional availability, see Pricing.
Authorization: Bearer $INFERWAY_API_KEY
Inferway returns OpenAI-compatible error objects: {"error": { "type": "...", "message": "...", "code": "..." }}
Paid requests reserve prompt-estimate × input price + max_tokens × output price up front. Eligible requests can use registered FREE quotas when spendable funds are exhausted; FREE requests do not charge the wallet. A 402 refusal happens before dispatch and charges nothing. An authenticated request refused with 400 before it is dispatched appears in your Console request history with zero tokens and zero cost, so the failure can be diagnosed later. Balances render with 4 decimals; prices come from the live rate card.
Cached input tokens are reported in usage.prompt_tokens_details.cached_tokens and bill at the cache rate. The cache matches whole blocks of tokens, so a short prompt may not hit at all and then bills entirely at the input rate.
The complete set of error codes /v1/chat/completions and /v1/agent/chat can return, read from the gateway's own catalog rather than transcribed. Each row carries the HTTP status, whether a retry is safe, and the exact message the API sends. Checkout, billing and key-management endpoints return their own codes, not listed here.
| Code | HTTP | Retry safe | Meaning |
|---|---|---|---|
| admission_paused | 503 | Yes — back off first | Paid admission is paused while we finish a service change. Retry shortly; nothing is wrong with this request. |
| authentication_error | 401 | No | Authentication failed. |
| conflict | 409 | No | A conflict occurred with the current state of the resource. |
| context_length_exceeded | 400 | No | The prompt exceeds the model's context window. Shorten or compact the conversation and retry. |
| free_quota_exhausted | 429 | Yes — back off first | Free quota exhausted. Please retry later. |
| free_tier_unavailable | 503 | Yes — back off first | The free tier is temporarily unavailable; please retry shortly. |
| internal_error | 500 | No | An internal error occurred. |
| internal_tool_failure | 500 | No | An internal tool error occurred. |
| invalid_request | 400 | No | The request was invalid. |
| malformed_upstream | 502 | No | Received an invalid response from the upstream service. |
| model_unavailable | 503 | Yes — back off first | This model is temporarily out of service. Other models are unaffected; please retry later. |
| payment_required | 402 | No | Payment required. Add credit at https://inferway.ai/console/billing |
| rate_limited | 429 | Yes — back off first | Rate limit exceeded. Please retry later. |
| service_unavailable | 503 | No | Service outage in progress. Live status: https://inferway.ai/status |
| upstream_rejected | 422 | No | The upstream service rejected the request. |
| upstream_unavailable | 503 | Yes — back off first | The service is temporarily unavailable. |
Quota denials return HTTP 429. Check the error code, window and dimension, and follow Retry-After when present. Per-request size limits require reducing input or max_tokens; waiting does not change them.
| Subject | Limit | Window |
|---|---|---|
| Anonymous playground | 60 | per minute, per IP |
| Anonymous playground | 300 | per hour |
| Anonymous playground | 1,000 | per rolling 24 hours |
| Funded accounts | Account limits | Free caps no longer apply — visible in the console |
Registered free accounts: 8 requests/second burst, 90 requests/minute, 300 requests/hour and 1,000 requests/day, with 2 concurrent requests. No per-request input or output token cap, and no per-minute or daily token quota.
Hourly and daily request counts are rolling windows, not a reset at a fixed time. API keys on the same account share these request counts.
Each request is still bounded by the model's own context length and maximum output. Use streaming for outputs above 4,096 tokens.
The matrix below reflects how the gateway actually handles each parameter, based on real runtime verification.
| Parameter | Status | Notes |
|---|---|---|
| model | Supported | Rewritten to the backend model ID before proxying. |
| messages | Supported | Required non-empty list; validated and forwarded to the inference engine. |
| stream | Supported | Streaming path implemented; stream_options.include_usage is injected automatically. |
| temperature | Supported | Passed through to the inference engine; also logged for billing metadata. |
| top_p | Supported | Listed in supported_sampling_parameters and forwarded. |
| max_tokens | Supported | Passed through to the inference engine. |
| stop | Supported | Listed in supported_sampling_parameters and forwarded. |
| n | Untested | No gateway-level handling; forwarded unchanged. Behavior depends on the backend. |
| logprobs | Untested | No gateway-level handling; forwarded as part of the raw body. Not verified against live responses. |
| tools | Supported | Listed in supported_features: ["tools", "json_mode"] and forwarded. |
| response_format | Supported | Gateway advertises json_mode; the field is forwarded as part of the raw body. |
| vision input | Supported | Model metadata declares input_modalities: ["text","image"]. Inline data URLs only, up to 4 images per request. |
Thinking is off by default. To turn it on, send "reasoning": {"enabled": true} and budget at least ~16k max_tokens for that request — a smaller budget can be spent entirely on reasoning, leaving no visible answer.
Two minimal request shapes that each ship an inline image to a model whose catalog declares image_input. The image is inlined as a base64 data URL or base64 source; the gateway enforces the same per-image, per-kind total and request-level 32 MiB envelope as the playground.
Every snippet below is bounded by the image row of the compatibility matrix above: inline data URLs only, up to 4 images per request.
image_url.content points at a data URL with the image bytes base64-encoded. The MIME matches what the catalog accepts.
POST https://api.inferway.ai/v1/chat/completions Authorization: Bearer $INFERWAY_API_KEY Content-Type: application/json { "model": "inferway/mimo-v2.6-flash", "messages": [ { "role": "user", "content": [ {"type": "text", "text": "What is in this image?"}, { "type": "image_url", "image_url": { "url": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=" } } ] } ] }
Anthropic takes a base64 source object instead of a data URL; the gateway routes Anthropic-format requests to the same image_input envelope. The Messages endpoint needs the anthropic-version: 2023-06-01 header — see the endpoint reference above.
POST https://api.inferway.ai/v1/messages Authorization: Bearer $INFERWAY_API_KEY Content-Type: application/json { "model": "inferway/mimo-v2.6-flash", "max_tokens": 1024, "messages": [ { "role": "user", "content": [ {"type": "text", "text": "What is in this image?"}, { "type": "image", "source": { "type": "base64", "media_type": "image/png", "data": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=" } } ] } ] }
#!/usr/bin/env python3 """Minimal Inferway chat sample. Requires: pip install openai""" import os from openai import OpenAI client = OpenAI( base_url="https://api.inferway.ai/v1", api_key=os.environ["INFERWAY_API_KEY"], ) messages = [{"role": "system", "content": "You are a helpful assistant."}] while True: user = input("You: ") if not user: break messages.append({"role": "user", "content": user}) stream = client.chat.completions.create( model="inferway/mimo-v2.6-flash", messages=messages, stream=True, ) reply = "" print("Assistant: ", end="", flush=True) for chunk in stream: if not chunk.choices: continue piece = chunk.choices[0].delta.content if piece: reply += piece print(piece, end="", flush=True) print("\n") messages.append({"role": "assistant", "content": reply})