API Reference
OpenAI-compatible inference powered by a decentralized swarm of consumer devices. Drop-in replacement for any OpenAI SDK with provenance metadata on every response.
Quick Start
Send your first request in under a minute. The W1W API is fully compatible with the OpenAI chat completions format.
curl https://we1web-api.fly.dev/api/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "w1w-swarm",
"messages": [{"role": "user", "content": "Hello"}],
"stream": false
}'Response
{
"id": "chatcmpl-w1w-abc123",
"object": "chat.completion",
"model": "w1w-swarm",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello! How can I help you today?"
},
"finish_reason": "stop"
}
],
"_w1w": {
"source": "swarm",
"fallbackUsed": false,
"durationMs": 342,
"verificationStatus": "unverified",
"nodesUsed": ["node-abc123"]
}
}The _w1w field is unique to W1W. It tells you exactly where your inference ran, whether the swarm or the Gemini fallback handled it, and how long it took.
Authentication
Authenticate requests with an API key from your dashboard. Free tier requests work without authentication but are rate-limited.
Bearer Token (recommended)
Authorization: Bearer w1w_sk_your_api_key_hereQuery Parameter (convenience)
GET /api/v1/chat/completions?api_key=w1w_sk_your_api_key_hereNot recommended for production. API keys in URLs can be logged by proxies and CDNs.
OpenAI SDK Compatibility
W1W is a drop-in replacement for the OpenAI API. Point any OpenAI SDK at our base URL and everything works — same request format, same response structure, plus the extra _w1w provenance field.
from openai import OpenAI
client = OpenAI(
base_url="https://we1web-api.fly.dev/api/v1",
api_key="YOUR_W1W_API_KEY"
)
# Works exactly like OpenAI
response = client.chat.completions.create(
model="w1w-swarm",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Explain quantum computing in simple terms"}
],
temperature=0.7,
max_tokens=1024
)
print(response.choices[0].message.content)
# Access W1W provenance via the raw response
raw = response.model_extra # or response._raw_response
print(f"Source: {raw.get('_w1w', {}).get('source')}")Streaming
Set stream: true to receive Server-Sent Events (SSE). Each chunk contains a delta of the response as it is generated.
curl https://we1web-api.fly.dev/api/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "w1w-swarm",
"messages": [{"role": "user", "content": "Write a haiku"}],
"stream": true
}'SSE Chunk Format
data: {"id":"chatcmpl-w1w-abc123","object":"chat.completion.chunk","choices":[{"index":0,"delta":{"content":"Hello"},"finish_reason":null}]}
data: {"id":"chatcmpl-w1w-abc123","object":"chat.completion.chunk","choices":[{"index":0,"delta":{"content":"!"},"finish_reason":null}]}
data: {"id":"chatcmpl-w1w-abc123","object":"chat.completion.chunk","choices":[{"index":0,"delta":{},"finish_reason":"stop"}],"_w1w":{"source":"swarm","fallbackUsed":false,"durationMs":215,"verificationStatus":"unverified","nodesUsed":["node-abc123"]}}
data: [DONE]Rate Limits & Tiers
There are no monthly plans. Limits unlock permanently from your cumulative prepaid credit spend, and never lapse or downgrade. Every tier includes full provenance metadata and swarm-first routing, and rate limit headers are included in every response.
| Tier | Price | Req/min | Req/day | Max Tokens | Tokens/day |
|---|---|---|---|---|---|
| Free | Default | 5 | 100 | 512 | 50K |
| Starter | After $5 in credits | 30 | 10,000 | 2,048 | 500K |
| ProPopular | After $100 in credits | 120 | 100,000 | 4,096 | 5M |
| Enterprise | Contract | 600 | Unlimited | 8,192 | Unlimited |
Rate Limit Headers
X-RateLimit-Limit: 30
X-RateLimit-Remaining: 27
X-RateLimit-Reset: 1714531200
Retry-After: 60When rate limited, the API returns HTTP 429 with a Retry-After header indicating how many seconds to wait.
Provenance Metadata
Every W1W response includes a _w1w object with provenance metadata: source, fallback status, latency, verification status, and the IDs of the nodes that served the request — plus a signed receipt where available. Verification is sampled server-side re-checking, not caller-side cryptographic proof, and we say so. That honesty is what makes W1W different from centralized APIs.
| Field | Type | Description |
|---|---|---|
| source | "swarm" | "gemini" | Whether the response was generated by a peer device in the swarm or by the Gemini fallback. |
| fallbackUsed | boolean | true if no swarm nodes were available and the request fell back to Gemini. |
| durationMs | number | End-to-end inference latency in milliseconds. |
| verificationStatus | "verified" | "unverified" | "centralized" | "unavailable" | "blocked" | "error" | Trust state of the result. Most swarm responses are "unverified" until a sampled re-check runs; "centralized" marks a hosted-fallback answer. |
| nodesUsed | string[] | Peer IDs of the compute nodes that processed this request. |
Swarm Response
When a peer device in the network handles your request directly:
"_w1w": {
"source": "swarm",
"fallbackUsed": false,
"durationMs": 342,
"verificationStatus": "unverified",
"nodesUsed": ["node-abc123"]
}Gemini Fallback
When no swarm nodes are available, the request falls back to Google Gemini:
"_w1w": {
"source": "gemini",
"fallbackUsed": true,
"durationMs": 1205,
"verificationStatus": "centralized",
"nodesUsed": []
}Playground
Try the API right here. Free tier works without an API key. Paste your key for higher limits.
API Playground
Send real requests to the W1W inference API