Obiguard SDK Integration with LocalAI
1. Install the Obiguard SDK
- Python SDK
2. Initialize Obiguard with LocalAI URL
First, ensure that your API is externally accessible. If you’re running the API onhttp://localhost, consider using a tool like ngrok to create a public URL. Then, instantiate the Obiguard client by adding your LocalAI URL (along with the version identifier) to the customHost property, and add the provider name as openai.
Note: Don’t forget to include the version identifier (e.g.,
/v1) in the customHost URL- Python SDK
Obiguard currently supports all endpoints that adhere to the OpenAI specification.
This means, you can access and observe any of your LocalAI models that are exposed through OpenAI-compliant routes.
3. Invoke Chat Completions
Use the Obiguard SDK to invoke chat completions from your LocalAI model, just as you would with any other provider.- Python SDK
Using Provider Credentials and Access Keys
Obiguard stores the credentials for your provider in its vault as a provider credential, and your application authenticates to the gateway with an access key. This simplifies the use of multiple providers and Obiguard features within your application. For self-hosted LLMs, you can configure custom authentication requirements including authorization keys, bearer tokens, or any other headers needed to access your model.- Add your self-hosted model to Obiguard as a provider credential
- Configure your deployment:
- Select the matching provider API specification (typically
OpenAI) - Enter your model’s base URL as the custom host
- Add required authentication headers and their values
- Select the matching provider API specification (typically
- Create an access key for the agent or project that will call it
- Python SDK

