diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 2fa931cb..f328dd65 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -1,8 +1,8 @@ -speakeasyVersion: 1.372.0 +speakeasyVersion: 1.372.1 sources: livepeer-studio-api: sourceNamespace: livepeer-studio-api - sourceRevisionDigest: sha256:75784d99c7c634b74d58e74b583a42e8cb7900f707df00edd19051467eeeb0a9 + sourceRevisionDigest: sha256:b3ca17924b8c04d37632cd347b7f06836796e2e77602dbedc56c950a2f1e7564 sourceBlobDigest: sha256:90f532f402a228e8cdf7529eb80401058c4638d01f4c5bd3a17c9016034d64ab tags: - latest @@ -12,6 +12,14 @@ workflow: workflowVersion: 1.0.0 speakeasyVersion: latest sources: + livepeer-ai-api: + inputs: + - location: https://raw.githubusercontent.com/livepeer/ai-worker/main/runner/gateway.openapi.json + overlays: + - location: https://raw.githubusercontent.com/livepeer/livepeer-ai-js/main/codeSamples.yaml + output: ai/api-reference/gateway.openapi.json + registry: + location: registry.speakeasyapi.dev/livepeer-8mq/livepeer-ai/livepeer-ai-oas livepeer-studio-api: inputs: - location: https://raw.githubusercontent.com/livepeer/studio/master/packages/api/src/schema/api-schema.yaml diff --git a/ai/api-reference/gateway.openapi.json b/ai/api-reference/gateway.openapi.json new file mode 100644 index 00000000..acc4481b --- /dev/null +++ b/ai/api-reference/gateway.openapi.json @@ -0,0 +1,881 @@ +{ + "openapi": "3.1.0", + "info": { + "title": "Livepeer AI Runner", + "description": "An application to run AI pipelines", + "version": "0.1.0" + }, + "servers": [ + { + "url": "https://dream-gateway.livepeer.cloud", + "description": "Livepeer Cloud Community Gateway" + } + ], + "paths": { + "/text-to-image": { + "post": { + "summary": "Text To Image", + "operationId": "text_to_image", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/TextToImageParams" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ImageResponse" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPError" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPError" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPError" + } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + } + } + }, + "security": [ + { + "HTTPBearer": [] + } + ], + "x-codeSamples": [ + { + "lang": "typescript", + "label": "text_to_image", + "source": "import { LivepeerAi } from \"livepeer-ai\";\n\nconst livepeerAi = new LivepeerAi({\n httpBearer: \"\u003cYOUR_BEARER_TOKEN_HERE\u003e\",\n});\n\nasync function run() {\n const result = await livepeerAi.textToImage({\n prompt: \"\u003cvalue\u003e\",\n });\n\n // Handle the result\n console.log(result)\n}\n\nrun();" + } + ] + } + }, + "/image-to-image": { + "post": { + "summary": "Image To Image", + "operationId": "image_to_image", + "requestBody": { + "content": { + "multipart/form-data": { + "schema": { + "$ref": "#/components/schemas/Body_image_to_image_image_to_image_post" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ImageResponse" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPError" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPError" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPError" + } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + } + } + }, + "security": [ + { + "HTTPBearer": [] + } + ], + "x-codeSamples": [ + { + "lang": "typescript", + "label": "image_to_image", + "source": "import { LivepeerAi } from \"livepeer-ai\";\nimport { openAsBlob } from \"node:fs\";\n\nconst livepeerAi = new LivepeerAi({\n httpBearer: \"\u003cYOUR_BEARER_TOKEN_HERE\u003e\",\n});\n\nasync function run() {\n const result = await livepeerAi.imageToImage({\n prompt: \"\u003cvalue\u003e\",\n image: await openAsBlob(\"./sample-file\"),\n });\n\n // Handle the result\n console.log(result)\n}\n\nrun();" + } + ] + } + }, + "/image-to-video": { + "post": { + "summary": "Image To Video", + "operationId": "image_to_video", + "requestBody": { + "content": { + "multipart/form-data": { + "schema": { + "$ref": "#/components/schemas/Body_image_to_video_image_to_video_post" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/VideoResponse" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPError" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPError" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPError" + } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + } + } + }, + "security": [ + { + "HTTPBearer": [] + } + ], + "x-codeSamples": [ + { + "lang": "typescript", + "label": "image_to_video", + "source": "import { LivepeerAi } from \"livepeer-ai\";\nimport { openAsBlob } from \"node:fs\";\n\nconst livepeerAi = new LivepeerAi({\n httpBearer: \"\u003cYOUR_BEARER_TOKEN_HERE\u003e\",\n});\n\nasync function run() {\n const result = await livepeerAi.imageToVideo({\n image: await openAsBlob(\"./sample-file\"),\n });\n\n // Handle the result\n console.log(result)\n}\n\nrun();" + } + ] + } + }, + "/upscale": { + "post": { + "summary": "Upscale", + "operationId": "upscale", + "requestBody": { + "content": { + "multipart/form-data": { + "schema": { + "$ref": "#/components/schemas/Body_upscale_upscale_post" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ImageResponse" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPError" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPError" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPError" + } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + } + } + }, + "security": [ + { + "HTTPBearer": [] + } + ], + "x-codeSamples": [ + { + "lang": "typescript", + "label": "upscale", + "source": "import { LivepeerAi } from \"livepeer-ai\";\nimport { openAsBlob } from \"node:fs\";\n\nconst livepeerAi = new LivepeerAi({\n httpBearer: \"\u003cYOUR_BEARER_TOKEN_HERE\u003e\",\n});\n\nasync function run() {\n const result = await livepeerAi.upscale({\n prompt: \"\u003cvalue\u003e\",\n image: await openAsBlob(\"./sample-file\"),\n });\n\n // Handle the result\n console.log(result)\n}\n\nrun();" + } + ] + } + }, + "/audio-to-text": { + "post": { + "summary": "Audio To Text", + "operationId": "audio_to_text", + "requestBody": { + "content": { + "multipart/form-data": { + "schema": { + "$ref": "#/components/schemas/Body_audio_to_text_audio_to_text_post" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/TextResponse" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPError" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPError" + } + } + } + }, + "413": { + "description": "Request Entity Too Large", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPError" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPError" + } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + } + } + }, + "security": [ + { + "HTTPBearer": [] + } + ], + "x-codeSamples": [ + { + "lang": "typescript", + "label": "audio_to_text", + "source": "import { LivepeerAi } from \"livepeer-ai\";\nimport { openAsBlob } from \"node:fs\";\n\nconst livepeerAi = new LivepeerAi({\n httpBearer: \"\u003cYOUR_BEARER_TOKEN_HERE\u003e\",\n});\n\nasync function run() {\n const result = await livepeerAi.audioToText({\n audio: await openAsBlob(\"./sample-file\"),\n });\n\n // Handle the result\n console.log(result)\n}\n\nrun();" + } + ] + } + } + }, + "components": { + "schemas": { + "APIError": { + "properties": { + "msg": { + "type": "string", + "title": "Msg" + } + }, + "type": "object", + "required": [ + "msg" + ], + "title": "APIError" + }, + "Body_audio_to_text_audio_to_text_post": { + "properties": { + "audio": { + "type": "string", + "format": "binary", + "title": "Audio", + "description": "Uploaded audio file to be transcribed." + }, + "model_id": { + "type": "string", + "title": "Model Id", + "description": "Hugging Face model ID used for transcription.", + "default": "" + } + }, + "type": "object", + "required": [ + "audio", + "model_id" + ], + "title": "Body_audio_to_text_audio_to_text_post" + }, + "Body_image_to_image_image_to_image_post": { + "properties": { + "prompt": { + "type": "string", + "title": "Prompt", + "description": "Text prompt(s) to guide image generation." + }, + "image": { + "type": "string", + "format": "binary", + "title": "Image", + "description": "Uploaded image to modify with the pipeline." + }, + "model_id": { + "type": "string", + "title": "Model Id", + "description": "Hugging Face model ID used for image generation.", + "default": "" + }, + "strength": { + "type": "number", + "title": "Strength", + "description": "Degree of transformation applied to the reference image (0 to 1).", + "default": 0.8 + }, + "guidance_scale": { + "type": "number", + "title": "Guidance Scale", + "description": "Encourages model to generate images closely linked to the text prompt (higher values may reduce image quality).", + "default": 7.5 + }, + "image_guidance_scale": { + "type": "number", + "title": "Image Guidance Scale", + "description": "Degree to which the generated image is pushed towards the initial image.", + "default": 1.5 + }, + "negative_prompt": { + "type": "string", + "title": "Negative Prompt", + "description": "Text prompt(s) to guide what to exclude from image generation. Ignored if guidance_scale \u003c 1.", + "default": "" + }, + "safety_check": { + "type": "boolean", + "title": "Safety Check", + "description": "Perform a safety check to estimate if generated images could be offensive or harmful.", + "default": true + }, + "seed": { + "type": "integer", + "title": "Seed", + "description": "Seed for random number generation." + }, + "num_inference_steps": { + "type": "integer", + "title": "Num Inference Steps", + "description": "Number of denoising steps. More steps usually lead to higher quality images but slower inference. Modulated by strength.", + "default": 100 + }, + "num_images_per_prompt": { + "type": "integer", + "title": "Num Images Per Prompt", + "description": "Number of images to generate per prompt.", + "default": 1 + } + }, + "type": "object", + "required": [ + "prompt", + "image", + "model_id" + ], + "title": "Body_image_to_image_image_to_image_post" + }, + "Body_image_to_video_image_to_video_post": { + "properties": { + "image": { + "type": "string", + "format": "binary", + "title": "Image", + "description": "Uploaded image to generate a video from." + }, + "model_id": { + "type": "string", + "title": "Model Id", + "description": "Hugging Face model ID used for video generation.", + "default": "" + }, + "height": { + "type": "integer", + "title": "Height", + "description": "The height in pixels of the generated video.", + "default": 576 + }, + "width": { + "type": "integer", + "title": "Width", + "description": "The width in pixels of the generated video.", + "default": 1024 + }, + "fps": { + "type": "integer", + "title": "Fps", + "description": "The frames per second of the generated video.", + "default": 6 + }, + "motion_bucket_id": { + "type": "integer", + "title": "Motion Bucket Id", + "description": "Used for conditioning the amount of motion for the generation. The higher the number the more motion will be in the video.", + "default": 127 + }, + "noise_aug_strength": { + "type": "number", + "title": "Noise Aug Strength", + "description": "Amount of noise added to the conditioning image. Higher values reduce resemblance to the conditioning image and increase motion.", + "default": 0.02 + }, + "safety_check": { + "type": "boolean", + "title": "Safety Check", + "description": "Perform a safety check to estimate if generated images could be offensive or harmful.", + "default": true + }, + "seed": { + "type": "integer", + "title": "Seed", + "description": "Seed for random number generation." + }, + "num_inference_steps": { + "type": "integer", + "title": "Num Inference Steps", + "description": "Number of denoising steps. More steps usually lead to higher quality images but slower inference. Modulated by strength.", + "default": 25 + } + }, + "type": "object", + "required": [ + "image", + "model_id" + ], + "title": "Body_image_to_video_image_to_video_post" + }, + "Body_upscale_upscale_post": { + "properties": { + "prompt": { + "type": "string", + "title": "Prompt", + "description": "Text prompt(s) to guide upscaled image generation." + }, + "image": { + "type": "string", + "format": "binary", + "title": "Image", + "description": "Uploaded image to modify with the pipeline." + }, + "model_id": { + "type": "string", + "title": "Model Id", + "description": "Hugging Face model ID used for upscaled image generation.", + "default": "" + }, + "safety_check": { + "type": "boolean", + "title": "Safety Check", + "description": "Perform a safety check to estimate if generated images could be offensive or harmful.", + "default": true + }, + "seed": { + "type": "integer", + "title": "Seed", + "description": "Seed for random number generation." + }, + "num_inference_steps": { + "type": "integer", + "title": "Num Inference Steps", + "description": "Number of denoising steps. More steps usually lead to higher quality images but slower inference. Modulated by strength.", + "default": 75 + } + }, + "type": "object", + "required": [ + "prompt", + "image", + "model_id" + ], + "title": "Body_upscale_upscale_post" + }, + "HTTPError": { + "properties": { + "detail": { + "$ref": "#/components/schemas/APIError" + } + }, + "type": "object", + "required": [ + "detail" + ], + "title": "HTTPError" + }, + "HTTPValidationError": { + "properties": { + "detail": { + "items": { + "$ref": "#/components/schemas/ValidationError" + }, + "type": "array", + "title": "Detail" + } + }, + "type": "object", + "title": "HTTPValidationError" + }, + "ImageResponse": { + "properties": { + "images": { + "items": { + "$ref": "#/components/schemas/Media" + }, + "type": "array", + "title": "Images" + } + }, + "type": "object", + "required": [ + "images" + ], + "title": "ImageResponse" + }, + "Media": { + "properties": { + "url": { + "type": "string", + "title": "Url" + }, + "seed": { + "type": "integer", + "title": "Seed" + }, + "nsfw": { + "type": "boolean", + "title": "Nsfw" + } + }, + "type": "object", + "required": [ + "url", + "seed", + "nsfw" + ], + "title": "Media" + }, + "TextResponse": { + "properties": { + "text": { + "type": "string", + "title": "Text" + }, + "chunks": { + "items": { + "$ref": "#/components/schemas/chunk" + }, + "type": "array", + "title": "Chunks" + } + }, + "type": "object", + "required": [ + "text", + "chunks" + ], + "title": "TextResponse" + }, + "TextToImageParams": { + "properties": { + "model_id": { + "type": "string", + "title": "Model Id", + "description": "Hugging Face model ID used for image generation.", + "default": "" + }, + "prompt": { + "type": "string", + "title": "Prompt", + "description": "Text prompt(s) to guide image generation. Separate multiple prompts with '|' if supported by the model." + }, + "height": { + "type": "integer", + "title": "Height", + "description": "The height in pixels of the generated image.", + "default": 576 + }, + "width": { + "type": "integer", + "title": "Width", + "description": "The width in pixels of the generated image.", + "default": 1024 + }, + "guidance_scale": { + "type": "number", + "title": "Guidance Scale", + "description": "Encourages model to generate images closely linked to the text prompt (higher values may reduce image quality).", + "default": 7.5 + }, + "negative_prompt": { + "type": "string", + "title": "Negative Prompt", + "description": "Text prompt(s) to guide what to exclude from image generation. Ignored if guidance_scale \u003c 1.", + "default": "" + }, + "safety_check": { + "type": "boolean", + "title": "Safety Check", + "description": "Perform a safety check to estimate if generated images could be offensive or harmful.", + "default": true + }, + "seed": { + "type": "integer", + "title": "Seed", + "description": "Seed for random number generation." + }, + "num_inference_steps": { + "type": "integer", + "title": "Num Inference Steps", + "description": "Number of denoising steps. More steps usually lead to higher quality images but slower inference. Modulated by strength.", + "default": 50 + }, + "num_images_per_prompt": { + "type": "integer", + "title": "Num Images Per Prompt", + "description": "Number of images to generate per prompt.", + "default": 1 + } + }, + "type": "object", + "required": [ + "prompt", + "model_id" + ], + "title": "TextToImageParams" + }, + "ValidationError": { + "properties": { + "loc": { + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "integer" + } + ] + }, + "type": "array", + "title": "Location" + }, + "msg": { + "type": "string", + "title": "Message" + }, + "type": { + "type": "string", + "title": "Error Type" + } + }, + "type": "object", + "required": [ + "loc", + "msg", + "type" + ], + "title": "ValidationError" + }, + "VideoResponse": { + "properties": { + "images": { + "items": { + "$ref": "#/components/schemas/Media" + }, + "type": "array", + "title": "Images" + } + }, + "type": "object", + "required": [ + "images" + ], + "title": "VideoResponse" + }, + "chunk": { + "properties": { + "timestamp": { + "items": {}, + "type": "array", + "title": "Timestamp" + }, + "text": { + "type": "string", + "title": "Text" + } + }, + "type": "object", + "required": [ + "timestamp", + "text" + ], + "title": "chunk" + } + }, + "securitySchemes": { + "HTTPBearer": { + "type": "http", + "scheme": "bearer" + } + } + } +} \ No newline at end of file