Skip to content
SkynetDocs
Pages

Integrations

API

Authenticate, start a run, and read results with the HTTP API.

The Skynet HTTP API lets scripts and tools do what the web app does: start runs, watch them, and read the results. This page shows how to sign requests, where the full reference is, and one complete example.

Base URL

Send every request to:

https://api.skynetml.com

Authentication

The API uses API tokens.

  1. Open Settings in Skynet, then open the API tab.
  2. Click Generate token.
  3. Copy the token at once. Skynet shows the full token only one time.

Send the token in the Authorization header of every request:

Authorization: Bearer skyd_...
  • Tokens start with skyd_.
  • Each user has at most one valid token. A new token stops the old token.
  • Click Revoke token to stop a token.

Interactive reference

The full reference is at api.skynetml.com/scalar. It lists each public endpoint, its fields and its responses. You can send test requests from that page.

The reference reads the OpenAPI document at https://api.skynetml.com/openapi.public.json. Use that file to generate a client in your language.

Main endpoints

Method and pathWhat it does
GET /modelsLists the models you can use.
GET /optimizersLists the optimizers that fit a setup.
GET /blackbox/enginesLists the native engines and if each one is available.
POST /optimizeStarts a run for a prompt, code, text or DSPy program.
POST /blackbox/runStarts a run on a GitHub repository.
GET /optimizationsLists your runs.
GET /optimizations/{optimization_id}Returns one run: status, progress, logs and result.
GET /optimizations/{optimization_id}/artifactReturns the best version that the run found.
POST /optimizations/{optimization_id}/cancelStops a run.
POST /serve/{optimization_id}Runs the best version on a new input.
GET /healthShows if the service is up.

Start a run

POST /optimize takes the same setup as the submit wizard. This example improves a prompt that sorts support messages into labels.

curl https://api.skynetml.com/optimize \
  -H "Authorization: Bearer $SKYNET_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: support-labels-001" \
  -d @run.json

Important fields:

  • task.artifact.kind is prompt, code, text or dspy_program.
  • data.mode is pairs (inputs with expected outputs) or single (exactly one case).
  • optimizer.choice is auto or one optimizer name from GET /optimizers.
  • max_cost_cents is the spending limit for this run, in US cents.
  • is_private is false by default. Set it to true to keep the run private.

Read Metrics and scorers for the rules of run_code and metric_code.

Responses

StatusMeaning
201Skynet queued the run. The body has optimization_id and status.
202The setup check is still running. Wait for the seconds in the Retry-After header. Then send the same body with the same Idempotency-Key.
402Your balance is too low.
409You reached a quota, or the setup check is out of date.
422The request or the workspace code does not fit the optimizer.

Watch a run

Poll the run until its status is final:

curl https://api.skynetml.com/optimizations/$RUN_ID \
  -H "Authorization: Bearer $SKYNET_TOKEN"

The status field is one of:

StatusFinal
pending, validating, runningNo
pausedNo
successYes
failed, cancelled, stoppedYes

Poll every 10 to 30 seconds. A run can take from minutes to hours.

The API reference lists every field of the run response.

Use the result

When the status is success, get the best version:

curl https://api.skynetml.com/optimizations/$RUN_ID/artifact \
  -H "Authorization: Bearer $SKYNET_TOKEN"

To run the best version on a new input, send POST /serve/{optimization_id}. Read Results for what each score means.

Limits

The API uses the same quotas, rate limits and billing as the web app. Read Limits and Billing.