API Authentication
OpenAI Hub provides a fully compatible API with the official OpenAI interface. Simply replace the Base URL with the OpenAI Hub address to seamlessly access all officially supported models and features. All parameters, request formats, and response structures stay in sync with OpenAI.
Important Notes
- •API Keys are sensitive — never expose them in client-side code or public repositories
- •If using the official OpenAI SDK, just set the base_url / baseURL parameter to switch
- •All requests are encrypted via HTTPS for data security
- •API call rates are subject to account quotas — use them wisely
https://api.openai-hub.com/v1Key Features
- Fully compatible with the official OpenAI API format — no code changes needed
- Supports ChatGPT, GPT-4, DALL·E, Whisper, TTS, and the entire model lineup
- Also supports native-format calls for Claude, Gemini, and other third-party models
- API parameters and response structures stay in real-time sync with OpenAI
- Global acceleration nodes for low latency and high availability
Quick Start
1Get an API Key
After registering an OpenAI Hub account, create an API Key in the console. The key format is sk-xxxxxxxxxxxx — keep it safe and never share it.
2Replace the Base URL
Replace https://api.openai.com in your code with https://api.openai-hub.com/v1. No other code changes are needed.
3Set Request Headers
Add an Authorization header (Bearer sk-your-api-key) and Content-Type: application/json to every request.
4Make a Request
Use any HTTP client (curl, Python requests, Node.js fetch, etc.) to call the API — parameters are identical to OpenAI.
Code Example
from openai import OpenAI
client = OpenAI(
api_key="sk-your-hub-api-key",
base_url="https://api.openai-hub.com/v1" # Only change this line
)
response = client.chat.completions.create(
model="gpt-4o",
messages=[
{"role": "user", "content": "Hello!"}
]
)
print(response.choices[0].message.content)