[{"data":1,"prerenderedAt":1398},["ShallowReactive",2],{"navigation_docs_en":3,"-en-api-images":78,"-en-api-images-surround":1393},[4,25,42,58],{"title":5,"path":6,"stem":7,"children":8,"page":24},"Quick Start","/en/quick-start","en/1.quick-start",[9,12,16,20],{"title":5,"path":10,"stem":11},"/en/quick-start/overview","en/1.quick-start/0.overview",{"title":13,"path":14,"stem":15},"Install and Download","/en/quick-start/install","en/1.quick-start/1.install",{"title":17,"path":18,"stem":19},"First Launch and First Message","/en/quick-start/first-run","en/1.quick-start/2.first-run",{"title":21,"path":22,"stem":23},"macOS Install Guide","/en/quick-start/macos-install","en/1.quick-start/3.macos-install",false,{"title":26,"path":27,"stem":28,"children":29,"page":24},"Manual","/en/manual","en/2.manual",[30,34,38],{"title":31,"path":32,"stem":33},"User Manual","/en/manual/overview","en/2.manual/0.overview",{"title":35,"path":36,"stem":37},"Provider and Model Configuration","/en/manual/providers","en/2.manual/1.providers",{"title":39,"path":40,"stem":41},"Conversation and Context Management","/en/manual/chat-and-context","en/2.manual/2.chat-and-context",{"title":43,"path":44,"stem":45,"children":46,"page":24},"FAQ","/en/faq","en/3.faq",[47,50,54],{"title":43,"path":48,"stem":49},"/en/faq/overview","en/3.faq/0.overview",{"title":51,"path":52,"stem":53},"Privacy Policy","/en/faq/privacy-policy","en/3.faq/1.privacy-policy",{"title":55,"path":56,"stem":57},"Account Deletion","/en/faq/account-deletion","en/3.faq/2.account-deletion",{"title":59,"path":60,"stem":61,"children":62,"page":24},"Developer API","/en/api","en/4.api",[63,66,70,74],{"title":59,"path":64,"stem":65},"/en/api/overview","en/4.api/0.overview",{"title":67,"path":68,"stem":69},"Chat and embeddings","/en/api/chat","en/4.api/1.chat",{"title":71,"path":72,"stem":73},"Images and video","/en/api/images","en/4.api/2.images",{"title":75,"path":76,"stem":77},"Errors, limits and billing","/en/api/errors","en/4.api/3.errors",{"id":79,"title":71,"body":80,"description":1386,"extension":1387,"links":1388,"meta":1389,"navigation":1390,"path":72,"seo":1391,"stem":73,"__hash__":1392},"docs_en/en/4.api/2.images.md",{"type":81,"value":82,"toc":1375},"minimark",[83,88,96,226,229,379,400,405,412,415,444,463,606,614,618,624,680,683,687,697,759,766,934,955,963,978,982,988,1076,1082,1101,1105,1114,1183,1188,1305,1333,1337,1340,1344,1360,1371],[84,85,87],"h2",{"id":86},"images-get-the-picture-back-directly","Images: get the picture back directly",[89,90,91,95],"p",{},[92,93,94],"code",{},"POST /v1/images/generations"," matches OpenAI's endpoint:",[97,98,99,141],"code-group",{},[100,101,107],"pre",{"className":102,"code":103,"filename":104,"language":105,"meta":106,"style":106},"language-python shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","resp = client.images.generate(\n    model=\"gpt-image-2.5\",\n    prompt=\"an orange tabby cat in an astronaut helmet, oil painting\",\n)\nimage_base64 = resp.data[0].b64_json\n","Python","python","",[92,108,109,117,123,129,135],{"__ignoreMap":106},[110,111,114],"span",{"class":112,"line":113},"line",1,[110,115,116],{},"resp = client.images.generate(\n",[110,118,120],{"class":112,"line":119},2,[110,121,122],{},"    model=\"gpt-image-2.5\",\n",[110,124,126],{"class":112,"line":125},3,[110,127,128],{},"    prompt=\"an orange tabby cat in an astronaut helmet, oil painting\",\n",[110,130,132],{"class":112,"line":131},4,[110,133,134],{},")\n",[110,136,138],{"class":112,"line":137},5,[110,139,140],{},"image_base64 = resp.data[0].b64_json\n",[100,142,147],{"className":143,"code":144,"filename":145,"language":146,"meta":106,"style":106},"language-bash shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","curl https://bothub-api.bookab.info/v1/images/generations \\\n  -H \"Authorization: Bearer $BOTHUB_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"model\": \"gpt-image-2.5\",\n    \"prompt\": \"an orange tabby cat in an astronaut helmet, oil painting\"\n  }'\n","curl","bash",[92,148,149,162,182,195,206,211,217],{"__ignoreMap":106},[110,150,151,154,158],{"class":112,"line":113},[110,152,145],{"class":153},"sBMFI",[110,155,157],{"class":156},"sfazB"," https://bothub-api.bookab.info/v1/images/generations",[110,159,161],{"class":160},"sTEyZ"," \\\n",[110,163,164,167,171,174,177,180],{"class":112,"line":119},[110,165,166],{"class":156},"  -H",[110,168,170],{"class":169},"sMK4o"," \"",[110,172,173],{"class":156},"Authorization: Bearer ",[110,175,176],{"class":160},"$BOTHUB_API_KEY",[110,178,179],{"class":169},"\"",[110,181,161],{"class":160},[110,183,184,186,188,191,193],{"class":112,"line":125},[110,185,166],{"class":156},[110,187,170],{"class":169},[110,189,190],{"class":156},"Content-Type: application/json",[110,192,179],{"class":169},[110,194,161],{"class":160},[110,196,197,200,203],{"class":112,"line":131},[110,198,199],{"class":156},"  -d",[110,201,202],{"class":169}," '",[110,204,205],{"class":156},"{\n",[110,207,208],{"class":112,"line":137},[110,209,210],{"class":156},"    \"model\": \"gpt-image-2.5\",\n",[110,212,214],{"class":112,"line":213},6,[110,215,216],{"class":156},"    \"prompt\": \"an orange tabby cat in an astronaut helmet, oil painting\"\n",[110,218,220,223],{"class":112,"line":219},7,[110,221,222],{"class":156},"  }",[110,224,225],{"class":169},"'\n",[89,227,228],{},"Response:",[100,230,234],{"className":231,"code":232,"language":233,"meta":106,"style":106},"language-json shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","{\n  \"created\": 1789000000,\n  \"model\": \"gpt-image-2.5\",\n  \"data\": [\n    {\n      \"b64_json\": \"iVBORw0KGgoAAAANS...\",\n      \"url\": \"https://bothub-api.bookab.info/v1/tasks/\u003Ctask>/artifacts/\u003Cartifact>\",\n      \"revised_prompt\": \"An orange tabby cat wearing an astronaut helmet, oil painting\"\n    }\n  ]\n}\n","json",[92,235,236,240,261,281,295,300,321,341,361,367,373],{"__ignoreMap":106},[110,237,238],{"class":112,"line":113},[110,239,205],{"class":169},[110,241,242,245,249,251,254,258],{"class":112,"line":119},[110,243,244],{"class":169},"  \"",[110,246,248],{"class":247},"spNyl","created",[110,250,179],{"class":169},[110,252,253],{"class":169},":",[110,255,257],{"class":256},"sbssI"," 1789000000",[110,259,260],{"class":169},",\n",[110,262,263,265,268,270,272,274,277,279],{"class":112,"line":125},[110,264,244],{"class":169},[110,266,267],{"class":247},"model",[110,269,179],{"class":169},[110,271,253],{"class":169},[110,273,170],{"class":169},[110,275,276],{"class":156},"gpt-image-2.5",[110,278,179],{"class":169},[110,280,260],{"class":169},[110,282,283,285,288,290,292],{"class":112,"line":131},[110,284,244],{"class":169},[110,286,287],{"class":247},"data",[110,289,179],{"class":169},[110,291,253],{"class":169},[110,293,294],{"class":169}," [\n",[110,296,297],{"class":112,"line":137},[110,298,299],{"class":169},"    {\n",[110,301,302,305,308,310,312,314,317,319],{"class":112,"line":213},[110,303,304],{"class":169},"      \"",[110,306,307],{"class":153},"b64_json",[110,309,179],{"class":169},[110,311,253],{"class":169},[110,313,170],{"class":169},[110,315,316],{"class":156},"iVBORw0KGgoAAAANS...",[110,318,179],{"class":169},[110,320,260],{"class":169},[110,322,323,325,328,330,332,334,337,339],{"class":112,"line":219},[110,324,304],{"class":169},[110,326,327],{"class":153},"url",[110,329,179],{"class":169},[110,331,253],{"class":169},[110,333,170],{"class":169},[110,335,336],{"class":156},"https://bothub-api.bookab.info/v1/tasks/\u003Ctask>/artifacts/\u003Cartifact>",[110,338,179],{"class":169},[110,340,260],{"class":169},[110,342,344,346,349,351,353,355,358],{"class":112,"line":343},8,[110,345,304],{"class":169},[110,347,348],{"class":153},"revised_prompt",[110,350,179],{"class":169},[110,352,253],{"class":169},[110,354,170],{"class":169},[110,356,357],{"class":156},"An orange tabby cat wearing an astronaut helmet, oil painting",[110,359,360],{"class":169},"\"\n",[110,362,364],{"class":112,"line":363},9,[110,365,366],{"class":169},"    }\n",[110,368,370],{"class":112,"line":369},10,[110,371,372],{"class":169},"  ]\n",[110,374,376],{"class":112,"line":375},11,[110,377,378],{"class":169},"}\n",[89,380,381,385,386,388,389,391,392,395,396,399],{},[382,383,384],"strong",{},"Both forms are returned by default",": ",[92,387,307],{}," carries the bytes, ",[92,390,327],{}," points at the same\nimage (downloading it also requires your API key). Ask for just one with\n",[92,393,394],{},"\"response_format\": \"b64_json\""," or ",[92,397,398],{},"\"url\"",".",[401,402,404],"h3",{"id":403},"how-long-the-request-stays-open","How long the request stays open",[89,406,407,408,411],{},"Generating an image takes time, and ",[382,409,410],{},"this HTTP request stays open until the image is ready"," —\nusually tens of seconds, up to 5 minutes by default.",[89,413,414],{},"So raise your client timeout. The OpenAI SDK default is often too short for image work:",[100,416,418],{"className":102,"code":417,"language":105,"meta":106,"style":106},"client = OpenAI(\n    base_url=\"https://bothub-api.bookab.info/v1\",\n    api_key=\"bhk_live_xxxxxxxx\",\n    timeout=600.0,   # seconds\n)\n",[92,419,420,425,430,435,440],{"__ignoreMap":106},[110,421,422],{"class":112,"line":113},[110,423,424],{},"client = OpenAI(\n",[110,426,427],{"class":112,"line":119},[110,428,429],{},"    base_url=\"https://bothub-api.bookab.info/v1\",\n",[110,431,432],{"class":112,"line":125},[110,433,434],{},"    api_key=\"bhk_live_xxxxxxxx\",\n",[110,436,437],{"class":112,"line":131},[110,438,439],{},"    timeout=600.0,   # seconds\n",[110,441,442],{"class":112,"line":137},[110,443,134],{},[89,445,446,447,450,451,454,455,458,459,462],{},"If the wait exceeds the limit you get ",[92,448,449],{},"504"," with ",[92,452,453],{},"IMAGE_GENERATION_TIMEOUT"," — ",[382,456,457],{},"the task is not\ncancelled, it is still running",". The ",[92,460,461],{},"detail"," carries the task id so you can collect the result:",[100,464,466],{"className":231,"code":465,"language":233,"meta":106,"style":106},"{\n  \"error\": {\n    \"message\": \"Image generation did not finish within 300s. The task is still running — poll GET /v1/tasks/\u003Ctask> to collect the result.\",\n    \"type\": \"invalid_request_error\",\n    \"code\": \"image_generation_timeout\",\n    \"detail\": { \"taskId\": \"...\", \"statusUrl\": \"/v1/tasks/...\" }\n  }\n}\n",[92,467,468,472,486,507,527,546,597,602],{"__ignoreMap":106},[110,469,470],{"class":112,"line":113},[110,471,205],{"class":169},[110,473,474,476,479,481,483],{"class":112,"line":119},[110,475,244],{"class":169},[110,477,478],{"class":247},"error",[110,480,179],{"class":169},[110,482,253],{"class":169},[110,484,485],{"class":169}," {\n",[110,487,488,491,494,496,498,500,503,505],{"class":112,"line":125},[110,489,490],{"class":169},"    \"",[110,492,493],{"class":153},"message",[110,495,179],{"class":169},[110,497,253],{"class":169},[110,499,170],{"class":169},[110,501,502],{"class":156},"Image generation did not finish within 300s. The task is still running — poll GET /v1/tasks/\u003Ctask> to collect the result.",[110,504,179],{"class":169},[110,506,260],{"class":169},[110,508,509,511,514,516,518,520,523,525],{"class":112,"line":131},[110,510,490],{"class":169},[110,512,513],{"class":153},"type",[110,515,179],{"class":169},[110,517,253],{"class":169},[110,519,170],{"class":169},[110,521,522],{"class":156},"invalid_request_error",[110,524,179],{"class":169},[110,526,260],{"class":169},[110,528,529,531,533,535,537,539,542,544],{"class":112,"line":137},[110,530,490],{"class":169},[110,532,92],{"class":153},[110,534,179],{"class":169},[110,536,253],{"class":169},[110,538,170],{"class":169},[110,540,541],{"class":156},"image_generation_timeout",[110,543,179],{"class":169},[110,545,260],{"class":169},[110,547,548,550,552,554,556,559,561,564,566,568,570,573,575,578,580,583,585,587,589,592,594],{"class":112,"line":213},[110,549,490],{"class":169},[110,551,461],{"class":153},[110,553,179],{"class":169},[110,555,253],{"class":169},[110,557,558],{"class":169}," {",[110,560,170],{"class":169},[110,562,563],{"class":256},"taskId",[110,565,179],{"class":169},[110,567,253],{"class":169},[110,569,170],{"class":169},[110,571,572],{"class":156},"...",[110,574,179],{"class":169},[110,576,577],{"class":169},",",[110,579,170],{"class":169},[110,581,582],{"class":256},"statusUrl",[110,584,179],{"class":169},[110,586,253],{"class":169},[110,588,170],{"class":169},[110,590,591],{"class":156},"/v1/tasks/...",[110,593,179],{"class":169},[110,595,596],{"class":169}," }\n",[110,598,599],{"class":112,"line":219},[110,600,601],{"class":169},"  }\n",[110,603,604],{"class":112,"line":343},[110,605,378],{"class":169},[607,608,609,610,613],"warning",{},"The opposite is also true: ",[382,611,612],{},"disconnecting mid-wait cancels the task",", so the upstream provider\nstops burning your balance on a result nobody is waiting for. Don't \"probe\" with a short timeout —\nevery attempt would be thrown away.",[401,615,617],{"id":616},"several-images-at-once","Several images at once",[89,619,620,621,253],{},"Pass ",[92,622,623],{},"n",[100,625,627],{"className":231,"code":626,"language":233,"meta":106,"style":106},"{ \"model\": \"gpt-image-2.5\", \"prompt\": \"...\", \"n\": 3 }\n",[92,628,629],{"__ignoreMap":106},[110,630,631,634,636,638,640,642,644,646,648,650,652,655,657,659,661,663,665,667,669,671,673,675,678],{"class":112,"line":113},[110,632,633],{"class":169},"{",[110,635,170],{"class":169},[110,637,267],{"class":247},[110,639,179],{"class":169},[110,641,253],{"class":169},[110,643,170],{"class":169},[110,645,276],{"class":156},[110,647,179],{"class":169},[110,649,577],{"class":169},[110,651,170],{"class":169},[110,653,654],{"class":247},"prompt",[110,656,179],{"class":169},[110,658,253],{"class":169},[110,660,170],{"class":169},[110,662,572],{"class":156},[110,664,179],{"class":169},[110,666,577],{"class":169},[110,668,170],{"class":169},[110,670,623],{"class":247},[110,672,179],{"class":169},[110,674,253],{"class":169},[110,676,677],{"class":256}," 3",[110,679,596],{"class":169},[89,681,682],{},"The model's own maximum still applies; requests above it are clamped.",[84,684,686],{"id":685},"images-async-mode","Images: async mode",[89,688,689,690,693,694,253],{},"To avoid holding a request open, switch to async with ",[92,691,692],{},"\"async\": true"," or the header\n",[92,695,696],{},"X-BotHub-Async: true",[100,698,700],{"className":143,"code":699,"language":146,"meta":106,"style":106},"curl https://bothub-api.bookab.info/v1/images/generations \\\n  -H \"Authorization: Bearer $BOTHUB_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"X-BotHub-Async: true\" \\\n  -d '{\"model\": \"gpt-image-2.5\", \"prompt\": \"an orange cat\"}'\n",[92,701,702,710,724,736,748],{"__ignoreMap":106},[110,703,704,706,708],{"class":112,"line":113},[110,705,145],{"class":153},[110,707,157],{"class":156},[110,709,161],{"class":160},[110,711,712,714,716,718,720,722],{"class":112,"line":119},[110,713,166],{"class":156},[110,715,170],{"class":169},[110,717,173],{"class":156},[110,719,176],{"class":160},[110,721,179],{"class":169},[110,723,161],{"class":160},[110,725,726,728,730,732,734],{"class":112,"line":125},[110,727,166],{"class":156},[110,729,170],{"class":169},[110,731,190],{"class":156},[110,733,179],{"class":169},[110,735,161],{"class":160},[110,737,738,740,742,744,746],{"class":112,"line":131},[110,739,166],{"class":156},[110,741,170],{"class":169},[110,743,696],{"class":156},[110,745,179],{"class":169},[110,747,161],{"class":160},[110,749,750,752,754,757],{"class":112,"line":137},[110,751,199],{"class":156},[110,753,202],{"class":169},[110,755,756],{"class":156},"{\"model\": \"gpt-image-2.5\", \"prompt\": \"an orange cat\"}",[110,758,225],{"class":169},[89,760,761,762,765],{},"You get ",[92,763,764],{},"202"," immediately:",[100,767,769],{"className":231,"code":768,"language":233,"meta":106,"style":106},"{\n  \"id\": \"7f2c...\",\n  \"kind\": \"image\",\n  \"status\": \"pending\",\n  \"model\": \"gpt-image-2.5\",\n  \"status_url\": \"/v1/tasks/7f2c...\",\n  \"result_urls\": [],\n  \"thumbnail_urls\": [],\n  \"error_code\": \"\",\n  \"error_message\": \"\"\n}\n",[92,770,771,775,795,815,835,853,873,887,900,916,930],{"__ignoreMap":106},[110,772,773],{"class":112,"line":113},[110,774,205],{"class":169},[110,776,777,779,782,784,786,788,791,793],{"class":112,"line":119},[110,778,244],{"class":169},[110,780,781],{"class":247},"id",[110,783,179],{"class":169},[110,785,253],{"class":169},[110,787,170],{"class":169},[110,789,790],{"class":156},"7f2c...",[110,792,179],{"class":169},[110,794,260],{"class":169},[110,796,797,799,802,804,806,808,811,813],{"class":112,"line":125},[110,798,244],{"class":169},[110,800,801],{"class":247},"kind",[110,803,179],{"class":169},[110,805,253],{"class":169},[110,807,170],{"class":169},[110,809,810],{"class":156},"image",[110,812,179],{"class":169},[110,814,260],{"class":169},[110,816,817,819,822,824,826,828,831,833],{"class":112,"line":131},[110,818,244],{"class":169},[110,820,821],{"class":247},"status",[110,823,179],{"class":169},[110,825,253],{"class":169},[110,827,170],{"class":169},[110,829,830],{"class":156},"pending",[110,832,179],{"class":169},[110,834,260],{"class":169},[110,836,837,839,841,843,845,847,849,851],{"class":112,"line":137},[110,838,244],{"class":169},[110,840,267],{"class":247},[110,842,179],{"class":169},[110,844,253],{"class":169},[110,846,170],{"class":169},[110,848,276],{"class":156},[110,850,179],{"class":169},[110,852,260],{"class":169},[110,854,855,857,860,862,864,866,869,871],{"class":112,"line":213},[110,856,244],{"class":169},[110,858,859],{"class":247},"status_url",[110,861,179],{"class":169},[110,863,253],{"class":169},[110,865,170],{"class":169},[110,867,868],{"class":156},"/v1/tasks/7f2c...",[110,870,179],{"class":169},[110,872,260],{"class":169},[110,874,875,877,880,882,884],{"class":112,"line":219},[110,876,244],{"class":169},[110,878,879],{"class":247},"result_urls",[110,881,179],{"class":169},[110,883,253],{"class":169},[110,885,886],{"class":169}," [],\n",[110,888,889,891,894,896,898],{"class":112,"line":343},[110,890,244],{"class":169},[110,892,893],{"class":247},"thumbnail_urls",[110,895,179],{"class":169},[110,897,253],{"class":169},[110,899,886],{"class":169},[110,901,902,904,907,909,911,914],{"class":112,"line":363},[110,903,244],{"class":169},[110,905,906],{"class":247},"error_code",[110,908,179],{"class":169},[110,910,253],{"class":169},[110,912,913],{"class":169}," \"\"",[110,915,260],{"class":169},[110,917,918,920,923,925,927],{"class":112,"line":369},[110,919,244],{"class":169},[110,921,922],{"class":247},"error_message",[110,924,179],{"class":169},[110,926,253],{"class":169},[110,928,929],{"class":169}," \"\"\n",[110,931,932],{"class":112,"line":375},[110,933,378],{"class":169},[89,935,936,937,940,941,943,944,947,948,951,952,954],{},"Poll ",[92,938,939],{},"GET /v1/tasks/{id}"," until ",[92,942,821],{}," is ",[92,945,946],{},"done"," (or ",[92,949,950],{},"failed","), then download from ",[92,953,879],{},"\nwith your API key.",[956,957,958,959,962],"note",{},"This shape is BotHub's own, not OpenAI's — the SDK's ",[92,960,961],{},"images.generate()"," cannot parse it. Use plain\nHTTP requests for async mode.",[89,964,965,967,968,970,971,970,974,970,976,399],{},[92,966,821],{}," values: ",[92,969,830],{},", ",[92,972,973],{},"running",[92,975,946],{},[92,977,950],{},[84,979,981],{"id":980},"image-editing","Image editing",[89,983,984,985,253],{},"Editing goes through the native task API, ",[92,986,987],{},"POST /v1/tasks",[100,989,991],{"className":143,"code":990,"language":146,"meta":106,"style":106},"curl https://bothub-api.bookab.info/v1/tasks \\\n  -H \"Authorization: Bearer $BOTHUB_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"kind\": \"image\",\n    \"operation\": \"edit\",\n    \"model\": \"gpt-image-2.5\",\n    \"input\": {\n      \"prompt\": \"replace the background with a starry sky\",\n      \"image_urls\": [\"https://example.com/cat.png\"]\n    }\n  }'\n",[92,992,993,1002,1016,1028,1036,1041,1046,1050,1055,1060,1065,1069],{"__ignoreMap":106},[110,994,995,997,1000],{"class":112,"line":113},[110,996,145],{"class":153},[110,998,999],{"class":156}," https://bothub-api.bookab.info/v1/tasks",[110,1001,161],{"class":160},[110,1003,1004,1006,1008,1010,1012,1014],{"class":112,"line":119},[110,1005,166],{"class":156},[110,1007,170],{"class":169},[110,1009,173],{"class":156},[110,1011,176],{"class":160},[110,1013,179],{"class":169},[110,1015,161],{"class":160},[110,1017,1018,1020,1022,1024,1026],{"class":112,"line":125},[110,1019,166],{"class":156},[110,1021,170],{"class":169},[110,1023,190],{"class":156},[110,1025,179],{"class":169},[110,1027,161],{"class":160},[110,1029,1030,1032,1034],{"class":112,"line":131},[110,1031,199],{"class":156},[110,1033,202],{"class":169},[110,1035,205],{"class":156},[110,1037,1038],{"class":112,"line":137},[110,1039,1040],{"class":156},"    \"kind\": \"image\",\n",[110,1042,1043],{"class":112,"line":213},[110,1044,1045],{"class":156},"    \"operation\": \"edit\",\n",[110,1047,1048],{"class":112,"line":219},[110,1049,210],{"class":156},[110,1051,1052],{"class":112,"line":343},[110,1053,1054],{"class":156},"    \"input\": {\n",[110,1056,1057],{"class":112,"line":363},[110,1058,1059],{"class":156},"      \"prompt\": \"replace the background with a starry sky\",\n",[110,1061,1062],{"class":112,"line":369},[110,1063,1064],{"class":156},"      \"image_urls\": [\"https://example.com/cat.png\"]\n",[110,1066,1067],{"class":112,"line":375},[110,1068,366],{"class":156},[110,1070,1072,1074],{"class":112,"line":1071},12,[110,1073,222],{"class":156},[110,1075,225],{"class":169},[89,1077,1078,1079,1081],{},"The response is the same ",[92,1080,764],{}," task body; poll it the same way.",[607,1083,1084,1085,1088,1089,1092,1093,1096,1097,1100],{},"Every entry in ",[92,1086,1087],{},"image_urls"," must be something ",[382,1090,1091],{},"the upstream model can fetch",": a public URL or a\n",[92,1094,1095],{},"data:"," URI. A local path (",[92,1098,1099],{},"/Users/me/cat.png",") is rejected with an explanation — it is never\nsilently dropped.",[84,1102,1104],{"id":1103},"video-generation","Video generation",[89,1106,1107,1110,1111,253],{},[92,1108,1109],{},"POST /v1/videos",". Video takes minutes, so it is ",[382,1112,1113],{},"async only",[100,1115,1117],{"className":143,"code":1116,"language":146,"meta":106,"style":106},"curl https://bothub-api.bookab.info/v1/videos \\\n  -H \"Authorization: Bearer $BOTHUB_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"model\": \"\u003Cvideo model id>\",\n    \"prompt\": \"a cat running through snow, cinematic camera\",\n    \"seconds\": 5\n  }'\n",[92,1118,1119,1128,1142,1154,1162,1167,1172,1177],{"__ignoreMap":106},[110,1120,1121,1123,1126],{"class":112,"line":113},[110,1122,145],{"class":153},[110,1124,1125],{"class":156}," https://bothub-api.bookab.info/v1/videos",[110,1127,161],{"class":160},[110,1129,1130,1132,1134,1136,1138,1140],{"class":112,"line":119},[110,1131,166],{"class":156},[110,1133,170],{"class":169},[110,1135,173],{"class":156},[110,1137,176],{"class":160},[110,1139,179],{"class":169},[110,1141,161],{"class":160},[110,1143,1144,1146,1148,1150,1152],{"class":112,"line":125},[110,1145,166],{"class":156},[110,1147,170],{"class":169},[110,1149,190],{"class":156},[110,1151,179],{"class":169},[110,1153,161],{"class":160},[110,1155,1156,1158,1160],{"class":112,"line":131},[110,1157,199],{"class":156},[110,1159,202],{"class":169},[110,1161,205],{"class":156},[110,1163,1164],{"class":112,"line":137},[110,1165,1166],{"class":156},"    \"model\": \"\u003Cvideo model id>\",\n",[110,1168,1169],{"class":112,"line":213},[110,1170,1171],{"class":156},"    \"prompt\": \"a cat running through snow, cinematic camera\",\n",[110,1173,1174],{"class":112,"line":219},[110,1175,1176],{"class":156},"    \"seconds\": 5\n",[110,1178,1179,1181],{"class":112,"line":343},[110,1180,222],{"class":156},[110,1182,225],{"class":169},[89,1184,1185,1186,253],{},"Returns ",[92,1187,764],{},[100,1189,1191],{"className":231,"code":1190,"language":233,"meta":106,"style":106},"{\n  \"id\": \"9a1b...\",\n  \"object\": \"video\",\n  \"status\": \"queued\",\n  \"status_url\": \"/v1/videos/9a1b...\",\n  \"result_url\": null,\n  \"error\": null\n}\n",[92,1192,1193,1197,1216,1236,1255,1274,1288,1301],{"__ignoreMap":106},[110,1194,1195],{"class":112,"line":113},[110,1196,205],{"class":169},[110,1198,1199,1201,1203,1205,1207,1209,1212,1214],{"class":112,"line":119},[110,1200,244],{"class":169},[110,1202,781],{"class":247},[110,1204,179],{"class":169},[110,1206,253],{"class":169},[110,1208,170],{"class":169},[110,1210,1211],{"class":156},"9a1b...",[110,1213,179],{"class":169},[110,1215,260],{"class":169},[110,1217,1218,1220,1223,1225,1227,1229,1232,1234],{"class":112,"line":125},[110,1219,244],{"class":169},[110,1221,1222],{"class":247},"object",[110,1224,179],{"class":169},[110,1226,253],{"class":169},[110,1228,170],{"class":169},[110,1230,1231],{"class":156},"video",[110,1233,179],{"class":169},[110,1235,260],{"class":169},[110,1237,1238,1240,1242,1244,1246,1248,1251,1253],{"class":112,"line":131},[110,1239,244],{"class":169},[110,1241,821],{"class":247},[110,1243,179],{"class":169},[110,1245,253],{"class":169},[110,1247,170],{"class":169},[110,1249,1250],{"class":156},"queued",[110,1252,179],{"class":169},[110,1254,260],{"class":169},[110,1256,1257,1259,1261,1263,1265,1267,1270,1272],{"class":112,"line":137},[110,1258,244],{"class":169},[110,1260,859],{"class":247},[110,1262,179],{"class":169},[110,1264,253],{"class":169},[110,1266,170],{"class":169},[110,1268,1269],{"class":156},"/v1/videos/9a1b...",[110,1271,179],{"class":169},[110,1273,260],{"class":169},[110,1275,1276,1278,1281,1283,1285],{"class":112,"line":213},[110,1277,244],{"class":169},[110,1279,1280],{"class":247},"result_url",[110,1282,179],{"class":169},[110,1284,253],{"class":169},[110,1286,1287],{"class":169}," null,\n",[110,1289,1290,1292,1294,1296,1298],{"class":112,"line":219},[110,1291,244],{"class":169},[110,1293,478],{"class":247},[110,1295,179],{"class":169},[110,1297,253],{"class":169},[110,1299,1300],{"class":169}," null\n",[110,1302,1303],{"class":112,"line":343},[110,1304,378],{"class":169},[1306,1307,1308,1327],"ul",{},[1309,1310,1311,1314,1315,1317,1318,1317,1321,1324,1325],"li",{},[92,1312,1313],{},"GET /v1/videos/{id}"," — status goes ",[92,1316,1250],{}," → ",[92,1319,1320],{},"in_progress",[92,1322,1323],{},"completed"," / ",[92,1326,950],{},[1309,1328,1329,1332],{},[92,1330,1331],{},"GET /v1/videos/{id}/content"," — download the file once it completes",[84,1334,1336],{"id":1335},"retention","Retention",[89,1338,1339],{},"Tasks and their artifacts are kept for 24 hours and then cleaned up. Download anything you need to\nkeep.",[84,1341,1343],{"id":1342},"idempotency","Idempotency",[89,1345,1346,970,1348,1351,1352,1355,1356,1359],{},[92,1347,94],{},[92,1349,1350],{},"/v1/videos"," and ",[92,1353,1354],{},"/v1/tasks"," accept an ",[92,1357,1358],{},"Idempotency-Key"," header.\nResubmitting the same key returns the same task — nothing is generated or charged twice. Worth\nadding on flaky networks.",[89,1361,1362,1363,1366,1367,1370],{},"Note that reusing a key with a ",[382,1364,1365],{},"different request body"," returns ",[92,1368,1369],{},"409"," — change the key when you\nchange the request.",[1372,1373,1374],"style",{},"html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}html pre.shiki code .sbssI, html code.shiki .sbssI{--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C}",{"title":106,"searchDepth":119,"depth":119,"links":1376},[1377,1381,1382,1383,1384,1385],{"id":86,"depth":119,"text":87,"children":1378},[1379,1380],{"id":403,"depth":125,"text":404},{"id":616,"depth":125,"text":617},{"id":685,"depth":119,"text":686},{"id":980,"depth":119,"text":981},{"id":1103,"depth":119,"text":1104},{"id":1335,"depth":119,"text":1336},{"id":1342,"depth":119,"text":1343},"Synchronous image generation, async tasks, editing and video.","md",null,{},true,{"title":71,"description":1386},"O3Lyq9HzfUSXAz__GaEAIDzVBD8F468JlsYCnbZxGog",[1394,1396],{"title":67,"path":68,"stem":69,"description":1395},"The Chat Completions, Responses and Embeddings endpoints.",{"title":75,"path":76,"stem":77,"description":1397},"Error codes, a debugging order, rate and spend limits, and how the balance is charged.",1790522408917]