joshpxyne / gpt-migrate

Easily migrate your codebase from one framework or language to another.
https://gpt-migrate.com
MIT License
6.85k stars 485 forks source link

Support for OpenRouter #39

Closed adrm closed 1 year ago

adrm commented 1 year ago

It would be great to use other GPT-like API endpoints like OpenRouter. For example, this would allow anyone to use gpt-4-32k even if they have no access from their OpenAI accounts, since OpenAI is no longer giving access to gpt-4-32k for the time being, and this model is basically a requisite to use gpt-migrate.

krrishdholakia commented 1 year ago

Hey @adrm gpt-migrate should already have support for this through using litellm

https://docs.litellm.ai/docs/providers/openrouter

https://github.com/joshpxyne/gpt-migrate/blob/8f6dfdd45096716aa078fcd659e50aa04b44fec7/gpt_migrate/ai.py#L23

LyleRolleman-plst commented 1 year ago

@krrishdholakia Can you give any details on how to actually do this? (that is, what command line parameters + environment variables need to be set, any code needs to be modified, if any etc.)

LyleRolleman-plst commented 1 year ago

Ok, found my problem. Turns out the version of litellm in requirements.txt does not support openrouter (too old)

pip install --upgrade litellm and it was able to recognize the openrouter model passed in (openrouter/openai/gpt-4-32k)

joshpxyne commented 1 year ago

Added OpenRouter