diff --git a/docs.json b/docs.json index 2c551961..2d95e9a2 100644 --- a/docs.json +++ b/docs.json @@ -370,6 +370,50 @@ } ] }, + { + "tab": "Public Endpoints", + "groups": [ + + { "group": "Image models", + "pages": [ + "public-endpoints/black-forest-labs-flux-1-dev", + "public-endpoints/black-forest-labs-flux-1-schnell", + "public-endpoints/black-forest-labs-flux-1-kontext-dev", + "public-endpoints/qwen-image-t2i", + "public-endpoints/qwen-image-t2i-lora", + "public-endpoints/qwen-image-edit", + "public-endpoints/seedream-v4-t2i", + "public-endpoints/seedream-v4-edit", + "public-endpoints/seedream-3-0-t2i", + "public-endpoints/nano-banana-edit" + ] + }, + { "group": "Text models", + "pages": [ + "public-endpoints/granite-4-0-h-small", + "public-endpoints/qwen3-32b-awq" + ] + }, + { + "group": "Video models", + "pages": [ + "public-endpoints/infinitetalk", + "public-endpoints/kling-v2-1-i2v-pro", + "public-endpoints/seedance-1-0-pro", + "public-endpoints/sora-2-i2v", + "public-endpoints/sora-2-pro-i2v", + "public-endpoints/wan-2-5" + ] + }, + { + "group": "Audio models", + "pages": [ + "public-endpoints/whisper-v3-large", + "public-endpoints/minimax-speech-02-hd" + ] + } + ] + }, { "tab": "API", "groups": [ @@ -378,7 +422,7 @@ "pages": [ "api-reference/overview", { - "group": "pods", + "group": "Pods", "pages": [ "api-reference/pods/POST/pods", "api-reference/pods/GET/pods", @@ -393,7 +437,7 @@ ] }, { - "group": "endpoints", + "group": "Endpoints", "pages": [ "api-reference/endpoints/POST/endpoints", "api-reference/endpoints/GET/endpoints", @@ -404,7 +448,7 @@ ] }, { - "group": "network volumes", + "group": "Network volumes", "pages": [ "api-reference/network-volumes/POST/networkvolumes", "api-reference/network-volumes/GET/networkvolumes", @@ -415,7 +459,7 @@ ] }, { - "group": "templates", + "group": "Templates", "pages": [ "api-reference/templates/POST/templates", "api-reference/templates/GET/templates", @@ -426,7 +470,7 @@ ] }, { - "group": "container registry auth", + "group": "Container registry auth", "pages": [ "api-reference/container-registry-auths/POST/containerregistryauth", "api-reference/container-registry-auths/GET/containerregistryauth", @@ -435,7 +479,7 @@ ] }, { - "group": "billing", + "group": "Billing", "pages": [ "api-reference/billing/GET/billing/pods", "api-reference/billing/GET/billing/endpoints", diff --git a/public-endpoints/black-forest-labs-flux-1-dev.mdx b/public-endpoints/black-forest-labs-flux-1-dev.mdx new file mode 100644 index 00000000..ac668923 --- /dev/null +++ b/public-endpoints/black-forest-labs-flux-1-dev.mdx @@ -0,0 +1,105 @@ +--- +title: "Flux Dev" +api: "POST https://api.runpod.ai/v2/black-forest-labs-flux-1-dev/run" +description: "Create high-quality, detailed images using the Flux Dev model" +playground: "simple" +--- + +Flux Dev is optimized for high-quality, detailed image generation. The model accepts several parameters to control the generation process, including prompt guidance, image dimensions, and sampling steps. + +Each image generated costs \$0.02 per megapixel. + +## Body + + + The input configuration object containing all generation parameters. + + + + Text description of the desired image. + + + + Elements to exclude from the image. + + + + Image width in pixels. Must be divisible by 64. Valid range: 256-1536. + + + + Image height in pixels. Must be divisible by 64. Valid range: 256-1536. + + + + Number of denoising steps. Valid range: 1-50. + + + + How closely to follow the prompt. Valid range: `0.0`-`10.0`. + + + + Provide a seed for reproducible results. The default value (`-1`) will generate a random seed. + + + + Output image format. Options: `"png"` or `"jpeg"`. + + + + + + + +```json Response +{ + "delayTime": 17, + "executionTime": 3986, + "id": "sync-0965434e-ff63-4a1c-a9f9-5b705f66e176-u2", + "output": { + "cost": 0.02097152, + "image_url": "https://image.runpod.ai/6/6/mCwUZlep6S/453ad7b7-67c6-43a1-8348-3ad3428ef97a.png" + }, + "status": "COMPLETED", + "workerId": "oqk7ao1uomckye" +} +``` + + + +## Response + + + Unique identifier for the job. + + + + Current status of the job. Value will be "COMPLETED" for successful synchronous requests. + + + + Time in milliseconds the job spent in queue before processing started. + + + + Time in milliseconds taken to process the request. + + + + Identifier of the worker that processed the request. + + + + Contains the generation results. + + + + URL of the generated image. The URL is valid for 7 days. + + + + Cost in credits for this generation. + + + \ No newline at end of file diff --git a/public-endpoints/overview.mdx b/public-endpoints/overview.mdx new file mode 100644 index 00000000..3f93f93a --- /dev/null +++ b/public-endpoints/overview.mdx @@ -0,0 +1,245 @@ +--- +title: "Introduction" +sidebarTitle: "Introduction" +description: "Test and deploy production-ready AI models using Public Endpoints." +--- + + + + + +Runpod Public Endpoints provide instant access to state-of-the-art AI models through simple API calls, with an API playground available through the [Runpod Hub](/hub/overview). + +## Available models + +For a list of available models and model-specific parameters, see the [Public Endpoint model reference](/hub/public-endpoint-reference). + +## Public Endpoint playground + + + + + +The Public Endpoint playground provides a streamlined way to discover and experiment with AI models. + +The playground offers: + +- **Interactive parameter adjustment**: Modify prompts, dimensions, and model settings in real-time. +- **Instant preview**: Generate images directly in the browser. +- **Cost estimation**: See estimated costs before running generation. +- **API code generation**: Create working code examples for your applications. + +### Access the playground + +1. Navigate to the [Runpod Hub](https://www.runpod.io/console/hub) in the console. +2. Select the **Public Endpoints** section. +3. Browse the [available models](#available-models) and select one that fits your needs. + +### Test a model + +To test a model in the playground: +1. Select a model from the [Runpod Hub](https://www.console.runpod.io/hub). +2. Under **Input**, enter a prompt in the text box. +3. Enter a negative prompt if needed. Negative prompts tell the model what to exclude from the output. +4. Under **Additional settings**, you can adjust the seed, aspect ratio, number of inference steps, guidance scale, and output format. +5. Click **Run** to start generating. + +Under **Result**, you can use the dropdown menu to show either a preview of the output, or the raw JSON. + +### Create a code example + + + + + +After inputting parameters using the playground, you can automatically generate an API request to use in your application. + +1. Click **API Playground** (above the **Prompt** field). +2. Using the dropdown menu, select the programming language (Python, JavaScript, cURL, etc.) and POST command you want to use (`/run` or `/runsync`). +3. Click the **Copy** icon to copy the code to your clipboard. + +## Make API requests to Public Endpoints + +You can make API requests to Public Endpoints using any HTTP client. The endpoint URL is specific to the model you want to use. + +All requests require authentication using your Runpod API key, passed in the `Authorization` header. You can find and create [API keys](/get-started/api-keys) in the [Runpod console](https://www.runpod.io/console/user/settings) under **Settings > API Keys**. + + +To learn more about the difference between synchronous and asynchronous requests, see [Endpoint operations](/serverless/endpoints/operations). + + +### Synchronous request example + +Here's an example of a synchronous request to Flux Dev using the `/runsync` endpoint: + +```bash curl +curl -X POST "https://api.runpod.ai/v2/black-forest-labs-flux-1-dev/runsync" \ + -H "Authorization: Bearer RUNPOD_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "input": { + "prompt": "A serene mountain landscape at sunset", + "width": 1024, + "height": 1024, + "num_inference_steps": 20, + "guidance": 7.5 + } + }' +``` + +### Asynchronous request example + +Here's an example of an asynchronous request to Flux Dev using the `/run` endpoint: + +```bash curl +curl -X POST "https://api.runpod.ai/v2/black-forest-labs-flux-1-dev/run" \ + -H "Authorization: Bearer RUNPOD_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "input": { + "prompt": "A futuristic cityscape with flying cars", + "width": 1024, + "height": 1024, + "num_inference_steps": 50, + "guidance": 8.0 + } + }' +``` + +You can check the status and retrieve results using the `/status` endpoint, replacing `{job-id}` with the job ID returned from the `/run` request: + +```bash curl +curl -X GET "https://api.runpod.ai/v2/black-forest-labs-flux-1-dev/status/{job-id}" \ + -H "Authorization: Bearer RUNPOD_API_KEY" +``` + +### Response format + +All endpoints return a consistent JSON response format: + +```json +{ + "delayTime": 17, + "executionTime": 3986, + "id": "sync-0965434e-ff63-4a1c-a9f9-5b705f66e176-u2", + "output": { + "cost": 0.02097152, + "image_url": "https://image.runpod.ai/6/6/mCwUZlep6S/453ad7b7-67c6-43a1-8348-3ad3428ef97a.png" + }, + "status": "COMPLETED", + "workerId": "oqk7ao1uomckye" +} +``` + +## Python example + +Here is an example Python API request to Flux Dev using the `/run` endpoint: + +```python +import requests + +headers = {"Content-Type": "application/json", "Authorization": "Bearer RUNPOD_API_KEY"} + +data = { + "input": { + "prompt": "A serene mountain landscape at sunset", + "image_format": "png", + "num_inference_steps": 25, + "guidance": 7, + "seed": 50, + "width": 1024, + "height": 1024, + } +} + +response = requests.post( + "https://api.runpod.ai/v2/black-forest-labs-flux-1-dev/run", + headers=headers, + json=data, +) +``` + +You can generate Public Endpoints API requests for Python and other programming languages using the [Public Endpoints playground](#public-endpoints-playground). + +## JavaScript/TypeScript integration with Vercel AI SDK + +For JavaScript and TypeScript projects, you can use the `@runpod/ai-sdk-provider` package to integrate Runpod's Public Endpoints with the [Vercel AI SDK](https://ai-sdk.dev/docs/introduction). + +Run this command to install the package: + +```bash +npm install @runpod/ai-sdk-provider ai +``` + +To call a Public Endpoint for text generation: + +```typescript +import { runpod } from '@runpod/ai-sdk-provider'; +import { generateText } from 'ai'; + +const { text } = await generateText({ + model: runpod('qwen3-32b-awq'), + prompt: 'Write a Python function that sorts a list:', +}); +``` + +For image generation: + +```typescript +import { runpod } from '@runpod/ai-sdk-provider'; +import { experimental_generateImage as generateImage } from 'ai'; + +const { image } = await generateImage({ + model: runpod.imageModel('flux/flux-dev'), + prompt: 'A serene mountain landscape at sunset', + aspectRatio: '4:3', +}); +``` + +For comprehensive documentation and examples, see the [Node package documentation](https://www.npmjs.com/package/@runpod/ai-sdk-provider). + +## Pricing + +Public Endpoints use transparent, usage-based pricing. For example: + +| Model | Price | Billing unit | +|-------|-------|--------------| +| Flux Dev | $0.02 | Per megapixel | +| Flux Schnell | $0.0024 | Per megapixel | +| WAN 2.5 | $0.5 | Per 5 seconds of video | +| Whisper V3 Large | $0.05 | Per 1000 characters of audio transcribed | +| Qwen3 32B AWQ | $0.01 | Per 1000 tokens of text generated | + + +Pricing is calculated based on the actual output resolution. You will not be charged for failed generations. + + +Here are some pricing examples that demonstrate how you can estimate costs for image generation: + +- 512×512 image (0.25 megapixels) + - Flux Dev: (512 * 512 / 1,000,000) * \$0.02 = \$0.00524288 + - Flux Schnell: (512 * 512 / 1,000,000) * \$0.0024 = \$0.0006291456 +- 1024×1024 image (1 megapixel) + - Flux Dev: (1024 * 1024 / 1,000,000) * \$0.02 = \$0.02097152 + - Flux Schnell: (1024 * 1024 / 1,000,000) * \$0.0024 = \$0.0025165824 + + +Runpod's billing system rounds up after the first 10 decimal places. + + +For complete pricing information for each model, see the [Public Endpoint model reference](/hub/public-endpoint-reference) page. + + +## Best practices + +When working with Public Endpoints, following best practices will help you achieve better results and optimize performance. + +### Prompt engineering + +For prompt engineering, be specific with detailed prompts as they generally produce better results. Include style modifiers such as art styles, camera angles, or lighting conditions. For Flux Dev, use negative prompts to exclude unwanted elements from your images. + +A good prompt example would be: "A professional portrait of a woman in business attire, studio lighting, high quality, detailed, corporate headshot style." + +### Performance optimization + +For performance optimization, choose the right model for your needs. Use Flux Schnell when you need speed, and Flux Dev when you need higher quality. Standard dimensions like 1024×1024 render fastest, so stick to these unless you need specific aspect ratios. For multiple images, use asynchronous endpoints to batch your requests. Consider caching results by storing generated images to avoid regenerating identical prompts.