vercel/ai · error · UnsupportedFunctionalityError
DeepSeek assistant prefix completion requires a beta base UR
Error message
DeepSeek assistant prefix completion requires a beta base URL ending in `/beta`.
What it means
DeepSeek assistant prefix completion is a beta feature available only on the /beta base URL. When a prefixed assistant message is present but the model was not created with a base URL ending in /beta (supportsAssistantPrefixCompletion false), the SDK throws UnsupportedFunctionalityError.
Source
Thrown at packages/deepseek/src/chat/convert-to-deepseek-chat-messages.ts:277
...(deepseekMessageOptions?.name != null && {
name: deepseekMessageOptions.name,
}),
});
break;
}
case 'assistant': {
if (deepseekMessageOptions?.prefix === true) {
if (index !== prompt.length - 1) {
throw new InvalidPromptError({
prompt,
message:
'DeepSeek assistant prefix completion requires the prefixed assistant message to be the final message.',
});
}
if (!supportsAssistantPrefixCompletion) {
throw new UnsupportedFunctionalityError({
functionality: 'DeepSeek assistant prefix completion',
message:
'DeepSeek assistant prefix completion requires a beta base URL ending in `/beta`.',
});
}
}
let text = '';
let reasoning: string | undefined;
const toolCalls: Array<{
id: string;
type: 'function';
function: { name: string; arguments: string };
}> = [];
for (const part of content) {
switch (part.type) {View on GitHub (pinned to 69428b1f8b)
Solutions
- Create the provider with baseURL 'https://api.deepseek.com/beta', e.g. createDeepSeek({ baseURL: 'https://api.deepseek.com/beta' })
- Or use the deepseek.beta model factory if available
- Or remove prefix: true if beta endpoints cannot be used
Example fix
// before
const deepseek = createDeepSeek({ apiKey });
// after
const deepseek = createDeepSeek({ apiKey, baseURL: 'https://api.deepseek.com/beta' }); Defensive patterns
Strategy: validation
Validate before calling
const baseURL = process.env.DEEPSEEK_BASE_URL ?? 'https://api.deepseek.com';
function assertBetaForPrefix() {
if (!baseURL.endsWith('/beta')) throw new Error('prefix completion requires a baseURL ending in /beta');
} Try / catch
try { ... } catch (e) { if (UnsupportedFunctionalityError.isInstance(e) && /assistant prefix completion/.test(e.message)) { /* recreate provider with /beta baseURL */ } throw e; } Prevention
- Set the DeepSeek baseURL to https://api.deepseek.com/beta wherever prefix completion is used
- Gate prefix usage on a feature flag that also selects the beta endpoint
- Verify proxy/gateway URLs still end with /beta
When it happens
Trigger: Using createDeepSeek() with the default (non-beta) base URL — or a custom URL not ending in /beta — while sending an assistant message with deepseek.prefix: true.
Common situations: Production config pointing at the stable endpoint after testing locally against /beta; a proxy/gateway base URL that doesn't end with /beta; forgetting that prefix completion requires the beta endpoint.
Related errors
- DeepSeek strict tool calls require a beta base URL ending in
- DeepSeek assistant prefix completion requires `prefix: true`
- DeepSeek assistant prefix completion requires the prefixed a
- DeepSeek image media type ${resolvedMediaType}
- DeepSeek image URLs must not exceed 8192 characters.
AI-assisted analysis of vercel/ai@69428b1f8b (2026-08-30).
Data as JSON: /api/errors/f85aadb28563d348.
Report an issue: GitHub.