WritingTools icon indicating copy to clipboard operation
WritingTools copied to clipboard

OpenAI-compatible API support fails with custom Base URL.

Open drankush opened this issue 1 month ago • 0 comments

TLDR: Added custom request handling for OpenAI API with base URL support.

Description

When configuring the OpenAI provider with a custom Base URL (e.g., for Groq or other compatible services), the application fails to successfully complete requests. This issue appears to stem from the AIProxy dependency, which may not correctly handle custom endpoints or the specific response formats returned by third-party providers.

Resolution

I have implemented a fix in OpenAIProvider.swift to improve compatibility:

  1. Detection: The provider now checks if a custom baseURL is set (different from the default OpenAI URL).
  2. Direct Fallback: When a custom URL is detected, the app bypasses AIProxy and uses a direct URLSession implementation to send the request.
  3. Verification: This has been tested and verified to work correctly with Groq (https://api.groq.com/openai/v1) using the openai/gpt-oss-120b model.

This ensures that the application can support any standard OpenAI-compatible provider without being limited by the proxy service's constraints.

drankush avatar Nov 24 '25 09:11 drankush