Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

AI Tools · Function

createDeepSeek

createDeepSeek creates a configurable DeepSeek provider for the AI SDK. Configure credentials, endpoint, headers, or request handling, then select a DeepSeek model from the returned provider.

How it works

createDeepSeek constructs a DeepSeek provider instance from optional settings. The resulting provider can be called with a model identifier, such as deepseek-chat, and passed to AI SDK operations.

Syntax

createDeepSeek(options?: { baseURL?: string; apiKey?: string; headers?: Record<string, string>; fetch?: (input: RequestInfo, init?: RequestInit) => Promise<Response> })

Parameters

NameTypeDescription
baseURLstringOptional URL prefix used for API calls; the documented default is https://api.deepseek.com.
apiKeystringAPI key sent using the Authorization header; defaults to the DEEPSEEK_API_KEY environment variable.
headersRecord<string, string>Additional headers included in requests.
fetch(input: RequestInfo, init?: RequestInit) => Promise<Response>Custom function for performing requests.

Returns

A configured DeepSeek provider instance that can be used to select DeepSeek models.

Key points

  • Install and import the provider from the @ai-sdk/deepseek package.
  • Use createDeepSeek when the default provider configuration is not sufficient.
  • baseURL lets you direct requests to a different API endpoint.
  • apiKey configures the credential transmitted through the Authorization header.
  • headers adds request metadata or provider-specific headers.
  • A custom fetch implementation can control how provider HTTP requests are made.

Common mistakes

  • If apiKey is omitted, the provider reads the DEEPSEEK_API_KEY environment variable; supplying an explicit key overrides that default.

Example: Create a configured DeepSeek provider

import { createDeepSeek } from '@ai-sdk/deepseek';
import { generateText } from 'ai';

const deepSeek = createDeepSeek({
  apiKey: process.env.DEEPSEEK_API_KEY ?? '',
});

const { text } = await generateText({
  model: deepSeek('deepseek-chat'),
  prompt: 'Explain dependency injection briefly.',
});

console.log(text);

Creates a configured DeepSeek provider and uses it to select a model for text generation.

When to use it

Configure authentication

Applications that need explicit credential management or multiple provider configurations.

Override the API endpoint

Deployments using a compatible proxy, gateway, or alternate API endpoint.

Customize requests

Systems that require custom request headers or transport behavior.

Interview questions

QWhat does createDeepSeek do?

createDeepSeek creates a customized DeepSeek provider instance from configuration such as an API key, base URL, headers, or a fetch implementation. The returned provider is then used to select DeepSeek models.

Follow-up: How would you change the endpoint? Set baseURL in the provider configuration; the documentation describes it as the URL prefix used for API calls.

QHow is authentication configured?

The apiKey setting supplies the key sent in the Authorization header. If it is not provided, the provider uses the DEEPSEEK_API_KEY environment variable.

Follow-up: How could requests be modified without changing model calls? Provide custom headers or a custom fetch function in the provider settings.

QHow is the created provider used?

A provider instance is callable with a model identifier, for example deepSeek('deepseek-chat'), and the resulting model can be supplied to AI SDK functions such as generateText. This keeps provider setup separate from model execution.

Follow-up: What is the benefit of a provider instance? It centralizes endpoint and request configuration while allowing multiple model selections through the same configured provider.

  • @ai-sdk/deepseek
  • deepSeek
  • deepseek-chat
  • deepseek-reasoner
  • generateText

Source: DeepSeek - AI SDK. Checked 2026-10-15.