Add support for openrouter
In hopenai.py we want to add support for all models supported by openrouter by using the OpenAI interface
I've started the work in https://github.com/causify-ai/helpers/pull/728 but didn't finish it
The next steps are:
- [x] Generalize the code to use the openrouter interface
- [x] Generalize the price counting interface
- [ ] Finish the notebook tutorial to show how the hopenai interface works
- [ ] Write a short document explaining the design principle of hopenai.py
- [x] Compatible with the replay mechanism (there should be no change besides maybe storing the name of the model or some other metadata)
- [x] Also let's add a small script querying all the models
curl https://openrouter.ai/api/v1/models
and generating a CSV file with all the info about the models
Then we can use the code in the notebook (moved to hopenai) to extract info about the price
Pls let's do multiple PR, one per bullet point so it's easy to review. You can organize the work as you want
@gpsaggese Please review the PRs HelpersTask727_Generalise_hopenai.py_to_use_openrouter_interface HelpersTask727_Querying_openrouter_models HelpersTask727_Generalise_price_counting_interface_in_hopenai.py
[ ] Compatible with the replay mechanism (there should be no change besides maybe storing the name of the model or some other metadata)
A separate PR is not required for this. The openai.OpenAI() client returns responses in the same format as before, ensuring compatibility.
Good work. I'll show you our flow to do stacked PR on Wed.
I believe what's left is only
- [ ] Finish the notebook tutorial to show how the hopenai interface works
- [ ] Write a short document explaining the design principle of hopenai.py
Pls confirm and mark the checkboxes done