ThioJoe / Full-Stack-AI-Meme-Generator

Uses Various AI Service APIs to generate memes with text and images
GNU General Public License v3.0
273 stars 26 forks source link

Different API base support #12

Open Lachine1 opened 1 year ago

Lachine1 commented 1 year ago

for openai btw

ThioJoe commented 1 year ago

I don't undestand

Lachine1 commented 1 year ago

I don't undestand

import openai
openai.api_base = "https://example.api.com/"
ThioJoe commented 1 year ago

I see, I'll look into adding that

NavaShield commented 1 year ago

agreed, there are openai alternatives which use the same url structure as openai so there could be a commented out setting in the settings.ini file to enable a custom base url.

# Allows use of custom base urls.
# BaseURL = https://api.openai.com/v1

or something like that

ThioJoe commented 1 year ago

Just so you know though, the script uses the OpenAI python package, not URL endpoints directly. So might not be possible in the current state if the goal is to use a different service altogether.

Should work if just changing the url base to use an api gateway or something.

Lachine1 commented 1 year ago

you should use dall-e for image gen too

NavaShield commented 1 year ago

Just so you know though, the script uses the OpenAI python package, not URL endpoints directly. So might not be possible in the current state if the goal is to use a different service altogether.

import openai

openai.api_key = 'catto_key_************************'
openai.api_base = 'https://api.cattto.repl.co/v1'

(code stolen from a chatgpt alternative but yeah)