Skip to content

Conversation

@krishna2206
Copy link

What is this PR about?

When creating a template using AI features and using Gemini, it fails with a 400 error :

Error in suggestVariants: [Error [AI_APICallError]: Bad Request] {
  cause: undefined,
  url: 'https://generativelanguage.googleapis.com/v1beta/chat/completions?key=<GEMINI_API_KEY>',
  requestBodyValues: [Object],
  statusCode: 400,
  responseHeaders: [Object],
  responseBody: '[{\n' +
    '  "error": {\n' +
    '    "code": 400,\n' +
    '    "message": "Missing Authorization header.",\n' +
    '    "status": "INVALID_ARGUMENT"\n' +
    '  }\n' +
    '}\n' +
    ']',
  isRetryable: false,
  data: undefined
}

Checklist

Before submitting this PR, please make sure that:

Copilot AI review requested due to automatic review settings December 31, 2025 07:16
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a 400 "Missing Authorization header" error when using the Gemini AI provider for template creation. The error occurred because Gemini's OpenAI-compatible endpoint requires authentication via an Authorization header with a Bearer token, rather than through query parameters.

  • Changed Gemini provider authentication from query parameters to Authorization header with Bearer token format
  • Made the configuration consistent with other OpenAI-compatible providers like Perplexity

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant