0xacx / chatGPT-shell-cli

Simple shell script to use OpenAI's ChatGPT and DALL-E from the terminal. No Python or JS required.
https://gptshell.cc
MIT License
1.05k stars 151 forks source link

Add a new parameter to support change API address #89

Closed jonrzhang closed 6 months ago

jonrzhang commented 1 year ago

Since the OpenAI can be run on Azure, and for further API may replace by other self proxy use. I suggest replacing the fixed API address with defined a variable.

And I try to add a new parameter to specify the API address in case needs to be replaced.

0xacx commented 1 year ago

Hi @jonrzhang Thank you for contributing! I went through the Azure OpenAI docs and I see that changing the address would require a little more than changing the base url. To be specific the url for a request to Azure OpenAI is

https://YOUR_RESOURCE_NAME.openai.azure.com/openai/deployments/YOUR_DEPLOYMENT_NAME/completions?api-version=2022-12-01\

You can see the example request in the middle of the page.

YOUR_RESOURCE_NAME, YOUR_DEPLOYMENT_NAME and the api version date being variables the user would have to provide.

The way I would implement this is have these YOUR_RESOURCE_NAME, YOUR_DEPLOYMENT_NAME as variables that the user should provide as arguments when starting the script. If the user provides a value for these, then the azure url is build and set as the url value instead of the OpenAI default. Is this something you are willing to explore?