import { OctosparkClient } from '@octospark/sdk'
const client = new OctosparkClient({
token: process.env.OCTOSPARK_TOKEN
})
const response = await client.aiMedia.createGeneration({
teamId: process.env.OCTOSPARK_TEAM_ID ?? "teamId",
body: {},
})import os
from octospark_sdk import OctosparkClient
client = OctosparkClient(token=os.environ["OCTOSPARK_TOKEN"])
response = client.ai_media.create_generation(
teamId=os.environ.get("OCTOSPARK_TEAM_ID", "teamId"),
body={}
)octospark ai-media create-generation \
--request '{"path":{"teamId":"teamId"},"body":{}}'use reqwest::Client;
use std::env;
#[tokio::main]
async fn main() -> Result<(), reqwest::Error> {
let client = Client::new();
let base_url = env::var("OCTOSPARK_API_URL").unwrap_or_else(|_| "https://api.octospark.ai".to_string());
let team_id = env::var("OCTOSPARK_TEAM_ID").unwrap_or_else(|_| "teamId".to_string());
let url = format!("{}/v1/teams/{}/ai-media/generations", base_url.trim_end_matches('/'), team_id);
let token = env::var("OCTOSPARK_TOKEN").expect("OCTOSPARK_TOKEN");
let mut request = client.post(url).bearer_auth(token);
request = request.json(&serde_json::json!({}));
let response = request.send().await?;
println!("{}", response.text().await?);
Ok(())
}import 'dart:convert';
import 'dart:io';
import 'package:http/http.dart' as http;
Future<void> main() async {
final baseUrl = Platform.environment['OCTOSPARK_API_URL'] ?? 'https://api.octospark.ai';
final token = Platform.environment['OCTOSPARK_TOKEN'];
final teamId = Platform.environment['OCTOSPARK_TEAM_ID'] ?? 'teamId';
final url = '${baseUrl.replaceFirst(RegExp(r'/$'), '')}/v1/teams/$teamId/ai-media/generations';
final uri = Uri.parse(url);
final headers = {
'Authorization': 'Bearer $token',
'Content-Type': 'application/json',
};
final response = await http.post(
uri,
headers: headers,
body: jsonEncode({}),
);
print(response.body);
}curl --request POST \
--url https://api-staging.octospark.ai/v1/teams/{teamId}/ai-media/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"modelId": "<string>",
"params": {
"modality": "image",
"prompt": "<string>",
"count": 5,
"negativePrompt": "<string>",
"seed": 123,
"referenceAssetIds": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
]
}
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api-staging.octospark.ai/v1/teams/{teamId}/ai-media/generations",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'modelId' => '<string>',
'params' => [
'modality' => 'image',
'prompt' => '<string>',
'count' => 5,
'negativePrompt' => '<string>',
'seed' => 123,
'referenceAssetIds' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api-staging.octospark.ai/v1/teams/{teamId}/ai-media/generations"
payload := strings.NewReader("{\n \"modelId\": \"<string>\",\n \"params\": {\n \"modality\": \"image\",\n \"prompt\": \"<string>\",\n \"count\": 5,\n \"negativePrompt\": \"<string>\",\n \"seed\": 123,\n \"referenceAssetIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ]\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api-staging.octospark.ai/v1/teams/{teamId}/ai-media/generations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"modelId\": \"<string>\",\n \"params\": {\n \"modality\": \"image\",\n \"prompt\": \"<string>\",\n \"count\": 5,\n \"negativePrompt\": \"<string>\",\n \"seed\": 123,\n \"referenceAssetIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-staging.octospark.ai/v1/teams/{teamId}/ai-media/generations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"modelId\": \"<string>\",\n \"params\": {\n \"modality\": \"image\",\n \"prompt\": \"<string>\",\n \"count\": 5,\n \"negativePrompt\": \"<string>\",\n \"seed\": 123,\n \"referenceAssetIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ]\n }\n}"
response = http.request(request)
puts response.read_body$headers=@{}
$headers.Add("Authorization", "Bearer <token>")
$headers.Add("Content-Type", "application/json")
$response = Invoke-WebRequest -Uri 'https://api-staging.octospark.ai/v1/teams/{teamId}/ai-media/generations' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"modelId": "<string>",
"params": {
"modality": "image",
"prompt": "<string>",
"count": 5,
"negativePrompt": "<string>",
"seed": 123,
"referenceAssetIds": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
]
}
}'import Foundation
let parameters = [
"modelId": "<string>",
"params": [
"modality": "image",
"prompt": "<string>",
"count": 5,
"negativePrompt": "<string>",
"seed": 123,
"referenceAssetIds": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"]
]
] as [String : Any?]
let postData = try JSONSerialization.data(withJSONObject: parameters, options: [])
let url = URL(string: "https://api-staging.octospark.ai/v1/teams/{teamId}/ai-media/generations")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.timeoutInterval = 10
request.allHTTPHeaderFields = [
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
]
request.httpBody = postData
let (data, _) = try await URLSession.shared.data(for: request)
print(String(decoding: data, as: UTF8.self))using RestSharp;
var options = new RestClientOptions("https://api-staging.octospark.ai/v1/teams/{teamId}/ai-media/generations");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "Bearer <token>");
request.AddJsonBody("{\n \"modelId\": \"<string>\",\n \"params\": {\n \"modality\": \"image\",\n \"prompt\": \"<string>\",\n \"count\": 5,\n \"negativePrompt\": \"<string>\",\n \"seed\": 123,\n \"referenceAssetIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ]\n }\n}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
using RestSharp;
var options = new RestClientOptions("https://api-staging.octospark.ai/v1/teams/{teamId}/ai-media/generations");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "Bearer <token>");
request.AddJsonBody("{\n \"modelId\": \"<string>\",\n \"params\": {\n \"modality\": \"image\",\n \"prompt\": \"<string>\",\n \"count\": 5,\n \"negativePrompt\": \"<string>\",\n \"seed\": 123,\n \"referenceAssetIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ]\n }\n}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_WRITEDATA, stdout);
curl_easy_setopt(hnd, CURLOPT_URL, "https://api-staging.octospark.ai/v1/teams/{teamId}/ai-media/generations");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Authorization: Bearer <token>");
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"modelId\": \"<string>\",\n \"params\": {\n \"modality\": \"image\",\n \"prompt\": \"<string>\",\n \"count\": 5,\n \"negativePrompt\": \"<string>\",\n \"seed\": 123,\n \"referenceAssetIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ]\n }\n}");
CURLcode ret = curl_easy_perform(hnd);CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_WRITEDATA, stdout);
curl_easy_setopt(hnd, CURLOPT_URL, "https://api-staging.octospark.ai/v1/teams/{teamId}/ai-media/generations");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Authorization: Bearer <token>");
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"modelId\": \"<string>\",\n \"params\": {\n \"modality\": \"image\",\n \"prompt\": \"<string>\",\n \"count\": 5,\n \"negativePrompt\": \"<string>\",\n \"seed\": 123,\n \"referenceAssetIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ]\n }\n}");
CURLcode ret = curl_easy_perform(hnd);val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"modelId\": \"<string>\",\n \"params\": {\n \"modality\": \"image\",\n \"prompt\": \"<string>\",\n \"count\": 5,\n \"negativePrompt\": \"<string>\",\n \"seed\": 123,\n \"referenceAssetIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ]\n }\n}")
val request = Request.Builder()
.url("https://api-staging.octospark.ai/v1/teams/{teamId}/ai-media/generations")
.post(body)
.addHeader("Authorization", "Bearer <token>")
.addHeader("Content-Type", "application/json")
.build()
val response = client.newCall(request).execute(){
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"teamId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"organizationId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"sourceSurface": "studio",
"modelId": "<string>",
"modality": "image",
"route": "openrouter",
"status": "queued",
"statusError": "<string>",
"primaryAssetId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"assetIds": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"estimatedCostDecimillicents": 123,
"actualCostDecimillicents": 123,
"callerIdempotencyKey": "<string>",
"createdAt": "<string>",
"updatedAt": "<string>"
}{
"issues": [
{
"_tag": "Pointer",
"path": [
"<string>"
],
"message": "<string>"
}
],
"message": "<string>",
"_tag": "HttpApiDecodeError"
}{
"message": "<string>",
"_tag": "Unauthorized"
}{
"message": "<string>",
"_tag": "PaymentRequired"
}{
"message": "<string>",
"_tag": "Forbidden"
}{
"message": "<string>",
"_tag": "NotFound"
}{
"message": "<string>",
"_tag": "Conflict",
"code": "<string>",
"currentRevision": 123
}{
"message": "<string>",
"code": "<string>",
"_tag": "UnprocessableEntity"
}{
"message": "<string>",
"_tag": "TooManyRequests",
"code": "<string>",
"retryAfterSeconds": 123
}{
"message": "<string>",
"_tag": "InternalError"
}Create generation
Start an image or video generation. This spends credits: the server reserves a conservative hold up front (call estimateGeneration first to see it) and returns 201 with the generation in a reserved state; the provider work runs asynchronously, so poll getGeneration for completion. Send an idempotencyKey so a retry returns the original generation instead of charging twice.
import { OctosparkClient } from '@octospark/sdk'
const client = new OctosparkClient({
token: process.env.OCTOSPARK_TOKEN
})
const response = await client.aiMedia.createGeneration({
teamId: process.env.OCTOSPARK_TEAM_ID ?? "teamId",
body: {},
})import os
from octospark_sdk import OctosparkClient
client = OctosparkClient(token=os.environ["OCTOSPARK_TOKEN"])
response = client.ai_media.create_generation(
teamId=os.environ.get("OCTOSPARK_TEAM_ID", "teamId"),
body={}
)octospark ai-media create-generation \
--request '{"path":{"teamId":"teamId"},"body":{}}'use reqwest::Client;
use std::env;
#[tokio::main]
async fn main() -> Result<(), reqwest::Error> {
let client = Client::new();
let base_url = env::var("OCTOSPARK_API_URL").unwrap_or_else(|_| "https://api.octospark.ai".to_string());
let team_id = env::var("OCTOSPARK_TEAM_ID").unwrap_or_else(|_| "teamId".to_string());
let url = format!("{}/v1/teams/{}/ai-media/generations", base_url.trim_end_matches('/'), team_id);
let token = env::var("OCTOSPARK_TOKEN").expect("OCTOSPARK_TOKEN");
let mut request = client.post(url).bearer_auth(token);
request = request.json(&serde_json::json!({}));
let response = request.send().await?;
println!("{}", response.text().await?);
Ok(())
}import 'dart:convert';
import 'dart:io';
import 'package:http/http.dart' as http;
Future<void> main() async {
final baseUrl = Platform.environment['OCTOSPARK_API_URL'] ?? 'https://api.octospark.ai';
final token = Platform.environment['OCTOSPARK_TOKEN'];
final teamId = Platform.environment['OCTOSPARK_TEAM_ID'] ?? 'teamId';
final url = '${baseUrl.replaceFirst(RegExp(r'/$'), '')}/v1/teams/$teamId/ai-media/generations';
final uri = Uri.parse(url);
final headers = {
'Authorization': 'Bearer $token',
'Content-Type': 'application/json',
};
final response = await http.post(
uri,
headers: headers,
body: jsonEncode({}),
);
print(response.body);
}curl --request POST \
--url https://api-staging.octospark.ai/v1/teams/{teamId}/ai-media/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"modelId": "<string>",
"params": {
"modality": "image",
"prompt": "<string>",
"count": 5,
"negativePrompt": "<string>",
"seed": 123,
"referenceAssetIds": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
]
}
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api-staging.octospark.ai/v1/teams/{teamId}/ai-media/generations",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'modelId' => '<string>',
'params' => [
'modality' => 'image',
'prompt' => '<string>',
'count' => 5,
'negativePrompt' => '<string>',
'seed' => 123,
'referenceAssetIds' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api-staging.octospark.ai/v1/teams/{teamId}/ai-media/generations"
payload := strings.NewReader("{\n \"modelId\": \"<string>\",\n \"params\": {\n \"modality\": \"image\",\n \"prompt\": \"<string>\",\n \"count\": 5,\n \"negativePrompt\": \"<string>\",\n \"seed\": 123,\n \"referenceAssetIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ]\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api-staging.octospark.ai/v1/teams/{teamId}/ai-media/generations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"modelId\": \"<string>\",\n \"params\": {\n \"modality\": \"image\",\n \"prompt\": \"<string>\",\n \"count\": 5,\n \"negativePrompt\": \"<string>\",\n \"seed\": 123,\n \"referenceAssetIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-staging.octospark.ai/v1/teams/{teamId}/ai-media/generations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"modelId\": \"<string>\",\n \"params\": {\n \"modality\": \"image\",\n \"prompt\": \"<string>\",\n \"count\": 5,\n \"negativePrompt\": \"<string>\",\n \"seed\": 123,\n \"referenceAssetIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ]\n }\n}"
response = http.request(request)
puts response.read_body$headers=@{}
$headers.Add("Authorization", "Bearer <token>")
$headers.Add("Content-Type", "application/json")
$response = Invoke-WebRequest -Uri 'https://api-staging.octospark.ai/v1/teams/{teamId}/ai-media/generations' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"modelId": "<string>",
"params": {
"modality": "image",
"prompt": "<string>",
"count": 5,
"negativePrompt": "<string>",
"seed": 123,
"referenceAssetIds": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
]
}
}'import Foundation
let parameters = [
"modelId": "<string>",
"params": [
"modality": "image",
"prompt": "<string>",
"count": 5,
"negativePrompt": "<string>",
"seed": 123,
"referenceAssetIds": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"]
]
] as [String : Any?]
let postData = try JSONSerialization.data(withJSONObject: parameters, options: [])
let url = URL(string: "https://api-staging.octospark.ai/v1/teams/{teamId}/ai-media/generations")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.timeoutInterval = 10
request.allHTTPHeaderFields = [
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
]
request.httpBody = postData
let (data, _) = try await URLSession.shared.data(for: request)
print(String(decoding: data, as: UTF8.self))using RestSharp;
var options = new RestClientOptions("https://api-staging.octospark.ai/v1/teams/{teamId}/ai-media/generations");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "Bearer <token>");
request.AddJsonBody("{\n \"modelId\": \"<string>\",\n \"params\": {\n \"modality\": \"image\",\n \"prompt\": \"<string>\",\n \"count\": 5,\n \"negativePrompt\": \"<string>\",\n \"seed\": 123,\n \"referenceAssetIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ]\n }\n}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
using RestSharp;
var options = new RestClientOptions("https://api-staging.octospark.ai/v1/teams/{teamId}/ai-media/generations");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "Bearer <token>");
request.AddJsonBody("{\n \"modelId\": \"<string>\",\n \"params\": {\n \"modality\": \"image\",\n \"prompt\": \"<string>\",\n \"count\": 5,\n \"negativePrompt\": \"<string>\",\n \"seed\": 123,\n \"referenceAssetIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ]\n }\n}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_WRITEDATA, stdout);
curl_easy_setopt(hnd, CURLOPT_URL, "https://api-staging.octospark.ai/v1/teams/{teamId}/ai-media/generations");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Authorization: Bearer <token>");
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"modelId\": \"<string>\",\n \"params\": {\n \"modality\": \"image\",\n \"prompt\": \"<string>\",\n \"count\": 5,\n \"negativePrompt\": \"<string>\",\n \"seed\": 123,\n \"referenceAssetIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ]\n }\n}");
CURLcode ret = curl_easy_perform(hnd);CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_WRITEDATA, stdout);
curl_easy_setopt(hnd, CURLOPT_URL, "https://api-staging.octospark.ai/v1/teams/{teamId}/ai-media/generations");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Authorization: Bearer <token>");
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"modelId\": \"<string>\",\n \"params\": {\n \"modality\": \"image\",\n \"prompt\": \"<string>\",\n \"count\": 5,\n \"negativePrompt\": \"<string>\",\n \"seed\": 123,\n \"referenceAssetIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ]\n }\n}");
CURLcode ret = curl_easy_perform(hnd);val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"modelId\": \"<string>\",\n \"params\": {\n \"modality\": \"image\",\n \"prompt\": \"<string>\",\n \"count\": 5,\n \"negativePrompt\": \"<string>\",\n \"seed\": 123,\n \"referenceAssetIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ]\n }\n}")
val request = Request.Builder()
.url("https://api-staging.octospark.ai/v1/teams/{teamId}/ai-media/generations")
.post(body)
.addHeader("Authorization", "Bearer <token>")
.addHeader("Content-Type", "application/json")
.build()
val response = client.newCall(request).execute(){
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"teamId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"organizationId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"sourceSurface": "studio",
"modelId": "<string>",
"modality": "image",
"route": "openrouter",
"status": "queued",
"statusError": "<string>",
"primaryAssetId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"assetIds": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"estimatedCostDecimillicents": 123,
"actualCostDecimillicents": 123,
"callerIdempotencyKey": "<string>",
"createdAt": "<string>",
"updatedAt": "<string>"
}{
"issues": [
{
"_tag": "Pointer",
"path": [
"<string>"
],
"message": "<string>"
}
],
"message": "<string>",
"_tag": "HttpApiDecodeError"
}{
"message": "<string>",
"_tag": "Unauthorized"
}{
"message": "<string>",
"_tag": "PaymentRequired"
}{
"message": "<string>",
"_tag": "Forbidden"
}{
"message": "<string>",
"_tag": "NotFound"
}{
"message": "<string>",
"_tag": "Conflict",
"code": "<string>",
"currentRevision": 123
}{
"message": "<string>",
"code": "<string>",
"_tag": "UnprocessableEntity"
}{
"message": "<string>",
"_tag": "TooManyRequests",
"code": "<string>",
"retryAfterSeconds": 123
}{
"message": "<string>",
"_tag": "InternalError"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Team (workspace) id (UUID). Discover ids via the list teams endpoint or the agent context.
Body
Where the generation was started from (studio, agent, or editor). Used for attribution; it does not change how the media is produced.
studio, agent, editor, persona What to generate: image or video. Must match the chosen model and the shape of params.
image, video Catalog model id to generate with, e.g. "google/veo-3.1-fast". List models to see the available ids and their capabilities.
Generation parameters for the chosen modality (prompt, aspect ratio, duration, reference images, and so on). The shape must match the model's capabilities; mismatches are rejected.
- Option 1
- Option 2
Show child attributes
Show child attributes
Short human-readable summary of the prompt, stored on the generation row for display in lists and history.
Media-library folder id to place the generated asset in. null or omitted uses the team default location.
^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$Agent chat session id to associate this generation with when it was started from /agent chat.
^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$Id of a post to attach the generated media to once it completes.
Client-supplied key so a retried request returns the original generation instead of starting (and charging for) a second one.
Response
Success
a Universally Unique Identifier
^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$a Universally Unique Identifier
^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$a Universally Unique Identifier
^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$studio, agent, editor, persona image, video openrouter, fal queued, reserved, running, rate_limited, ready, failed, cancelled, skipped_insufficient_credits a Universally Unique Identifier
^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$a Universally Unique Identifier
^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$