Authentication
Pass your app API key in every server-side request.
http
Authorization: Bearer sk_live_your_api_key_here
POST /v1/chat/completions
Primary AI gateway endpoint. OpenAI-compatible request format.
POST
/v1/chat/completions Request Body
json
{
"feature_id": "chat",
"model": "google/gemini-2.5-flash",
"windUserId": "uuid...",
"messages": [
{ "role": "user", "content": "Summarize this document." },
{
"role": "user",
"content": [
{ "type": "text", "text": "What's in this image?" },
{ "type": "image_url", "url": "https://..." },
{ "type": "image_b64", "data": "...", "mime_type": "image/jpeg" }
]
}
]
} Response — text
json
{
"id": "wind_abc123",
"choices": [{ "message": { "role": "assistant", "content": "Hello!" }, "finish_reason": "stop" }],
"usage": { "input_tokens": 100, "output_tokens": 80 },
"wallet": { "feature_id": "chat", "balance_before": 10.45, "balance_after": 10.35, "cost": 0.10 },
"model": "google/gemini-2.5-flash"
} Response — image generation
json
{
"choices": [{
"message": {
"role": "assistant",
"content": [
{ "type": "text", "text": "Here's the image:" },
{ "type": "image_url", "url": "https://cdn.wind.com/outputs/abc.png", "width": 1024, "height": 1024 }
]
}
}]
} GET /v1/user/status
Check a user's wallet balance.
GET
/v1/user/status?userId={userId} json
{ "wallet": { "balanceCents": 500, "availableCents": 500 } } POST /user/connect/exchange
Exchange a Wind Connect code for a windUserId.
POST
/user/connect/exchange json
// Request
{ "code": "...", "redirectUri": "https://yourapp.com/callback" }
// Response
{ "windUserId": "550e8400-e29b-41d4-a716-446655440000" } POST /user/link
Store the (app_id, external_user_id) → wind_user_id pairing.
POST
/user/link json
// Request
{ "appId": "your-app-id", "externalUserId": "your-internal-user-id" }
// Response
{ "linked": true } GET /user/link
Look up the Wind account linked to a given app user.
GET
/user/link?app_id={appId}&external_user_id={userId} json
{ "windUserId": "550e8400-...", "windEmail": "user@example.com" } GET /user/transactions
Paginated transaction history for the authenticated Wind user.
GET
/user/transactions?page=1&limit=20 json
{
"transactions": [
{ "id": "...", "type": "topup", "amountCents": 500, "createdAt": "..." },
{ "id": "...", "type": "debit", "amountCents": -12, "note": "chat", "createdAt": "..." }
],
"total": 42, "page": 1, "limit": 20
} Features API
Manage pricing rules programmatically.
POST
/v1/features json
// Request
{
"id": "feat_chat",
"name": "AI Chat",
"pricing_model": "per_token",
"multiplier": 1.5,
"min_charge": 0.01,
"model": "google/gemini-2.5-flash"
} GET
/v1/features· list allGET
/v1/features/{feature_id}· get onePATCH
/v1/features/{feature_id} json
{ "price": 0.08 } // or any subset of fields DELETE
/v1/features/{feature_id}Returns 204 No Content.