Quickstart
On this page
In about ten minutes you will make your first picture with the OneUpAI API: get a key, send one request, and open the result. It costs 1 credit, about one cent.
Before you start #
You need:
- An API key from an API plan: Concierge ($297 a month) or Concierge Plus ($497 a month). Step 1 shows how to get one.
- One of:
curlin a terminal, Node.js 20 or newer, or Python 3.8 or newer.
Each step below shows the request in curl, TypeScript and Python, then the exact response body. All three languages get the same body back. Run the steps in order in one terminal, or in one file:
- curl: paste each block into the same terminal window.
- TypeScript: put the blocks in one file named
quickstart.mtsand runnpx tsx quickstart.mts. - Python: put the blocks in one file named
quickstart.pyand runpython3 quickstart.py.
Step 1: Get a key #
- Open
https://api.oneupai.com, choose Concierge or Concierge Plus, and pay. - Sign in and open your account page,
https://api.oneupai.com/account. If you just paid, the page after checkout may already show your first key. If it does, copy it and skip to the end of this list. - Under API keys, type a name for the place this key will run (for example
my-server), then click Create API key.
Your key starts with oneup_live_ and is 43 characters long. It is shown once. We keep only a fingerprint of it, so copy it now and keep it on your server, never in a web page or an app. You can have up to five keys and rotate or revoke each one from your account page.
Put the key in your environment:
export ONEUP_API_KEY="oneup_live_…"Then check that it works. This call is free.
API=${ONEUP_BASE_URL:-https://api.oneupai.com}
curl -s "$API/v1/me" -H "Authorization: Bearer $ONEUP_API_KEY"const API = process.env.ONEUP_BASE_URL ?? "https://api.oneupai.com";
const KEY = process.env.ONEUP_API_KEY;
async function call(
method: string,
path: string,
body?: object,
headers?: Record<string, string>
) {
const res = await fetch(API + path, {
signal: AbortSignal.timeout(60_000),
method,
headers: {
Authorization: `Bearer ${KEY}`,
"Content-Type": "application/json",
...headers,
},
body: body && JSON.stringify(body),
});
const json = await res.json();
if (!res.ok) throw new Error(`${res.status} ${json.error}: ${json.message}`);
return json;
}
const me = await call("GET", "/v1/me");
console.log(JSON.stringify(me, null, 2));import json, os, time, urllib.error, urllib.request, uuid
API = os.environ.get("ONEUP_BASE_URL", "https://api.oneupai.com")
KEY = os.environ["ONEUP_API_KEY"]
def call(method, path, body=None, headers=None):
request = urllib.request.Request(
API + path,
method=method,
data=None if body is None else json.dumps(body).encode(),
headers={
"Authorization": f"Bearer {KEY}",
"Content-Type": "application/json",
"User-Agent": "my-app/1.0",
**(headers or {}),
},
)
try:
with urllib.request.urlopen(request, timeout=60) as response:
return json.load(response)
except urllib.error.HTTPError as error:
problem = json.load(error)
raise SystemExit(f"{error.code} {problem['error']}: {problem['message']}")
me = call("GET", "/v1/me")
print(json.dumps(me, indent=2))The Python helper sets a User-Agent header because the one Python sends by default is refused before the request reaches the API. Any name for your app works. Each helper gives up on a request after 60 seconds (300 for a file), so a dropped connection fails fast instead of waiting forever.
The response:
{
"entitlement": "active",
"plan": "builder",
"credits": { "period": 28000, "promo": 0, "topup": 0, "total": 28000 },
"credit_debt": 0,
"period_end": "2026-11-07T18:30:00.000Z",
"storage": { "used_bytes": 0, "quota_gb": 100 },
"used_this_period": { "credits": 0, "jobs": 0 },
"plan_name": "Concierge",
"perks": ["email_support", "content_help"],
"support": { "contact_url": "mailto:video@oneupai.com", "whatsapp_url": null }
}Your dates and numbers will differ. plan must be builder (Concierge) or scale_plus (Concierge Plus), and credits.total is what you can spend.
Step 2: Ask for a picture #
Send a sentence to oneup/image-generate-lite, the cheapest building block. It makes one picture of about one megapixel for 1 credit.
Every request that can charge credits needs an Idempotency-Key header, the retry key. Make a new one for each new request. If a request fails on the network, send it again with the same key: you get the same answer and are charged once.
RETRY_KEY=$(uuidgen)
SUBMIT=$(curl -s "$API/v1/queue/submit/oneup/image-generate-lite" \
-H "Authorization: Bearer $ONEUP_API_KEY" \
-H "Idempotency-Key: $RETRY_KEY" \
-H "Content-Type: application/json" \
-d '{"prompt": "a red bicycle in the rain"}')
echo "$SUBMIT"
TICKET=$(echo "$SUBMIT" | grep -o 'oneup_req_[A-Za-z0-9]*')const retryKey = crypto.randomUUID();
const submit = await call(
"POST",
"/v1/queue/submit/oneup/image-generate-lite",
{ prompt: "a red bicycle in the rain" },
{ "Idempotency-Key": retryKey }
);
console.log(JSON.stringify(submit, null, 2));retry_key = str(uuid.uuid4())
submit = call(
"POST",
"/v1/queue/submit/oneup/image-generate-lite",
{"prompt": "a red bicycle in the rain"},
{"Idempotency-Key": retry_key},
)
print(json.dumps(submit, indent=2))The response:
{
"ticket": "oneup_req_SuaNFGGC0b4MGIeOrp78KFRXfR",
"status": "QUEUED"
}The request answers at once. The ticket names this generation (one run of a model for your account), and you use it in the next step. The credit was taken now, when we accepted the work.
Step 3: Wait for it, then open it #
Ask for the status every 2 seconds for the first 30 seconds, then every 5 seconds, until it says COMPLETED or FAILED. Then fetch the result. A picture usually takes under a minute.
START=$SECONDS
while true; do
STATUS=$(curl -s "$API/v1/queue/status/$TICKET" \
-H "Authorization: Bearer $ONEUP_API_KEY")
echo "$STATUS"
case "$STATUS" in *'"COMPLETED"'*|*'"FAILED"'*) break ;; esac
if [ $((SECONDS - START)) -lt 30 ]; then sleep 2; else sleep 5; fi
done
curl -s "$API/v1/queue/result/$TICKET" -H "Authorization: Bearer $ONEUP_API_KEY"const started = Date.now();
let status = submit;
while (status.status !== "COMPLETED" && status.status !== "FAILED") {
const wait = Date.now() - started < 30_000 ? 2000 : 5000;
await new Promise((resolve) => setTimeout(resolve, wait));
status = await call("GET", `/v1/queue/status/${submit.ticket}`);
console.log(JSON.stringify(status));
}
if (status.status === "COMPLETED") {
const result = await call("GET", `/v1/queue/result/${submit.ticket}`);
console.log(JSON.stringify(result, null, 2));
console.log("Open this link within the hour:", result.assets[0].url);
}started = time.monotonic()
status = submit
while status["status"] not in ("COMPLETED", "FAILED"):
time.sleep(2 if time.monotonic() - started < 30 else 5)
status = call("GET", f"/v1/queue/status/{submit['ticket']}")
print(json.dumps(status))
if status["status"] == "COMPLETED":
result = call("GET", f"/v1/queue/result/{submit['ticket']}")
print(json.dumps(result, indent=2))
print("Open this link within the hour:", result["assets"][0]["url"])Each status check answers with the ticket and where the work is. You will see QUEUED, then often IN_PROGRESS and FINALIZING (we are saving the file to your account), then:
{
"ticket": "oneup_req_SuaNFGGC0b4MGIeOrp78KFRXfR",
"status": "COMPLETED"
}The result:
{
"ticket": "oneup_req_SuaNFGGC0b4MGIeOrp78KFRXfR",
"status": "COMPLETED",
"alias": "oneup/image-generate-lite",
"assets": [
{
"asset_id": "oneup_asset_MZ3l2hrtqa7jwJTo8EZHBdpVND",
"content_type": "image/jpeg",
"size_bytes": 780860,
"url": "https://media.oneupai.com/a/oneup_asset_MZ3l2hrtqa7jwJTo8EZHBdpVND/1791433973/IV77-eaCSyVIx3QBdvr0OzJK3SyyPrybmA7JAHv1U7U"
}
]
}Open the url in a browser to see your picture. It is an expiring link: it works for one hour.
If the status is FAILED instead, the response also carries "refunded": true, the credit is already back in your balance, and the result call answers 502 upstream_error. The errors page says what each code means.
What just happened #
You sent one request to a queued Alias, and we charged 1 credit when we accepted it. The ticket let you check on the work without holding a connection open, and the result came back once the picture was stored in your account. That picture is an asset: it stays in your account, and GET /v1/assets/{asset_id}/url gives you a fresh link whenever the old one runs out. Had you sent step 2 again with the same retry key, you would have got the same ticket back and paid once.
Next steps #
- A clip. Send your picture's
urlasimage_urltooneup/video-animate-lite, with apromptfor the motion and"duration": 5. A 5-second clip is 120 credits, about $1.22.02. See the model page. - A voice. Send
{"prompt": "Your words here."}tooneup/speech-standardfor up to 1,000 characters of narration. It is 11 credits, about $0.11. See the model page. - A finished video. Follow the before and after recipe: two photos become an 8-second vertical video for 15 credits, about $0.15.
Before you build, read the concepts: how credits, retries and files work, and when you get credits back.