nhaouari / obsidian-textgenerator-plugin

Text Generator is a versatile plugin for Obsidian that allows you to generate text content using various AI providers, including OpenAI, Anthropic, Google and local models.
https://text-gen.com/
MIT License
1.45k stars 127 forks source link

x-stainless-os header being added in mom-Mistral api requests #294

Closed jvsteiner closed 3 months ago

jvsteiner commented 3 months ago

I have a custom OpenAI compatible endpoint I am trying to use (at runpod in a serverless environment). I created a customer endpoint, based on the OpenAPI pattern in the settings. Unfortunately, I get the following error on the developer console:

Access to fetch at 'https://api.runpod.ai/v2/{my_endpoint_id}/openai/v1/chat/completions' from origin 'app://obsidian.md' has been blocked by CORS policy: Request header field x-stainless-os is not allowed by Access-Control-Allow-Headers in preflight response.

I searched the repository for x-stainless-os and the only place I see this header is in src/LLMProviders/langchain/mistralaiChat.tsx which is the Mistral object. Any idea why is would be getting added to a request made using the OpenAI pattern? the actual production OpenAI endpoints don't care about it, but the runpod endpoints do, and afaict, there is not any way to add custom headers at runpod.

haouarihk commented 3 months ago

its built into the openai library. the only way to go around it, is by using the custom provider

jvsteiner commented 3 months ago

this is what I eventually did.