Skip to content

Instantly share code, notes, and snippets.

@mrdjohnson
Last active June 25, 2024 14:59
Show Gist options
  • Select an option

  • Save mrdjohnson/384a12cf8049e98a9319962288d4f34f to your computer and use it in GitHub Desktop.

Select an option

Save mrdjohnson/384a12cf8049e98a9319962288d4f34f to your computer and use it in GitHub Desktop.
Connecting to LM Studio via Open AI Api

Connecting to LM Studio via Open AI Api

Go to the server section, (button on left) change the port number or leave it as is, and click the "start server" button (you may need to turn on cors)

It should look like this:

image

assuming the port is 1234: You should be able to see the open api endpoint now: http://localhost:1234/v1/models

It should look like this:

image

you should be able to set any open ai base url to http://localhost:1234/v1 and give it a random api key (I like to use "lmstudio") and see the text generation working!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment