Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions public-endpoints/ai-sdk.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,49 @@ const runpod = createRunpod({
| `baseURL` | Base URL for API requests | `https://api.runpod.ai/v2` |
| `headers` | Custom HTTP headers to include with requests | `{}` |

## Using custom endpoints
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Citation: PR #61 fixes createImageModel to use the same fallback pattern as other model types. Changes in src/runpod-provider.ts show the new logic that supports endpoint IDs and Console URLs via parseRunpodConsoleEndpointId.
View source


You can use your own [Serverless endpoints](/serverless/overview) with the AI SDK. This is useful when you've deployed a custom model or want to use a specific endpoint you've created.

### Using endpoint IDs

Pass your Serverless endpoint ID directly as the model identifier:

```typescript
import { runpod } from "@runpod/ai-sdk-provider";
import { generateText, experimental_generateImage as generateImage } from "ai";

// Use a custom chat endpoint
const { text } = await generateText({
model: runpod("your-endpoint-id"),
prompt: "Hello, how are you?",
});

// Use a custom image endpoint
const { image } = await generateImage({
model: runpod.image("your-image-endpoint-id"),
prompt: "A beautiful sunset",
});
```

The SDK resolves your endpoint ID to `https://api.runpod.ai/v2/{endpointId}` automatically.

### Using Console URLs

Copy an endpoint URL directly from the Runpod Console and use it as the model identifier:

```typescript
import { runpod } from "@runpod/ai-sdk-provider";
import { experimental_generateImage as generateImage } from "ai";

const { image } = await generateImage({
model: runpod.image("https://console.runpod.io/serverless/user/endpoint/abc123xyz"),
prompt: "A serene mountain landscape",
});
```

The SDK extracts the endpoint ID from the Console URL and routes requests to your endpoint.

## Text generation

### Basic text generation
Expand Down
Loading