openai.ex
openai.ex copied to clipboard
Can pass custom headers to config. Allow using alternative endpoints configuration
I needed to modify the code to be able to use OpenRouter ( and access GPT 4 32k ). We can now use custom_headers in the config to add custom headers this way:
config :openai,
api_key: "...",
organization_key: "...",
http_options: [...],
api_url: "https://openrouter.ai/api",
custom_headers: [
{"HTTP-Referer", "https://example.com/"},
{"X-Title", "MyService" }
]
Note: this is my first open source contribution ever. Not sure I'm following the proper etiquette and process.
Hi, sorry for the super late response, but I'm prioritising other projects at the moment. I will try to check the PR in the following days, and align it to the current state of main