Skylark SDK
Skylark SDK

API reference

Ten endpoints. The catalog is the contract — everything else reads from it.

Base URL https://sdk.skylarklabs.ai/v1. Authentication is your API key, as a bearer token: Authorization: Bearer $SKYLARK_API_KEY, where the key is skl_ followed by 40 letters and digits. It is the only credential inference accepts — the console playground uses one of your keys too. Keys are opaque — nothing is encoded in them — so treat one as a password: anyone holding it spends your account's budget until you revoke it.

Versioning

The version is in the path: this is v1. Within v1, changes are additive only — new endpoints, new optional request fields, new response fields, new error codes. So ignore fields you do not recognise, and treat an unknown code as a failure not worth retrying. Anything that would break an existing client — removing or renaming a field or endpoint, changing a type or a meaning — ships as /v2 alongside v1, never as a change to v1.

The shipped clients are versioned to match: a 1.x client speaks v1, and exposes its own version as VERSION.

Two endpoints sit outside the version, because they describe the deployment rather than the contract:

  • GET / — which API versions this host serves, and their status (stable, or deprecated once a successor exists).
  • GET /healthz — readiness: status, version (the service build), storage, ai. 503 when the service cannot record usage.

The unversioned paths this API had before v1 (/api/models/…) answer 410 with code moved and the /v1 path that replaced them.

There is no OpenAPI document. https://sdk.skylarklabs.ai/v1/sdk/curl is the de-facto spec — it is executable, it is served by the same build you are calling, and it is what this page is checked against.

Catalog

GET /v1/catalog

Every model, the classes it returns, what it adds, prices and the service's limits. No auth.

Returns version, aiStatus, limits, pricing, sdk[], models[]. Each model has id, name, description, detects (what it is good for), confidence (its detection threshold), classes (every class a call returns), flags (fields it adds per detection: plate, hasVest, hasHelmet, hasBikeHelmet), regions (crowd, congestion), media and its prices.

aiStatus is outdated while the detection server has not been updated for this API version; calls then answer ai_outdated.

Money is in micro-dollars — integers, where 1000000 is $1.00. Each model carries imagePriceMicros and videoPricePerSecondMicros; pricing holds the account's monthlyBudgetMicros, apiKeysPerAccount and the apiKeyValidities a key can be created with.

This is the contract. Read model ids, prices and every limit from here rather than hard-coding them — it is why the Models and Limits pages cannot go stale.

GET /v1/sdk/{lang}

The client source for one language, as served by this build. No auth.

ParamTypeDescription
langstringRequiredcurl · python · node · ts · browser

Returns the file, inline.

Keys

GET /v1/key

Which key this is, and what it may still spend. Bearer — the key.

Returns key (id, name, last4, expiresAt — never the key itself), balance — the account's money left this month, in micro-dollars — remaining (the same balance restated in the service's internal meter), hourRemaining (this key's hourly rate limit), expiresAt and audience (always sdk).

A revoked key answers 401 key_revoked.

Costs nothing and touches no model, which is what makes it safe to call on startup — otherwise the cheapest way to check a key would be to spend one.

Inference

POST /v1/infer/image

Run a model on one image. Synchronous. Bearer.

ParamTypeDescription
modelstringRequiredA model, e.g. CFAM-CCTV.
filefileRequiredmultipart/form-data.

Returns model, analysedAt, image (the frame the model saw), detections[] (every class the model detects), counts (per class, every class of the model present), crowd? and congestion? (on models whose regions include them), stats, credits.

Each detection has bbox (0–1), bboxPx, class, confidence, and where the model provides them plate / plateAlternates or flags (hasVest, hasHelmet, hasBikeHelmet). Video and stream detections carry trackId once the tracker has one.

POST /v1/infer/video

Submit a clip. Returns 202 with a job to poll. Bearer.

ParamTypeDescription
modelstringRequiredA model, e.g. CFAM-CCTV.
filefileRequiredmultipart/form-data.

Returns jobId, status, queuePosition, pollUrl, pollIntervalMs, credits.

GET /v1/jobs/{id}

Poll a video job. Bearer — the token that created the job.

Returns status, progress, queuePosition, pollIntervalMs, result?, error?.

Honour pollIntervalMs. It rises with the queue, so respecting it is how a client shares backpressure instead of adding to it. Note a failed job reports its failure in error inside a 200 — see Errors.

DELETE /v1/jobs/{id}

Cancel a job and release its slot on the detection server. Bearer — the token that created the job.

Returns an acknowledgement.