API Quickstart
Inferway is reachable through OpenRouter’s standard OpenAI-compatible interface. Pick a language, copy the snippet, drop in your Inferway direct API key (gw_live_…), and you’re sending requests to a dedicated, single-tenant inference node with Zero Data Retention.
cURL
Zero-dependency smoke test against the chat completions endpoint. Set $INFERWAY_API_KEY to a gw_live_… direct key (create one in the Console) in your shell, paste, and run.
curl https://api.inferway.ai/v1/chat/completions \
-H "Authorization: Bearer $INFERWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gwmm/gemma-4-12b-it",
"messages": [{"role": "user", "content": "Say hello in one short sentence."}],
"max_tokens": 64
}'Python (openai SDK)
The official OpenAI Python SDK works against any OpenAI-compatible base URL. Swap the base URL to Inferway, keep your existing direct key.
from openai import OpenAI
client = OpenAI(
base_url="https://api.inferway.ai/v1",
api_key="$INFERWAY_API_KEY",
)
resp = client.chat.completions.create(
model="gwmm/gemma-4-12b-it",
messages=[{"role": "user", "content": "Say hello in one short sentence."}],
max_tokens=64,
)
print(resp.choices[0].message.content)Endpoint reference
| Endpoint | Method | Purpose |
|---|---|---|
| /v1/chat/completions | POST | OpenAI-compatible chat completions |
| /v1/models | GET | List published models with capability and pricing metadata |
| /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/billing/portal | POST | Create a Stripe Customer Portal 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 |
Error codes
Inferway returns OpenAI-compatible error objects. Example shape: &123;"error": &123; "type": "...", "message": "...", "code": "..." &125;&125;
| HTTP | type | Meaning | What to do |
|---|---|---|---|
| 400 | invalid_request | Malformed request or invalid parameters | Check the request body |
| 401 | invalid_auth | API key invalid, revoked, or session expired | Refresh your key or re-authenticate |
| 402 | insufficient_balance | Wallet + credit below the minimum threshold | Top up your wallet |
| 403 | content_policy / unsupported_region | Content policy violation or sanctioned region | Do not retry; review AUP/Terms |
| 429 | rate_limited | Guest or concurrency limit exceeded | Back off and retry (read Retry-After) |
| 500 | internal_error | Gateway internal error | Retry; contact support if persistent |
| 502 | backend_unavailable | vLLM backend is unreachable | Back off and retry |
| 503 | draining / maintenance | Gateway is draining for maintenance | Retry after the Retry-After interval |
Rate limits
Inferway applies transparent per-subject rate limits. Every /v1/* inference response includes standard X-RateLimit-* headers. When a limit is hit, the response is HTTP 429 with a Retry-After header and a rate_limited error object pointing to the rate-limit docs.
| Subject | Limit | Window |
|---|---|---|
| Guest / Sandbox (no API key) | 5 requests | per IP per minute |
| Authenticated API key | 60 requests | per key per minute |
| Authenticated API key | 1,000 requests | per key per UTC day |
- X-RateLimit-Limit. The quota of the current RPM window (5 for guests, 60 for API keys).
- X-RateLimit-Remaining. Requests remaining in the current RPM window.
- X-RateLimit-Reset. Unix timestamp when the current RPM window resets.
- Retry-After. Seconds to wait before retrying after a 429 response.
Operational limits
- Concurrency ceiling. 64 simultaneous in-flight requests per API key. Excess returns
HTTP 429. - First-token timeout. 20 s.
- Context window. 28K tokens (input + output combined).
- Precision. FP8, served at advertised precision under load.
- Data retention. Zero. See Privacy Policy for the full architecture.
- Authentication. Direct access requires a
gw_live_…/gw_test_…key (issued via the Console). OpenRouter customers should point athttps://openrouter.ai/api/v1with their OpenRouter key instead.
MCP (Model Context Protocol)
Inferway also exposes an MCP server so AI agents can call it natively. The MCP endpoint is https://api.inferway.ai/v1/mcp/sse (HTTP/SSE transport).
Available tools:
chat_completion— run a non-streaming chat completionlist_models— list models, context windows, and pricingget_balance— return wallet balance and granted credit
For stdio-only MCP clients, use the bridge script mcp_stdio_bridge.py:
python mcp_stdio_bridge.py https://api.inferway.ai/v1/mcpUnauthenticated requests are mapped to the acc_guest sandbox (max 64 concurrent, no billing). Authenticated requests use the same Authorization: Bearer header as the HTTP API.
OpenAI compatibility
Inferway exposes an OpenAI-compatible /v1/chat/completions endpoint. The matrix below reflects how the gateway actually handles each parameter today — not how we wish it handled it.
| Parameter | Status | Notes |
|---|---|---|
| model | Supported | Rewritten to the backend vLLM model ID before proxying (gateway.py:4753, gateway.py:4820). |
| messages | Supported | Required non-empty list; validated and forwarded to vLLM (gateway.py:4740-4750). |
| stream | Supported | Boolean read and streaming path implemented; stream_options.include_usage is injected automatically (gateway.py:4752, gateway.py:4836-4841). |
| temperature | Supported | Read from the request and passed through to vLLM; also logged for billing metadata (gateway.py:4754). |
| top_p | Supported | Listed in supported_sampling_parameters and forwarded to vLLM (gateway.py:1422-1431, full-body proxy at gateway.py:4843). |
| max_tokens | Supported | Passed through; guest sandbox requests are capped to 256 tokens (gateway.py:4772-4775). |
| stop | Supported | Listed in supported_sampling_parameters and forwarded to vLLM (gateway.py:1422-1431). |
| n | Untested | Not listed in supported parameters and has no gateway-level handling, but the raw request body is forwarded unchanged to vLLM. Actual behavior depends on the backend. |
| logprobs | Untested | Not listed in supported parameters and has no gateway-level handling; forwarded to vLLM as part of the raw body. Not verified against live responses. |
| tools / function calling | Supported | Listed in supported_features: ["tools", "json_mode"] and forwarded to vLLM (gateway.py:1432, gateway.py:1466). |
| response_format | Supported | Gateway advertises json_mode; the field is forwarded to vLLM as part of the raw body. |
| vision input | Untested | Model metadata declares input_modalities: ["text"]. Gateway extracts image_url payloads only for the CSAM hash check, then forwards them to vLLM. Actual inference behavior for images has not been verified. |
Source of truth: gateway.py /v1/chat/completions handler and /v1/models capability metadata. No Pydantic request model is enforced on this endpoint; the gateway validates a small set of fields and proxies the rest.