Python Integration
When using the official openai Python SDK, simply override the client initialization parameters.
Code Example
import openai
client = openai.OpenAI( api_key="sk-xxx...xxxx", # Enter your KoboiLLM API Key base_url="https://api.koboillm.com/v1" # Point Base URL to KoboiLLM)
response = client.chat.completions.create( model="openai/gpt-4o-mini", # Or any supported model e.g., anthropic/claude-3-5-sonnet, gemini/gemini-2.5-flash messages=[ {"role": "user", "content": "this is a test request, write a short poem"} ])
print(response.choices[0].message.content)Required Configuration
| Parameter | Value |
|---|---|
| API Key | sk-xxxx (Virtual Key from Dashboard) |
| Base URL | https://api.koboillm.com/v1 |
| Model | Any active model ID (e.g., openai/gpt-4o-mini, anthropic/claude-3-5-sonnet, gemini/gemini-2.5-flash) |
Best Practices
- Install the official library:
pip install openai - Set
api_keyvia environment variable (OPENAI_API_KEY) for better security. - Specify model names using
provider/modelformat where applicable.