Generate a Studio artifact
September 29, 2026
Table of contents
Generate any Gemini Notebook Studio artifact from a notebook’s sources: an audio overview, a video overview, a slide deck, a report, an interactive report, a data table, a quiz, flashcards, an infographic or a mind map. Every generation runs as a job. Poll it with GET /jobs/jobid, or pass replyUrl to receive the finished record by webhook.
There are two ways to call it:
- On a notebook — pass the
notebookid from POST /notebooks. Its sources must be added first with POST /sources or POST /sources/upload. - One-shot — pass
urlsand/ortextinstead ofnotebook. The API creates a notebook for you on one of your accounts, adds the sources, waits for them to be ready and starts the generation. See One-shot requests.
Text results (reports, tables, quiz and flashcard JSON, mind maps) come back inside the job record. Media files (m4a, mp4, pdf, pptx, png and each slide image) are streamed from Google through GET /artifacts/download, and the job result links to it. Those links need your API token, just like every other call.
A finished artifact also stays in its notebook, where GET /artifacts lists it and GET /artifacts/artifact returns it again at any time.
Options by type
Each type accepts only the options in its row. Passing any other option returns 400 Parameter <name> does not apply to type <type>, and a value outside the listed set returns 400 with the valid values. Omitted options use the default shown.
type | format | length | style | Other options | language | instructions |
|---|---|---|---|---|---|---|
audio | deep_dive (default)briefcritiquedebate | shortdefault (default)long | ❌ | — | ✅ | ✅ |
video | explainer (default)briefcinematicshort | ❌ | auto (default)classicwhiteboardheritagepaper_craftwatercoloranimeretro_printkawaiicustom | stylePrompt(with style custom only) | ✅ (not cinematic) | ✅ (not cinematic) |
report | briefing (default)study_guideblog_postcustom | ❌ | ❌ | — | ✅ | ✅ (required with custom) |
interactive_report | ❌ | ❌ | ❌ | — | ✅ | ❌ |
table | ❌ | ❌ | ❌ | — | ✅ | ✅ |
quiz | ❌ | ❌ | ❌ | quantity: fewer, standard (default), moredifficulty: easy, medium (default), hard | ❌ | ✅ |
flashcards | ❌ | ❌ | ❌ | quantity: fewer, standard (default), moredifficulty: easy, medium (default), hard | ❌ | ✅ |
infographic | ❌ | ❌ | auto (default)sketch_noteprofessionalbento_grideditorialinstructionalbricksclayanimekawaiiscientific | orientation: landscape (default), portrait, squaredetail: concise, standard (default), detailed | ✅ | ✅ |
slides | detailed (default)presenter | shortdefault (default)long | ❌ | — | ✅ | ✅ |
mindmap | ❌ | ❌ | ❌ | — | ❌ | ✅ |
Video rules:
cinematictakes nostyle,stylePrompt,instructionsorlanguage.shorthas a fixed style, so it takes nostyleorstylePrompt. It does takelanguageandinstructions.stylePromptis required withstyle: "custom"and rejected with any other style.
What you get back
The job’s result carries the artifact title plus the fields below. The typical times were measured on a Google AI Pro account with three jobs running at once (September 2026). Google’s own cost estimate, as a percentage of the 5-hour usage window, is shown for the Free, Pro and Ultra plans. Both change over time, so read the live estimates from GET /accounts/email.
type | result fields | Download formats | Typical time | Estimate, Free / Pro / Ultra |
|---|---|---|---|---|
audio | duration (seconds), files | m4a | ~5 min (short debate) | 44.1 % / 11.03 % / 0.551 % |
video explainer / brief | duration (seconds), files | mp4 | 10–12 min | 43.7 % / 10.92 % / 0.546 % |
video short | duration (seconds), files | mp4 | ~13 min | 34.9 % / 8.73 % / 0.437 % |
video cinematic | duration (seconds), files | mp4 | not measured | 308 % (not allowed on Free) / 77.02 % / 3.85 % |
report | text (Markdown) | — | ~100 s | 4.3 % / 1.08 % / 0.0542 % |
interactive_report | text (the report’s paragraphs as plain text) | — | ~35 s | no separate estimate |
table | table (rows of cells, the first row is the header) | — | ~30 s | 5.9 % / 1.48 % / 0.0737 % |
quiz | content (JSON: quiz[] with question, answerOptions[], hint) | — | ~90 s | 2.3 % / 0.57 % / 0.0288 % |
flashcards | content (JSON: flashcards[]) | — | ~20 s | 1.9 % / 0.47 % / 0.0233 % |
infographic | files (with width / height), text | png | ~85 s | 10.7 % / 2.68 % / 0.134 % |
slides | files, slides[] (image, caption, text) | pdf, pptx, and slide with index for each slide image (PNG) | ~7 min | 54.5 % / 13.63 % / 0.682 % |
mindmap | content (JSON tree of name / children) | — | ~35 s | 1.5 % / 0.38 % / 0.0192 % |
Google refuses a job once its estimate is larger than what is left of the usage window, even before the window is full. While a job runs, Google holds its full estimate against the window, then settles to the actual cost, which is often much lower. How a refusal comes back depends on the request (see the 429 tab under Responses):
- On a notebook, Google refuses before the job exists. The call answers
429witherror,retryAtandwindowat the top level. POST /artifacts/retry and POST /artifacts/revise answer the same way. - One-shot, the generation starts inside the job, once its sources are ready. The job fails with
error.code: "quota"anderror.retryAt, withoutwindow. In sync mode, when this happens within the 90-second wait, the call answers429with that failed job record. In async mode the call has already answered201, and GET /jobs/jobidshows the failure.
retryAt and window are present only when Google’s refusal names the window.
Sync, async and webhooks
mode: "sync"(the default) waits up to 90 seconds for the result. A job that finishes in time returns200with itsresult. A job still running at 90 seconds returns202with the job record, and you keep polling GET /jobs/jobid. If your connection drops during the wait, the job carries on and can still be polled.mode: "async"returns201with the job record at once.- The API advances running jobs every ~15 seconds. A job still running after 40 minutes is failed with
error.code: "timeout". Google may still finish the artifact later, and it then shows up in GET /artifacts. replyUrlreceives onePOSTof the final job record when the job completes or fails.
Each account runs at most maxJobs jobs at a time (default 3, range 1 to 10, set with POST /accounts). GET /jobs shows what is running on each account. DELETE /jobs/jobid frees a slot at once, although Google may still finish the artifact in the notebook.
One-shot requests
Leave out notebook and pass urls and/or text. The API then:
- Picks one of your accounts that is healthy, has a free
maxJobsslot and whose last known usage does not block this type, or uses the account named byemail. - Creates a notebook titled
title(defaultuseapi <type>) and adds the sources, with YouTube links added as YouTube sources. - Waits up to 5 minutes for the sources to be ready, then starts the generation. Sources Google could not process are left out and listed in the job’s
warnings.
The job’s notebook field names the new notebook, so you can reuse it for more artifacts or chat. Set deleteNotebook: true to have it deleted once the job finishes. That is allowed only for the text-only types (report, interactive_report, table, quiz, flashcards, mindmap), because media files are streamed from their notebook and would go with it. A one-shot notebook is also deleted when the job fails before Google created the artifact, since it holds nothing you can use.
https://api.useapi.net/v1/gemini-notebook/artifacts
Request Headers
Authorization: Bearer {API token}
Content-Type: application/json
API tokenis required, see Setup useapi.net for details.
Request Body
On a notebook:
{
"notebook": "user:[email protected]:d02c903b-17f8-4241-a263-2be9e7359d55",
"type": "audio",
"format": "debate",
"length": "short",
"language": "es",
"instructions": "Focus on the risks the crew took during the landing.",
"mode": "async",
"replyUrl": "https://your-domain.com/webhook",
"replyRef": "apollo-debate-1"
}
One-shot:
{
"type": "quiz",
"urls": ["https://en.wikipedia.org/wiki/Apollo_11"],
"title": "Apollo 11 quiz",
"quantity": "more",
"difficulty": "hard",
"deleteNotebook": true
}
typeis required, the Studio artifact to generate.
Supported values:audio,video,report,interactive_report,table,quiz,flashcards,infographic,slides,mindmap.notebookis optional, the notebook id from POST /notebooks or GET /notebooks. The id names its account, so the job runs there. Omit it for a one-shot request.sourcesis optional, withnotebookonly. An array of1to300source ids from that notebook to generate from.
Default: every source in the notebook whosestatusisready. The call returns409if the notebook has no sources, or none are ready yet.urlsis optional, one-shot only. An array of1to50http(s)URLs. Links onyoutube.comoryoutu.beare added as YouTube sources, anything else as a web page.textis optional, one-shot only. Pasted text added as one source, up to 500,000 characters.
A one-shot request needsurls,text, or both.titleis optional, one-shot only. The new notebook’s title, also used as the pasted text source’s title. Up to 200 characters.
Default:useapi <type>for the notebook,Pasted textfor the text source.emailis optional, one-shot only. The account to run on. When omitted, the API picks a healthy account with a free slot whose usage allows this type.deleteNotebookis optional, one-shot only.truedeletes the one-shot notebook once the job completes or fails. Only forreport,interactive_report,table,quiz,flashcardsandmindmap.
Default:false.formatis optional, see Options by type.
audio:deep_dive(default),brief,critique,debate.
video:explainer(default),brief,cinematic,short.
report:briefing(default),study_guide,blog_post,custom. The first three use Google’s own preset prompts, and anyinstructionsyou send are added after the preset’s prompt.customuses yourinstructionsas the whole prompt.
slides:detailed(default),presenter.lengthis optional.
audio:short,default(default),long.
slides:short,default(default),long.styleis optional.
video(explainerandbriefonly):auto(default),classic,whiteboard,heritage,paper_craft,watercolor,anime,retro_print,kawaii,custom.
infographic:auto(default),sketch_note,professional,bento_grid,editorial,instructional,bricks,clay,anime,kawaii,scientific.stylePromptis optional,videoonly. Describes your own visual style, up to 2,000 characters. Required withstyle: "custom", and rejected otherwise.quantityis optional,quizandflashcardsonly.
Supported values:fewer,standard(default),more.difficultyis optional,quizandflashcardsonly.
Supported values:easy,medium(default),hard.orientationis optional,infographiconly.
Supported values:landscape(default),portrait,square.detailis optional,infographiconly.
Supported values:concise,standard(default),detailed.languageis optional, the output language as a language code such asen,es,pt_BRorzh_Hans. Accepted byaudio,video(notcinematic),report,interactive_report,table,infographicandslides.
Default:en.instructionsis optional, what to focus on or how to shape the result, up to 10,000 characters. Accepted byaudio,video(notcinematic),table,quiz,flashcards,infographic,slidesandmindmap. Forreportwithformat: "custom"it is the whole prompt and is required. With a preset report format it is added after the preset’s own prompt.modeis optional,sync(default) orasync. See Sync, async and webhooks.replyUrlis optional, a publichttp(s)URL that receives onePOSTof the job record when the job completes or fails. See GET /jobs/jobidfor the record’s shape.replyRefis optional, your own reference echoed back in the job record, up to 1024 characters.
Responses
-
Sync mode, finished within 90 seconds. The
resultshape depends on the type, see What you get back.{ "jobid": "job:0ff1aa90-5244-4900-9e7d-e0931ccce82e-user:[email protected]:gemini_notebook", "email": "[email protected]", "type": "infographic", "status": "completed", "notebook": "user:[email protected]:d02c903b-17f8-4241-a263-2be9e7359d55", "artifact": "user:[email protected]:d02c903b-17f8-4241-a263-2be9e7359d55:9213e77e-9b71-4f84-8f71-1bd130138a01", "created_at": "2026-09-27T23:31:07.016Z", "request": { "notebook": "user:[email protected]:d02c903b-17f8-4241-a263-2be9e7359d55", "type": "infographic", "style": "sketch_note", "orientation": "portrait" }, "completed_at": "2026-09-27T23:32:42.962Z", "result": { "title": "Apollo 11 Moon Landing Infographic", "files": [ { "format": "png", "mimeType": "image/png", "url": "https://api.useapi.net/v1/gemini-notebook/artifacts/download?artifact=user%3A12345-user%40example.com-artifact%3Ad02c903b-17f8-4241-a263-2be9e7359d55%3A9213e77e-9b71-4f84-8f71-1bd130138a01&format=png", "width": 1536, "height": 2752 } ], "text": "APOLLO 11: ONE GIANT LEAP FOR MANKIND\n\n[An illustrated infographic detailing the key stages of the 1969 moon landing mission...]\n\nMISSION PARAMETERS AT A GLANCE\n\n- Spacecraft: CSM-107 Columbia / LM-5 Eagle\n..." } }A one-shot quiz, with its JSON
content:{ "jobid": "job:4855bb5a-6292-4419-9fb8-1d42b81e3a78-user:[email protected]:gemini_notebook", "email": "[email protected]", "type": "quiz", "status": "completed", "notebook": "user:[email protected]:38790668-c173-4f95-9954-bb482739b582", "created_at": "2026-09-28T00:08:21.063Z", "request": { "type": "quiz", "urls": ["https://en.wikipedia.org/wiki/Apollo_11"], "title": "useapi one-shot", "deleteNotebook": true }, "updated_at": "2026-09-28T00:08:25.396Z", "artifact": "user:[email protected]:38790668-c173-4f95-9954-bb482739b582:555b18c1-237c-4014-ae8f-b5b931d2bde7", "completed_at": "2026-09-28T00:09:29.141Z", "result": { "title": "Apollo Quiz", "content": { "quiz": [ { "question": "Why did President John F. Kennedy select a crewed lunar landing mission as the target for the United States in 1961...?", "answerOptions": [ { "text": "The Soviet Union had launch vehicles with higher lift capacity, so Kennedy chose a challenge requiring new rocket technology...", "rationale": "Selecting a goal beyond existing rocket capabilities ensured that the Soviet Union's existing advantage...", "isCorrect": true }, { "text": "The United States already possessed Saturn V rockets capable of deep space flight...", "rationale": "The Saturn V rocket was still in early development phases...", "isCorrect": false } ], "hint": "Consider how initial Soviet advantages in rocket payload capacity influenced American strategic goal setting." } ] } } } -
Async mode. The job is created and returned at once. Poll GET /jobs/
jobiduntilstatusiscompletedorfailed. A one-shot job starts aspendingwithout anartifact, which appears once Google has created it.{ "jobid": "job:12597f9a-010c-4758-8e9a-b5cc17b0ccdb-user:[email protected]:gemini_notebook", "email": "[email protected]", "type": "audio", "status": "processing", "notebook": "user:[email protected]:d02c903b-17f8-4241-a263-2be9e7359d55", "artifact": "user:[email protected]:d02c903b-17f8-4241-a263-2be9e7359d55:0c2ba8dc-47dd-474f-a19c-c06896e269fd", "created_at": "2026-09-27T23:38:15.692Z", "request": { "notebook": "user:[email protected]:d02c903b-17f8-4241-a263-2be9e7359d55", "type": "audio", "format": "debate", "length": "short", "language": "es", "instructions": "Focus on the risks the crew took during the landing." }, "replyUrl": "https://your-domain.com/webhook", "replyRef": "apollo-debate-1" } -
Sync mode, still running after 90 seconds. Poll GET /jobs/
jobidfor the result. The job record is the same as the201one.{ "jobid": "job:7e575d08-5298-4a75-bd51-03de14ff3e31-user:[email protected]:gemini_notebook", "email": "[email protected]", "type": "video", "status": "processing", "notebook": "user:[email protected]:d02c903b-17f8-4241-a263-2be9e7359d55", "artifact": "user:[email protected]:d02c903b-17f8-4241-a263-2be9e7359d55:5da139a1-f97b-443e-9ef5-629a9e91dc37", "created_at": "2026-09-27T23:38:38.606Z", "request": { "notebook": "user:[email protected]:d02c903b-17f8-4241-a263-2be9e7359d55", "type": "video", "format": "brief", "style": "custom", "stylePrompt": "1960s newsreel, black and white" } } -
A missing or invalid parameter, or an option that does not fit the type.
{ "error": "Parameter style does not apply to type slides", "code": 400 }{ "error": "deleteNotebook is only for report, interactive_report, table, quiz, flashcards, mindmap: a video's files are served from its notebook", "code": 400 } -
Invalid API token.
{ "error": "useapi.net ⁝ Unauthorized", "code": 401 } -
The
notebookid belongs to a different API token, or Google does not allow this on the account’s plan.{ "error": "user:[email protected]:d02c903b-17f8-4241-a263-2be9e7359d55 does not belong to this API token", "code": 403 } -
The notebook no longer exists at Google, or the account it names (or the
emailyou passed) is not configured.{ "error": "Not found on account [email protected] (Google rLM1Ne grpc 5)", "code": 404 } -
The notebook has no sources, or none of them are ready yet. Check each source’s
statuswith GET /notebooks/notebook.{ "error": "The notebook's sources are still processing, retry shortly", "code": 409 } -
Sync mode, the job failed within 90 seconds: Google reported the generation as failed (
generation_failed), or no source of a one-shot request could be used (sources). A failed artifact can be re-run with POST /artifacts/retry.{ "jobid": "job:3b1f6c2e-8d47-4a95-b0e2-7c9d51a4e8f3-user:[email protected]:gemini_notebook", "email": "[email protected]", "type": "quiz", "status": "failed", "notebook": "user:[email protected]:d02c903b-17f8-4241-a263-2be9e7359d55", "artifact": "user:[email protected]:d02c903b-17f8-4241-a263-2be9e7359d55:5e2a9c71-4b3d-4f08-9a6e-d18c73b2f045", "created_at": "2026-09-27T23:26:40.393Z", "request": { "notebook": "user:[email protected]:d02c903b-17f8-4241-a263-2be9e7359d55", "type": "quiz" }, "completed_at": "2026-09-27T23:27:25.114Z", "error": { "code": "generation_failed", "message": "Google reported the generation as failed. POST /artifacts/retry can re-run it in place" } } -
Returned in four cases.
The account already runs
maxJobsjobs. Retry when one finishes, or raisemaxJobswith POST /accounts:{ "error": "Account [email protected] is busy: 3/3 jobs running (maxJobs)", "code": 429 }One-shot without
email, and every account is busy, or blocked by its last known usage:{ "error": "All 2 accounts are at their maxJobs limit, retry shortly", "code": 429 }{ "error": "Google's usage limit blocks audio on every available account, check GET /accounts/{email} for reset times", "code": 429 }On a notebook, Google refused the job because not enough of its usage window is left. No job was created.
retryAtis when the window resets andwindowis5horweekly, both present only when Google’s refusal names the window. GET /accounts/emailshows what is left and what each type needs:{ "error": "Not enough of Google's 5h window is left on account [email protected] for this job; it resets at 2026-09-28T04:25:40.000Z. GET /accounts/[email protected] shows what each job needs", "code": 429, "retryAt": "2026-09-28T04:25:40.000Z", "window": "5h" }One-shot in sync mode, Google refused the generation once the job’s sources were ready. The body is the failed job record, with
error.code: "quota"anderror.retryAt(nowindow). The one-shot notebook is deleted, since Google created no artifact in it. In async mode the call answers201instead, and the job fails the same way:{ "jobid": "job:9c4e2f1a-7b3d-4e85-a6c2-51d8f0b3e7a4-user:[email protected]:gemini_notebook", "email": "[email protected]", "type": "audio", "status": "failed", "notebook": "user:[email protected]:6a1f3c9e-2d48-4b7a-9e05-c3f81d7a2b64", "created_at": "2026-09-28T01:12:04.518Z", "request": { "type": "audio", "urls": ["https://en.wikipedia.org/wiki/Apollo_11"] }, "completed_at": "2026-09-28T01:12:31.207Z", "error": { "code": "quota", "message": "Not enough of Google's 5h window is left on account [email protected] for this job; it resets at 2026-09-28T04:25:40.000Z. GET /accounts/[email protected] shows what each job needs", "retryAt": "2026-09-28T04:25:40.000Z" } } -
Google answered with an unexpected error, or could not be reached. In sync mode a job that failed for such a reason also returns
502with the failed job record.{ "error": "Could not reach Gemini Notebook (HTTP 500), please retry", "code": 502 } -
A temporary condition, retry in a few minutes.
{ "error": "GOOGLE_BOT_CHECK: Google is challenging our network right now, please retry in a few minutes", "code": 503 }{ "error": "Async mode is unavailable right now, use mode sync", "code": 503 }The job could not be added to our job schedule. It is failed at once with
error.code: "scheduler". Google may already have started the generation, since only a one-shot request creates the artifact inside the job. Check GET /artifacts before you submit it again.{ "error": "Unable to lock the job schedule of user 12345, please retry", "code": 503 }{ "error": "Failed to create the job schedule (QStash HTTP 500): …", "code": 503 } -
596 Account Error
Google reported the account as signed out. While we re-check it, the answer is the first message below. Retry in about a minute. If it stays signed out, the account is paused, you receive an email, and the answer becomes the second message until you re-add it via Setup Gemini Notebook.
{ "error": "Google reported this account as signed out. We are re-checking it — please retry in about a minute. If it stays signed out, you will receive a re-add email.", "code": 596 }{ "error": "Account [email protected]: Google signed this account out. Re-add it at https://useapi.net/docs/start-here/setup-gemini-notebook", "code": 596 }In sync mode, a job whose account is confirmed signed out while it runs answers
596with the failed job record (error.code: "account").A one-shot request without
emailreturns596when none of your accounts is healthy:{ "error": "No healthy Gemini Notebook accounts available. Check GET /accounts", "code": 596 }
Model
The job record. GET /jobs/jobid and the replyUrl webhook return the same shape.
In sync mode a failed job answers with an HTTP status that matches error.code: quota → 429, account → 596, not_found → 404, sources and generation_failed → 422, cancelled → 409, timeout → 504, anything else → 502.
{ // TypeScript, all fields are optional
jobid: string // job:<uuid>-user:<id>-<email>-bot:gemini_notebook
email: string // the account the job runs on
type: 'audio' | 'video' | 'report' | 'interactive_report' | 'table' | 'quiz' | 'flashcards' | 'infographic' | 'slides' | 'mindmap' | 'research'
status: 'pending' | 'processing' | 'completed' | 'failed'
notebook: string // notebook id; for a one-shot, the notebook created for it
artifact?: string // artifact id, once Google has created it (never on a research job)
created_at: string // ISO 8601, when the job was accepted
updated_at?: string // one-shot only: when its artifact was created
completed_at?: string // ISO 8601, when the job completed or failed
request: Record<string, unknown> // your request body echoed back (ids as strings), without mode, replyUrl and replyRef
replyUrl?: string
replyRef?: string
warnings?: string[] // one-shot only: sources Google could not process and that were left out
error?: { // status 'failed'
code: 'quota' | 'account' | 'not_found' | 'sources' | 'generation_failed' | 'timeout' | 'google_error' | 'scheduler' | 'cancelled'
message: string
retryAt?: string // code 'quota', when Google names the window: ISO 8601 time it resets
}
result?: { // status 'completed', a Studio artifact
title: string
duration?: number // audio, video: seconds
files?: Array<{ // audio, video, infographic, slides
format: 'm4a' | 'mp4' | 'png' | 'pdf' | 'pptx'
mimeType: string
url: string // GET /artifacts/download link, needs your API token
width?: number // infographic
height?: number
}>
slides?: Array<{ // slides
image: string // GET /artifacts/download link (format=slide&index=N)
caption: string | null
text: string | null
}>
text?: string // report (Markdown), interactive_report, infographic
table?: string[][] // table: rows of cells, header row first
content?: unknown // quiz, flashcards, mindmap: Google's JSON
} | { // status 'completed', type 'research' (POST /research)
mode: 'fast' | 'deep'
query: string
summary?: string // fast: Google's one-line summary of what it found
report?: { // deep: the Deep Research report
title: string
markdown: string
}
noResults?: true // the run found nothing (sources is [])
sources: Array<{
url: string
title: string
description: string | null
cited: boolean // deep: the report cites it. fast: always true
}>
}
}
Examples
-
curl -X POST "https://api.useapi.net/v1/gemini-notebook/artifacts" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer …" \ -d '{ "notebook": "user:[email protected]:d02c903b-17f8-4241-a263-2be9e7359d55", "type": "slides", "format": "presenter", "length": "short", "mode": "async" }' -
const token = "API token"; const apiUrl = "https://api.useapi.net/v1/gemini-notebook"; const headers = { "Content-Type": "application/json", "Authorization": `Bearer ${token}` }; const response = await fetch(`${apiUrl}/artifacts`, { method: "POST", headers, body: JSON.stringify({ type: "audio", urls: ["https://en.wikipedia.org/wiki/Apollo_11"], format: "brief", mode: "async" }) }); let job = await response.json(); console.log("submitted", response.status, job); while (job.status === "pending" || job.status === "processing") { await new Promise(r => setTimeout(r, 15000)); job = await (await fetch(`${apiUrl}/jobs/${encodeURIComponent(job.jobid)}`, { headers })).json(); console.log(job.status); } console.log("result", job.result ?? job.error); -
import time import requests from urllib.parse import quote token = "API token" apiUrl = "https://api.useapi.net/v1/gemini-notebook" headers = {"Content-Type": "application/json", "Authorization": f"Bearer {token}"} data = { "type": "audio", "urls": ["https://en.wikipedia.org/wiki/Apollo_11"], "format": "brief", "mode": "async" } response = requests.post(f"{apiUrl}/artifacts", headers=headers, json=data) job = response.json() print("submitted", response.status_code, job) while job.get("status") in ("pending", "processing"): time.sleep(15) job = requests.get(f"{apiUrl}/jobs/{quote(job['jobid'], safe='')}", headers=headers).json() print(job["status"]) print("result", job.get("result") or job.get("error"))