API documentation
OpenAI-compatible chat completions. Use any OpenAI SDK with a different base URL.
Quickstart
Create a key in the console, add credit, then call the API.
curl https://api.infrenis.com/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "qwen3.8-27b-uncensored", "messages": [{"role": "user", "content": "Hello"}]}'import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.infrenis.com/v1", apiKey: process.env.API_KEY });
const stream = await client.chat.completions.create({
model: "qwen3.8-27b-uncensored",
messages: [{ role: "user", content: "Write a haiku" }],
stream: true,
stream_options: { include_usage: true },
});
for await (const chunk of stream) process.stdout.write(chunk.choices[0]?.delta?.content ?? "");Endpoints
POST /v1/chat/completions | Chat completions, streaming and non-streaming. |
GET /v1/models | Model, limits, capabilities, deployment revision, prices. |
GET /v1/credits | Available credit, balance, and held funds. |
GET /v1/requests/{id} | Status, token usage, and charge for one request (no prompt or output text). |
GET /v1/usage | Paginated usage for your organization (?limit=&cursor=). |
Parameters
messages:system,user,assistant,toolroles. Text content only at launch.max_tokensormax_completion_tokens(send one). Default 8,192; maximum shown in/v1/models.- Sampling:
temperature,top_p,top_k,min_p,presence_penalty,frequency_penalty,repetition_penalty,stop,seed. - Tools:
tools,tool_choice(auto,none,required, or a named function),parallel_tool_calls. - Structured output:
response_formatwithjson_objectorjson_schema. - Reasoning: on by default at the model's highest effort.
reasoning_effort(orreasoning: {effort}) oflow,medium, orhigh/xhigh(same thing: the model's top level);noneorminimal,reasoning: {enabled: false}, orthinking: {type: "disabled"}turn it off. Reasoning text arrives inreasoning_contentand is billed as output. service_tier: "flex": half price, idle capacity only, may return 429.- Unknown fields are ignored. Engine-specific fields are never forwarded.
Billing rules
- Charge = uncached prompt tokens × input rate + cached prompt tokens × cached rate + output tokens × output rate. Output includes reasoning.
- Hold: before a request runs, its worst case (every prompt token uncached plus the full
max_tokens) is held. Lowermax_tokensif you get HTTP 402 with a small balance. - Cache: prompt caching is automatic and private to your organization. Only real cache hits get the cached rate.
- Cancellation: closing the connection stops generation. You pay for tokens generated until then. If the stream stops before the engine reports the cached/uncached split, all prompt tokens are billed at the cached rate.
- Faults: engine failures and invalid model output (for example repetition loops, empty answers, broken tool calls) end with an error and are not billed.
- The final usage chunk and non-streaming responses include
usage.costin USD.
Streaming
Server-sent events in OpenAI format, ending with data: [DONE]. Long prompts can take time before the first token; the stream sends : keepalive comments meanwhile. A failure after streaming started arrives as a chunk with finish_reason: "error" and an error object.
Errors
| Status | Code | Meaning |
|---|---|---|
| 400 | invalid_request, context_length_exceeded | Fix the request. Not billed. |
| 401 | invalid_api_key | Missing, invalid, or revoked key. |
| 402 | insufficient_credits | Worst-case cost exceeds available credit. |
| 403 | account_frozen | Contact support. |
| 409 | duplicate_request | The Idempotency-Key was already used; see x-request-id. |
| 429 | rate_limited, concurrency_limit, capacity_exhausted | Retry after Retry-After seconds. |
| 502 | invalid_model_output, engine_error | Not billed. Safe to retry. |
| 503 | no_worker_available, service_paused | Temporary. Retry later. |
Retries and idempotency
Send Idempotency-Key: <unique> to make retries safe: a repeated key returns HTTP 409 with the original x-request-id instead of running again. Every response carries x-request-id.
Limits
- Context up to the value in
/v1/models. Requests above 64K tokens share a small long-context pool. - Request body up to 32 MiB.
- Per-key request rate and per-organization concurrency limits apply; contact support to raise them.
Data handling
Prompts and outputs are not logged or stored. During processing they exist in GPU and host memory, and reusable prompt prefixes stay in a private, per-organization cache until evicted (typically minutes). We store request metadata for billing: ids, timestamps, token counts, and charges.