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

  1. Use auth: 'auto' so the harness configures authentication automatically
  2. 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
  3. Ensure CURSOR_API_KEY is set regardless of mode, since the Cursor CLI requires it
  4. 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

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

Related errors


AI-assisted analysis of vercel/ai@69428b1f8b (2026-08-30). Data as JSON: /api/errors/04da978a8ac5f96c. Report an issue: GitHub.