Closed zheroz00 closed 2 months ago
Openrouter has an OpenAI compatible API so it should be fairly easy to make it work.
Go to line 7 in openai_api.py and replace
self.client = OpenAI(api_key=os.getenv('OPENAI_API_KEY'))
with
self.client = OpenAI(base_url="https://openrouter.ai/api/v1", api_key=os.getenv("OPENROUTER_API_KEY"))
This assumes that you have your openrouter API key set as this environment variable: OPENROUTER_API_KEY
. Adjust this according to how you want to pass the API key.
Now set up your model name in config and you should be good to go.
self.client = OpenAI(base_url="https://openrouter.ai/api/v1", api_key=os.getenv("OPENROUTER_API_KEY"))
This worked perfectly. Thank you. I don't suppose you know if you can enable internet access somehow, can you?
If by internet access you mean giving internet access to the LLM so that it could search the web for additional context, that would require integrating some additional components into the pipeline, such as a search engine API and a web scraper. Then it would be possible to add top search results page content to the prompt and ask the LLM to present them. Definitely possible but would require some work.
Gotcha. Thanks for the info.
I'm thinking I could add the perplexity api, they have models that can search the web and it's super fast!
Hey. I'm really loving this. I commented on your reddit post as well. Does openrouter work with this? If not do you have support planned?