OpenAI Compatible
Quickstart
Start building with aihubspot in under a minute using the OpenAI SDK.
How it works
aihubspot exposes an OpenAI-compatible endpoint. You use the exact same OpenAI SDK you already know — just point base_url / baseURL at https://api.aihubspot.app/v1 and use your aihubspot API key.
No new SDK to install. No new API to learn.
Your first request
from openai import OpenAI
client = OpenAI(
api_key="AH_SMKRPA_YOUR_KEY", # your aihubspot key
base_url="https://api.aihubspot.app/v1",
)
response = client.chat.completions.create(
model="gpt-4o",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello!"},
],
)
print(response.choices[0].message.content)import OpenAI from 'openai';
const client = new OpenAI({
apiKey: process.env.AH_API_KEY, // your aihubspot key
baseURL: 'https://api.aihubspot.app/v1',
});
const response = await client.chat.completions.create({
model: 'gpt-4o',
messages: [
{ role: 'system', content: 'You are a helpful assistant.' },
{ role: 'user', content: 'Hello!' },
],
});
console.log(response.choices[0].message.content);curl https://api.aihubspot.app/v1/chat/completions \
-H "Authorization: Bearer $AH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o",
"messages": [
{"role": "user", "content": "Hello!"}
]
}'Already using the OpenAI SDK? It's a two-line change: add base_url and swap the key. That's it.
Prerequisites
- An aihubspot account (sign up here)
- An API key from the API Console
openaiPython package or npm package installed
Authentication
All requests use Bearer token auth:
Authorization: Bearer AH_SMKRPA_YOUR_KEY_HERE
Never commit your API key to source control. Use environment variables or a secrets manager.
Available models
| Model ID | Provider | Context |
|---|---|---|
gpt-4o | OpenAI | 128k |
claude-3-5-sonnet | Anthropic | 200k |
llama-3-70b | Meta | 32k |
See the full Models page for all available models and BDT pricing.