Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion: make chatgpt-shell-api-url-base customizable for each model #272

Open
djr7C4 opened this issue Dec 8, 2024 · 9 comments
Open

Comments

@djr7C4
Copy link
Contributor

djr7C4 commented Dec 8, 2024

Moving chatgpt-shell-api-url-base into the parameters for chatgpt-shell-openai-make-model would allow users to use different models that use the same API as OpenAI. This API has been adopted as a sort of psuedo standard and some other companies support it for their services.

My particular use case is that I'm interested in running llama3.3 and Qwen QwQ 32B on openrouter.ai which uses the same API as OpenAI (just with a different URL). In fact their example Python code actually uses the openai module and they don't provide their own module.

This service also supports many other models that are not yet supported by this project so this would greatly expand the range of models that users could access.

@djr7C4
Copy link
Contributor Author

djr7C4 commented Dec 8, 2024

I think the easiest way to do this would be to modify chatgpt-shell-openai-make-model to take :usr-base and :provider options that override the defaults. This seems like an easy solution.

@xenodium
Copy link
Owner

xenodium commented Dec 9, 2024

Hey, thanks for filing!

modify chatgpt-shell-openai-make-model to take :usr-base and :provider options that override the defaults. This seems like an easy solution.

Sounds good. In addition to this change, how about creating chatgpt-shell-openrouter.el and using chatgpt-shell-openai-make-model to list the models you use? We can add more over time, and/or let demand by other folks populate it.

Interested in sending a PR?

@djr7C4
Copy link
Contributor Author

djr7C4 commented Dec 9, 2024 via email

@djr7C4
Copy link
Contributor Author

djr7C4 commented Dec 9, 2024

I'm thinking the best way to do this would be to first modify chatgpt-shell-openai.el so that chatgpt-shell-openai-make-model supports the :other-params argument in chatgpt-shell-openai-make-chatgpt-request-data. This way, it will be easy to implement chatgpt-shell-openrouter-make-model as a simple wrapper whereas otherwise there will be a fair amount of duplication of the functionality in chatgpt-shell-openai.el. The other advantage of this approach is that it would make it easy for users to define models that require other (currently unanticipated parameters).

This is the page that explains the provider routing features in API that I mentioned earlier.

@xenodium
Copy link
Owner

xenodium commented Dec 9, 2024

Yup. This sounds good to me.

  1. Modify chatgpt-shell-openai-make-model to make more reusable.
  2. Reuse in new chatgpt-shell-openrouter-make-model as part of new chatgpt-shell-openrouter.el.

@djr7C4
Copy link
Contributor Author

djr7C4 commented Dec 16, 2024

This is in progress here though I haven't had a chance to finish it yet.

https://github.com/djr7C4/chatgpt-shell/tree/openrouter

@xenodium
Copy link
Owner

This is in progress here

Looking good.

though I haven't had a chance to finish it yet.

No worries. No hurry from my end.

@djr7C4
Copy link
Contributor Author

djr7C4 commented Dec 19, 2024

This is working now for llama-70b.

Interestingly, OpenRouter supports o1 (not the preview version). It doesn't currently work though because OpenRouter streams responses such as ": OPENROUTER PROCESSING\n\n" which seem to confuse chatgpt-shell-openai--filter-output. I guess this can be fixed by adding a new filter that just ignores this response.

@djr7C4
Copy link
Contributor Author

djr7C4 commented Dec 19, 2024

openai/o1 should be working now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants