helpers icon indicating copy to clipboard operation
helpers copied to clipboard

Add support for openrouter

Open gpsaggese opened this issue 7 months ago • 6 comments

In hopenai.py we want to add support for all models supported by openrouter by using the OpenAI interface

gpsaggese avatar May 15 '25 18:05 gpsaggese

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)

gpsaggese avatar May 15 '25 18:05 gpsaggese

  • [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

gpsaggese avatar May 15 '25 18:05 gpsaggese

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 avatar May 15 '25 18:05 gpsaggese

[ ] 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.

srinivassaitangudu avatar May 19 '25 15:05 srinivassaitangudu

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

gpsaggese avatar May 19 '25 21:05 gpsaggese