SleekSky Developers

Platform services for app developers

Apps on the SleekSky platform can use AI (OpenRouter) and SEO data (DataForSEO) without their own accounts with those companies. These are paid services: the platform supplies the credentials and charges the usage to the customer's account. You call each service at its normal URL, with normal code; you never handle the platform's real keys, and you don't need any platform-specific SDK.

Any other outside service (free ones such as Pexels stock photos, or ones you pay for yourself) is your app's own: see section 7 for giving every instance your key.


1. Ask for the services in sleeksky.json

{
  "services": ["openrouter", "dataforseo"]
}

List only what the app uses. The list is part of the manifest that is reviewed, so adding a service later means the next release waits for approval. Manifests with "ai": true and no services list get both.

2. What your app receives

Binding Type Meaning
SKY service binding Your app's line to the platform, set on every app. For these services, call env.SKY.fetch(…) instead of fetch(…), with the service's own URL. The same binding carries the platform API.

There is no key to send. The platform knows which instance is calling from the binding itself, which your app can't change, and adds the platform's own credentials.

3. Calling the services

env.SKY.fetch(service URL), nokeynoyesresponseYour Worker or DurableObjectPlatform gatewayIn your approved manifest?Allowance left?403 or 402 to your appOpenRouter orDataForSEO, with theplatform's keyCost metered to thecustomer's account

Call each service at its own URL with env.SKY.fetch, and leave out the API key. It works the same from your Worker, from Durable Objects (including their alarms) and from ctx.waitUntil work.

From a Durable Object, the binding is required: a plain fetch there goes straight to the real service, which answers 401 (no key). From your Worker, a plain fetch to a service's URL is also routed to the platform (by the outbound Worker), but use the binding everywhere so you don't have to remember which is which.

OpenRouter (AI)

Base URL https://openrouter.ai/api/v1/. Available: POST chat/completions (streaming included) and POST embeddings.

const res = await env.SKY.fetch("https://openrouter.ai/api/v1/chat/completions", {
  method: "POST",
  headers: { "content-type": "application/json" },
  body: JSON.stringify({ model: "anthropic/claude-sonnet-4.5", messages: [{ role: "user", content: "Hello" }] }),
});

OpenAI-compatible SDKs work too; give them the binding's fetch and any placeholder key (SDKs insist on one; the gateway drops it):

import OpenAI from "openai";
const ai = new OpenAI({ apiKey: "platform", baseURL: "https://openrouter.ai/api/v1",
  fetch: (url, init) => env.SKY.fetch(url, init) });
const reply = await ai.chat.completions.create({ model: "openai/gpt-4o-mini", messages: [{ role: "user", content: "Hello" }] });

The response is OpenRouter's own, including usage and its cost figures.

DataForSEO (SEO data)

Base URL https://api.dataforseo.com/v3/. Available: the live endpoints (POST) under dataforseo_labs, serp, keywords_data, on_page and backlinks, e.g. keywords_data/google_ads/search_volume/live.

const res = await env.SKY.fetch("https://api.dataforseo.com/v3/keywords_data/google_ads/search_volume/live", {
  method: "POST",
  headers: { "content-type": "application/json" },
  body: JSON.stringify([{ keywords: ["hair salon san jose"], location_code: 2840, language_code: "en" }]),
});

4. Usage, limits and caching

  • AI is charged to the customer's account: each plan includes a monthly allowance, and owners can top up or connect their own OpenRouter key in the console. When the allowance is used up, calls answer 402 (below). The console's Your apps page shows "API usage $x of $y used" (spent of what its apps include this month) as a small bar; hovering the bar gives the month's total usage, and a dot marks each top-up where it came in ("Top-up triggered") (GET /api/accounts/<id>/balance, refreshed every 5 minutes); the account's Usage page breaks it down by app.
  • DataForSEO costs money per call and is metered the same way. Successful results are cached and shared across the platform (SERP results for 3 days, other data for 14 days); a cached answer costs nothing.
  • Responses from the cache carry x-proxy-cache: hit.
  • Keep requests reasonable: request bodies are limited to 256 KB, and your plan's per-request CPU and subrequest limits still apply to your own code.

5. Errors to handle

Status Meaning What to show
402 {"code":"allowance_used"} The account's AI allowance for this month is used up. "Your AI allowance is used up for this month", with a pointer to the console to top up.
403 The service isn't in this app's approved services list, the instance isn't active, or the call didn't come over env.SKY (or, from your Worker, a plain fetch). A generic "this feature isn't available" message; check your manifest and that you call through env.SKY.
404 That endpoint isn't one the platform offers (see section 3). Treat as a bug in your app.
503 The platform has no credentials for that service right now. "Temporarily unavailable, try again later." Check services in GET https://sky/api/app/init to hide the feature.
other The service's own response, passed through unchanged. As you would without the platform.

6. Running outside the platform

When your app runs elsewhere (local development, self-hosting), SKY is your app's own stand-in from @sleeksky/sky/standalone (see Runtime → Running on its own). Keep calling env.SKY.fetch with the service's URL: the stand-in sends the same endpoints straight to the service with your own keys (OPENROUTER_API_KEY, DATAFORSEO_LOGIN and DATAFORSEO_PASSWORD, or a keys function), answers 503 when there's no key, and lists only the services you have keys for in init. There's no second code path.

7. Your own outside services (supplied secrets)

For services that aren't platform services (e.g. Pexels, a maps API, your own backend), your app uses your account. Give every app your key as a supplied secret, instead of putting it in your code or asking customers:

  1. Declare it in sleeksky.json (this is reviewed like the rest of the manifest):

    "secrets": [{ "name": "PEXELS_API_KEY", "kind": "supplied", "override": true }]

    "override": true lets an account owner use their own value for their app instead (optional).

  2. Set the value once for your app, in the console (Developer → your app → App secrets) or from a script. It's stored encrypted and never shown again:

    printf %s "$PEXELS_KEY" | npx @sleeksky/cli secret set --name PEXELS_API_KEY

    --list shows which app secrets are set; --clear removes one.

  3. Every app gets it as a secret binding (env.PEXELS_API_KEY) right away, and again on each deploy, so a changed value reaches every app within moments, with no new release.

  4. With "override": true, an account owner can paste their own value in the console (the app's Settings → Keys). That app uses theirs from then on, and goes back to yours if they remove it. Your code doesn't change: it reads env.PEXELS_API_KEY either way.

Calls to those services go straight out from your app (within your approved egress hosts); the platform doesn't meter or cache them, and the cost is yours.

8. Don'ts

  • Don't bundle or ask customers for your own OpenRouter or DataForSEO keys on the platform; calls to those hosts always go through the platform and any other key is ignored.
  • Don't put keys for your own services in your code or in vars; use supplied secrets.
  • Don't proxy these services through another host to get around the platform; the app's approved egress hosts are enforced.
  • Call the services from your server code; browsers can't reach the gateway.