vercel/ai · warning
[cursor] auth: ${JSON.stringify(auth)} cannot configure Curs
Error message
[cursor] auth: ${JSON.stringify(auth)} cannot configure Cursor provider authentication. ${detail} CURSOR_API_KEY is still required for Cursor CLI authentication. What it means
The Cursor harness detects that the chosen ACP authentication mode cannot be configured programmatically and prints a console warning. Only 'auto' can auto-configure; 'ai-gateway' or direct-routing modes require manual setup (Gateway key as Cursor's OpenAI key with the override base URL, or direct model-provider routing) while CURSOR_API_KEY is still needed for the Cursor CLI itself.
Source
Thrown at packages/harness-cursor/src/cursor-harness.ts:450
Authorization: `Bearer ${env.CURSOR_API_KEY}`,
},
},
},
];
},
});
}
function warnCursorAuthenticationConfiguration({
auth,
}: {
auth: Exclude<ACPAuthenticationMode, 'auto'>;
}): void {
const detail =
auth === 'ai-gateway'
? "Configure an AI Gateway API key as Cursor's OpenAI API key and set Override OpenAI Base URL to https://ai-gateway.vercel.sh/cursor/v1."
: 'Configure Cursor to use its direct model-provider routing.';
console.warn(
`[cursor] auth: ${JSON.stringify(auth)} cannot configure Cursor provider authentication. ${detail} CURSOR_API_KEY is still required for Cursor CLI authentication.`,
);
}
function isRecord(value: unknown): value is Record<string, unknown> {
return value != null && typeof value === 'object' && !Array.isArray(value);
}
View on GitHub (pinned to 69428b1f8b)
Solutions
- Use auth: 'auto' so the harness configures authentication automatically
- For 'ai-gateway': manually set Cursor's OpenAI API key to an AI Gateway key and set Override OpenAI Base URL to https://ai-gateway.vercel.sh/cursor/v1
- Ensure CURSOR_API_KEY is set regardless of mode, since the Cursor CLI requires it
- Follow the printed `detail` guidance for the specific mode
Example fix
// before
createCursor({ authentication: 'ai-gateway' }); // warns, no auto setup
// after
createCursor({ authentication: 'auto' });
// or keep 'ai-gateway' and manually set Cursor's OpenAI key + base URL https://ai-gateway.vercel.sh/cursor/v1 Defensive patterns
Strategy: validation
Validate before calling
if (auth !== 'auto') {
console.warn('Non-auto Cursor auth requires manual provider setup and CURSOR_API_KEY');
} Type guard
function supportsAutoConfiguration(auth: string): boolean {
return auth === 'auto';
} Prevention
- Default to authentication: 'auto' unless you need a specific mode
- Always set CURSOR_API_KEY in the environment; it is required for the CLI regardless of provider auth
- Document the manual steps (OpenAI key + base URL override) for ai-gateway mode in team setup guides
When it happens
Trigger: createCursor called (or authentication mode resolved) with auth set to 'ai-gateway' or another non-auto ACPAuthenticationMode where the harness cannot inject provider credentials.
Common situations: Selecting auth: 'ai-gateway' without configuring Cursor's OpenAI API key/base URL manually; expecting the harness to provision Cursor auth from env vars; missing CURSOR_API_KEY for CLI login.
Understand the failure class
- Authentication and authorization failures — expired tokens, bad credentials, and missing scopes.
Related errors
- Both apiKey and authToken were provided. Please use only one
- Both apiKey and tokenProvider were provided. Please use only
- AI Gateway authentication was selected, but neither AI_GATEW
- ACP authentication method ${JSON.stringify(methodId)} is not
- Invalid argument for parameter requests: request IDs must be
AI-assisted analysis of vercel/ai@69428b1f8b (2026-08-30).
Data as JSON: /api/errors/04da978a8ac5f96c.
Report an issue: GitHub.