As shown in the previous lectures, you can directly access locally running LLMs (when using LM Studio) by leveraging the LM Studio API - either the custom one or the OpenAI-compatible one.

Alternatively, if you don't want to send HTTP requests from scratch (or use the OpenAI SDK), you can also use the official LM Studio SDKs for Python and JavaScript: