Runpod
Runpod Provider for the AI SDK
The official Runpod provider contains language model and image generation support for public & private endpoints.
Setup
The Runpod provider is available in the @runpod/ai-sdk-provider module. You can install it with:
$ pnpm add @runpod/ai-sdk-provider
$ npm install @runpod/ai-sdk-provider
$ yarn add @runpod/ai-sdk-provider
$ bun add @runpod/ai-sdk-provider
Provider Instance
You can import the default provider instance runpod from @runpod/ai-sdk-provider:
If you need a customized setup, you can import createRunpod and create a provider instance with your settings:
You can use the following optional settings to customize the Runpod provider instance:
-
baseURL string
Use a different URL prefix for API calls, e.g. to use proxy servers or custom endpoints. Supports vLLM deployments, SGLang servers, and any OpenAI-compatible API. The default prefix is
https://api.runpod.ai/v2. -
apiKey string
API key that is being sent using the
Authorizationheader. It defaults to theRUNPOD_API_KEYenvironment variable. You can obtain your api key from the Runpod Console under "API Keys". -
headers Record<string,string>
Custom headers to include in the requests.
-
fetch (input: RequestInfo, init?: RequestInit) => Promise<Response>
Custom fetch implementation. You can use it as a middleware to intercept requests, or to provide a custom fetch implementation for e.g. testing.
Language Models
You can create language models using the provider instance. The first argument is the model ID:
Returns:
text- Generated text stringfinishReason- Why generation stopped ('stop', 'length', etc.)usage- Token usage information (prompt, completion, total tokens)
Streaming
Model Capabilities
| Model ID | Description | Streaming | Object Generation | Tool Usage | Reasoning Notes |
|---|---|---|---|---|---|
qwen/qwen3-32b-awq | 32B parameter multilingual model with strong reasoning capabilities | Standard reasoning events | |||
openai/gpt-oss-120b | 120B parameter open-source GPT model | Standard reasoning events |
Note: An up-to-date list of all available models can be found in the Runpod Public Endpoint Reference.
Chat Conversations
Tool Calling
Additional Returns:
toolCalls- Array of tool calls made by the modeltoolResults- Results from executed tools
Structured output
Using Output to enforce structured output is not supported by two models that are part of this provider.
You can still return structured data by instructing the model to return JSON and validating it yourself.
Image Models
You can create Runpod image models using the .imageModel() factory method.
Basic Usage
Returns:
image.uint8Array- Binary image data (efficient for processing/saving)image.base64- Base64 encoded string (for web display)image.mediaType- MIME type ('image/jpeg' or 'image/png')warnings- Array of any warnings about unsupported parameters
Model Capabilities
| Model ID | Description | Supported Aspect Ratios |
|---|---|---|
bytedance/seedream-3.0 | Advanced text-to-image model | 1:1, 4:3, 3:4 |
bytedance/seedream-4.0 | Text-to-image (v4) | 1:1 (supports 1024, 2048, 4096) |
bytedance/seedream-4.0-edit | Image editing (v4, multi-image) | 1:1 (supports 1024, 1536, 2048, 4096) |
black-forest-labs/flux-1-schnell | Fast image generation (4 steps) | 1:1, 4:3, 3:4 |
black-forest-labs/flux-1-dev | High-quality image generation | 1:1, 4:3, 3:4 |
black-forest-labs/flux-1-kontext-dev | Context-aware image generation | 1:1, 4:3, 3:4 |
qwen/qwen-image | Text-to-image generation | 1:1, 4:3, 3:4 |
qwen/qwen-image-edit | Image editing (prompt-guided) | 1:1, 4:3, 3:4 |
Note: The provider uses strict validation for image parameters. Unsupported aspect ratios (like 16:9, 9:16, 3:2, 2:3) will throw an InvalidArgumentError with a clear message about supported alternatives.
An up-to-date list of all available image models can be found in the Runpod Public Endpoint Reference.
Advanced Parameters
Modify Image
Transform existing images using text prompts.
Advanced Configuration
Provider Options
Runpod image models support flexible provider options through the providerOptions.runpod object:
| Option | Type | Default | Description |
|---|---|---|---|
negative_prompt | string | "" | Text describing what you don't want in the image |
enable_safety_checker | boolean | true | Enable content safety filtering |
image | string | - | Input image: URL or base64 data URI (required for Flux Kontext models) |
num_inference_steps | number | Auto | Number of denoising steps (Flux: 4 for schnell, 28 for others) |
guidance | number | Auto | Guidance scale for prompt adherence (Flux: 7 for schnell, 2 for others) |
output_format | string | "png" | Output image format ("png" or "jpg") |
maxPollAttempts | number | 60 | Maximum polling attempts for async generation |
pollIntervalMillis | number | 5000 | Polling interval in milliseconds (5 seconds) |