wkok / openai-clojure

Clojure functions to drive the OpenAI API
https://cljdoc.org/d/net.clojars.wkok/openai-clojure
MIT License
208 stars 28 forks source link

Added ability to override the OpenAI API endpoint #32

Closed wkok closed 1 year ago

wkok commented 1 year ago

Discussion refers: https://clojurians.slack.com/archives/C054XC5JVDZ/p1693981662110889

Sometimes it might be needed to override the :api-endpoint for the OpenAI API

This PR allows that by either specifying it in the options map for each api call:

(create-completion {:model "text-davinci-003"
                    :prompt "Say this is a test"}
                   {:api-endpoint "https://my-new-endpoint.com"})

or once off as an environment variable:

export OPENAI_API_ENDPOINT="https://my-new-endpoint.com"