Open nise opened 3 months ago
Could you document how to access Ollama API with bearer authentication using python?
Hi, thanks for your message. There's actually nothing different about accessing this compared to how you'd access Ollama. Ollama supports the OpenAI API, which makes things pretty straightforward. You can find all the details in the Ollama documentation on GitHub.
https://github.com/ollama/ollama/blob/main/docs/openai.md
All you need to do is add your API key (api_key), and you're good to go. It's a simple process that should get you up and running quickly.
Example:
client = OpenAI(
base_url='http://localhost:11434/v1/',
# add your api key
api_key='sk-ollama-xxxxxxxxxxxxxxxxxxx',
)
试了下,不设置api key 也能访问啊
Could you document how to access Ollama API with bearer authentication using python?