forked from Mirror/ollama4j
- Replaced instances of `OllamaAPI` with `Ollama` across the codebase for consistency. - Updated example code snippets in documentation to reflect the new class name. - Enhanced metrics collection setup in the documentation. - Added integration tests for the new `Ollama` class to ensure functionality remains intact.
26 lines
590 B
Markdown
26 lines
590 B
Markdown
---
|
|
sidebar_position: 4
|
|
---
|
|
|
|
# Bearer Auth
|
|
|
|
This API lets you set the bearer authentication for the Ollama client. This would help in scenarios where
|
|
Ollama server would be setup behind a gateway/reverse proxy with bearer auth.
|
|
|
|
After configuring bearer authentication, all subsequent requests will include the Bearer Auth header.
|
|
|
|
```java
|
|
import io.github.ollama4j.Ollama;
|
|
|
|
public class Main {
|
|
|
|
public static void main(String[] args) {
|
|
|
|
String host = "http://localhost:11434/";
|
|
|
|
Ollama ollama = new Ollama(host);
|
|
|
|
ollama.setBearerAuth("YOUR-TOKEN");
|
|
}
|
|
}
|
|
``` |