Text chat completions
POST /v1/chat/completions accepts an API WILD customer key with the chat capability and an exact activated model ID. Send 1–30 text messages, including at least one user message. Roles are system, developer, user, assistant and matching tool results. max_tokens defaults to 1,024; max_completion_tokens is an alias, and the two cannot be combined. The parser allows 1–32,768 output tokens within the route limit, temperature from 0 to 2, and n: 1 only. The complete JSON body is limited to 65,536 bytes and message text to 60,000 characters. Active routing, a funded wallet and spending allowance are still required.
POST https://apiwild.com/v1/chat/completions
Authorization: Bearer YOUR_APIWILD_KEY
Content-Type: application/json
Idempotency-Key: request-0000000001
{"model":"MiniMax-M2.7-highspeed","messages":[{"role":"user","content":"Reply with the single word OK."}],"max_tokens":128,"stream":false}Research utilities and browser voice
POST /api/research/tools accepts an API WILD key with the research capability or a confirmed customer session. Send exactly one of {tool: search, query: topic}, {tool: read, url: English Wikipedia article HTTPS URL}, or {tool: calculate, expression: arithmetic}. The response contains ok:true plus results and source links or a calculated result. Queries are capped at 200 characters, expressions at 120, results at five and summaries at 6,000 characters. Utilities are limited to eight requests per owner per minute on the current server and do not debit model credits. Results are untrusted source data: review them before a separately billed model request. Web search uses DuckDuckGo and returns cited links; send source: wikipedia with the search input to search English Wikipedia instead. Search availability depends on the public source. The reader returns English Wikipedia article summaries, not arbitrary web pages. Browser microphone dictation and read aloud are workspace features where supported; /v1/audio endpoints are not implemented.
POST https://apiwild.com/api/research/tools
Authorization: Bearer YOUR_RESEARCH_SCOPED_APIWILD_KEY
Content-Type: application/json
{"tool":"search","query":"renewable energy"}Prepaid smart routing
When smartRouting is enabled in /api/gateway/config, use model apiwild/auto at the same Chat Completions endpoint. The stable usd-v1 policy selects Gemini 3.1 Flash Lite for text and MiniMax M2.7 highspeed for requests with function definitions or function-call history. Your prepaid USD wallet and account/key limits still apply. Usage is charged at the actual selected model's actual supplier USD cost multiplied by five, and the response identifies that model. An unavailable destination fails without automatic fallback; recover uncertain work with the same request ID and identical body. The alias is not a separate supplier model. Explicit model IDs remain available.
Function calls are data
A tools array may contain up to 32 type: function definitions, with unique 1–64 character names containing letters, digits, underscores or hyphens. Parameter schemas must be bounded JSON object schemas; descriptions, properties, required fields, basic types, local references and bounded composition are supported. Schemas are passed to the model and are never executed or fetched. Tool definitions together are limited to 32,768 bytes. tool_choice accepts auto, none, required or a named function; parallel_tool_calls may be false. An assistant can return up to 16 calls with JSON-object arguments of at most 16,384 bytes per call. Your application decides how to handle them. A follow-up request must include the assistant tool_calls and one matching role: tool result for every call before the next message. Orphaned, repeated or unfinished call history is rejected.
{"model":"MiniMax-M2.7-highspeed","messages":[{"role":"user","content":"What is the weather in Winnipeg?"}],"max_tokens":128,"tools":[{"type":"function","function":{"name":"weather","parameters":{"type":"object","properties":{"city":{"type":"string"}},"required":["city"],"additionalProperties":false}}}],"tool_choice":"auto","parallel_tool_calls":false}Buffered streaming
Set stream: true for text/event-stream Chat Completions chunks. The complete provider response is checked and customer usage is settled before the first chunk is released. This is buffered delivery, so it does not provide live provider tokens or faster first-token response. Chunks include text or tool-call deltas, a finish reason and [DONE]. stream_options: {"include_usage": true} adds a final usage chunk with an empty choices array. Disconnecting after provider work begins does not prove cancellation or remove incurred usage; the request remains settled or held for reconciliation. Repeat the same body and Idempotency-Key to recover its stored result.
Workspace modes
The signed-in text playground uses /api/gateway with Chat, Code or Research modes and complete text replies. Research offers manual web search with cited links, optional Wikipedia article search and summaries, arithmetic and editable text-file context. Code does not execute programs. Browser dictation and read aloud depend on device support; hosted audio transcription/speech, media, Responses, Assistants and Anthropic message adapters are unavailable. Content-part arrays, legacy functions/function_call and unlisted request options are rejected. The API does not use the old apiwild/chat, apiwild/code or apiwild/research model aliases.
Models, availability and usage
GET /api/models provides the approved retail catalogue with model IDs, pricing, callable status and capabilities. GET /api/gateway/config reports the deployed commit, enabled and inferenceConfigured status separately from supported protocol features: streamingMode is buffered-after-settlement, nativeStreaming and externalTools are false. Function-call requests require the selected model to list chat in toolCapabilities. Conditional models become unavailable when their approved pricing window expires. GET /v1/models and GET /v1/usage require an API WILD customer key; chat is the default permission, or send X-APIWILD-Capability with another capability already granted to that key. The model list includes catalogue references, with available and supportsTools flags scoped to the verified capability; an unavailable listing cannot run. The signed-in workspace reads GET /api/gateway and GET /api/usage. Successful metadata reads do not activate inference.
Errors and uncertain requests
400 or 422 indicates an invalid or unsupported request; 401 an invalid credential; 402 insufficient credit or a spending limit; 403 an access restriction; 409 a request conflict; 413 an oversized request; 415 an unsupported content type; and 429 a rate or active-request limit. 503 can mean unavailable execution or a result awaiting reconciliation. Do not assume a timeout or 503 proves the provider did no work.
Safe retries
Use a unique 16–100 character Idempotency-Key containing letters, digits, underscores or hyphens. To check an uncertain attempt, repeat the same endpoint, key and identical JSON body. Existing work is not dispatched again. An unresolved request can remain held until reviewed; automatic retries, a fixed recovery period and autonomous maintenance are not guaranteed.