Ollama now offers built-in compatibility with the OpenAI Chat Completion API, allowing users to utilize additional tools and applications with Ollama locally. To get started, download Ollama and pull a model like Llama 2 or Mistral. To invoke Ollama’s OpenAI compatible API endpoint, use cURL or the OpenAI Python or JavaScript library, making sure to specify the desired model and provide the appropriate messages. Examples of using Ollama with the Vercel AI SDK and Autogen are also provided. It’s important to note that this is experimental support for the OpenAI API, with potential future improvements such as embeddings API, function calling, and vision support. For more information, refer to the OpenAI compatibility documentation.
https://ollama.ai/blog/openai-compatibility