Using the Python OpenAI SDK with Knowmio
You can use the official OpenAI Python SDK to interact with Knowmio’s AI models through our OpenAI-compatible API endpoint.Prerequisites
- Python 3.7 or higher
- Knowmio API key (obtain from your Knowmio account)
Installation
Install the OpenAI Python SDK:Basic Usage
Configure the SDK to point to Knowmio’s API endpoint:Streaming Responses
For real-time streaming responses:Authentication
Knowmio uses API key authentication via thex-api-key header. Pass your API key in the default_headers parameter when initializing the client.
Environment Variables
For better security, store your API key in an environment variable:Available Models
Specify the model in themodel parameter:
claude-opus-4.1- Most capable model for complex tasks- Other models as configured in your Knowmio organization
API Endpoint
The Knowmio OpenAI-compatible endpoint:- Development:
https://api.dev.knowmio.com/api/openai - Production: Update the
base_urlaccordingly
Troubleshooting
401 Unauthorized Error
- Verify your API key is correct
- Ensure you’re using the
x-api-keyheader (notAuthorization) - Check that the API key has the correct permissions
Connection Errors
- Verify the
base_urlis correct - Check your network connection
- Ensure you’re not behind a proxy that blocks the connection
Model Not Found
- Verify the model name is correct
- Check that the model is available in your Knowmio organization
- Ensure your API key has access to the specified model

