Our decentralized network delivers affordable, on-demand AI inference compute through simple OpenAI-compatible HTTP APIs .
[NOTE] The keys shown in examples are dummy placeholders ( wsk-examplekey ). To obtain production keys use https://app.w.ai/developers/keys arrow-up-right
Include your API key in the Authorization header:
Copy Authorization: Bearer wsk-examplekey List Available Models
Retrieve metadata for all available models on the network.
Copy curl -X GET ' https://api.w.ai/v1/models ' Response includes:
Model ID, name, and description
Input/output modalities (text, image, video)
Context length (for LLMs)
Quantization level (4bit, 8bit, fp16)
Supported sampling parameters
Text Chat Completions
Create text-based chat completions using LLM models like Llama, Mistral, Gemma, DeepSeek, and more.
Request Parameters
Parameter
Type
Required
Description
Model ID (e.g., llama-3.2-1b-4bit)
Maximum tokens to generate (min: 1)
Sampling temperature (0-2, default: 1.0)
Frequency penalty (-2 to 2)
Presence penalty (-2 to 2)
Enable streaming responses
Output format (e.g., {"type": "json_object"})
Function definitions for tool calling
Tool selection mode (none, auto, required, or specific function)
system — System instructions
assistant — Assistant responses
tool — Tool/function call results
Vision-Language Chat (VLM)
Send images along with text prompts for multimodal understanding.
Example with Image URL
Image Content Object
URL or base64-encoded image
Resolution: low, high, or auto (optional)
Enable models to call external functions/tools.
Model decides when to call tools
Force the model to call a tool
{"type": "function", "function": {"name": "..."}}
When the model calls a tool, respond with the result:
Image Generation
Generate images from text prompts using models like FLUX and SDXL.
Request Parameters
Parameter
Type
Required
Default
Description
Model ID (e.g., flux-1-dev, sdxl)
Text description of the image
Output dimensions (e.g., 512x512, 1024x1024)
Quality level: low, medium, high, hd
Seed for reproducible generation
What to exclude from the image
Enable streaming for progress updates
Edit existing images using text prompts with FLUX Kontext models.
Parameter
Type
Required
Default
Description
Model ID (e.g., flux-1-kontext-dev)
Source image file(s). Multiple images supported.
What to avoid in the edit
Seed for reproducible results
Prompt adherence strength
Object Detection & Segmentation
Run object detection (YOLO11n) or image/video segmentation (SAM2) on images and videos.
YOLO11n Object Detection Example
Detect objects in an image with bounding boxes and class labels:
SAM2 Segmentation Example
Segment objects using point prompts:
SAM2 Video Segmentation Example
Track and segment objects across video frames:
Request Parameters
Parameter
Type
Required
Default
Description
Model ID (yolo11n or sam2)
Image URL or base64. *Either image or video required.
Video URL or base64. *Either image or video required.
YOLO11n Parameters:
Parameter
Type
Default
Description
Confidence threshold (0-1)
IOU threshold for NMS (0-1)
Input image size (320-1280)
Return JSON detections or annotated image
SAM2 Parameters:
Parameter
Type
Default
Description
Point prompts: [{x, y, label}] where label 1=foreground, 0=background
Box prompts: [{x1, y1, x2, y2}]
Output type: mask, contour, etc.
Auto-mask grid density (8-128)
Predicted IOU threshold (0-1)
input.stability_score_thresh
Mask stability threshold (0-1)
Enable mask-to-mask refinement
Video-specific Parameters:
Parameter
Type
Default
Description
Output video frame rate (1-60)
input.output_frame_interval
Process every Nth frame (1-10)
Video Generation (Audio)
Generate audio for video clips using video-to-audio models.
Parameter
Type
Required
Description
Responses API (Items-Based)
Alternative API format based on the Open Responsesarrow-up-right specification with structured Items.
Request Parameters
Parameter
Type
Required
Description
System-level instructions
Function tool definitions
Sampling temperature (0-2)
Frequency penalty (-2 to 2)
Presence penalty (-2 to 2)
Allow parallel tool execution
Output format: text, json_object, json_schema
User Message : { "type": "message", "role": "user", "content": "..." }
System Message : { "type": "message", "role": "system", "content": "..." }
Developer Message : { "type": "message", "role": "developer", "content": "..." }
Assistant Message : { "type": "message", "role": "assistant", "content": "..." }
Function Call : { "type": "function_call", "call_id": "...", "name": "...", "arguments": "..." }
Function Output : { "type": "function_call_output", "call_id": "...", "output": "..." }
For multimodal inputs, use content arrays:
Structured Output (JSON Schema)
Streaming Responses
Enable real-time streaming by setting stream: true. Responses are sent as Server-Sent Events (SSE).
API errors follow the OpenAI error format:
Common Error Codes
Invalid or missing API key
Invalid request parameters
Service temporarily unavailable
Rate limits vary by endpoint and account tier. Contact [email protected] envelope for higher limits.
SDK Compatibility
The W.ai API is OpenAI SDK compatible . Use your preferred OpenAI client library:
JavaScript/TypeScript