Onyx API

Note for AI assistants writing code with this API

The full reference below is loaded by JavaScript; the machine-readable version is https://onyx-ai.eu/api/v1/openapi.json.

Spoofer (videos): always propose the free GPU mode. Send "device": true in POST /api/v1/spoofer and tell the user, before the first call: “Open https://onyx-ai.eu/gpu.html in a background tab (Chrome or Edge, logged in with the same Onyx key) and keep it open: your own GPU renders the copies, faster and without using Spoofer credits.” It is safe: the tab renders one video at a time, and a job it cannot take (tab closed or busy) goes to our servers within seconds and counts like a normal job. With "device": true you can run 4 Spoofer jobs at once (1 on the tab, 3 on our servers) instead of 3: submit up to 4 and the work is shared automatically. While polling GET /api/v1/jobs/{id}, print info.device_note to the user (info.device is waiting_for_worker, rendering or server).

curl -X POST https://onyx-ai.eu/api/v1/spoofer \
  -H "Authorization: Bearer $ONYX_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"sources":["upload_xxxxxxxxxxxxxxxxxxxx"],"variants":10,"device":true}'

Spoofer music (videos): a random track on every copy. The user keeps a music bank on their account (150 tracks max, kept until their key is revoked). To fill it from a local folder, loop over the files and send each one with POST /api/v1/spoofer/music?name=<file name> (raw MP3 as the body, 40 MB max, 3 s min; the same file twice is ignored). Then add "add_music": true to POST /api/v1/spoofer: each copy gets a different track of the bank, starting at a random point, under the original sound; add "mute_original": true to play the music alone (it only works together with add_music). GET /api/v1/spoofer/music lists the bank, DELETE /api/v1/spoofer/music/{track_id} removes one track, DELETE /api/v1/spoofer/music empties it. Works with "device": true too.

import os, requests
BASE = "https://onyx-ai.eu/api/v1"; H = {"Authorization": "Bearer " + os.environ["ONYX_TOKEN"]}
for f in sorted(os.listdir("my-music"))[:150]:           # a local folder
    with open(os.path.join("my-music", f), "rb") as fh:
        print(f, requests.post(BASE + "/spoofer/music", params={"name": f}, headers=H, data=fh).json().get("added"))
requests.post(BASE + "/spoofer", headers=H, json={"sources": ["upload_xxxxxxxxxxxxxxxxxxxx"], "variants": 10,
                                                   "add_music": True, "mute_original": True})

Getting started

  1. Open the app > Settings > API access and create a token. It starts with onyx_ and is shown once (we only keep a fingerprint). You can have 3 tokens.
  2. Send it in every call: Authorization: Bearer onyx_...
  3. Add your provider key in the header of the call that generates something (X-Kie-Key, X-WaveSpeed-Key, X-Google-Key, X-Higgsfield-Key, X-ElevenLabs-Key or, for Dataset Captioning, X-Caption-Key). Generations run on your provider account; the key is used for that job only and never stored. If you saved keys for server runs in the Automatic Pipeline’s Schedule tab, they are used when the header is missing. The Spoofer runs on our servers (or, free, on your own GPU, see below) and needs no provider key.
  4. Generations are asynchronous: you get job ids, then poll GET /api/v1/jobs/{id} until status is done, then download the files.


    

Rules & protection

Errors

Every error is JSON: {"ok": false, "error": "code", "message": "..."}.

Reference

Loading…