Get Started in 5 Minutes
Follow these three steps to start making API requests through API Key Hub. No new libraries required -- use the standard OpenAI SDK you already know.
Sign Up and Get Your API Key
- Create an account on API Key Hub (you get $2.00 in free credits).
- Go to your Dashboard → API Keys page.
- Click "Create Key" and choose a plan that fits your needs.
- Copy your API key immediately -- it is shown only once. It starts with
sk-.
Important: Store your API key securely. Do not commit it to version control or expose it in client-side code. Use environment variables instead.
Install the SDK
API Key Hub is fully compatible with the official OpenAI SDK. Install it for your language of choice:
pip install openaiSet your API key as an environment variable:
export APIKEYHUB_API_KEY="sk-your-api-key"Make Your First Request
The only difference from using OpenAI directly is the base_url. Everything else stays exactly the same:
from openai import OpenAI
client = OpenAI(
base_url="https://xylove.net/v1",
api_key="sk-your-api-key"
)
response = client.chat.completions.create(
model="gpt-4o",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello! What can you do?"}
],
temperature=0.7,
max_tokens=256
)
print(response.choices[0].message.content)Streaming Responses
Streaming is fully supported. Add stream=True to get tokens as they are generated:
from openai import OpenAI
client = OpenAI(
base_url="https://xylove.net/v1",
api_key="sk-your-api-key"
)
stream = client.chat.completions.create(
model="claude-sonnet-4-6",
messages=[{"role": "user", "content": "Write a haiku about coding"}],
stream=True
)
for chunk in stream:
content = chunk.choices[0].delta.content
if content:
print(content, end="", flush=True)Available Models
You can use any model available on API Key Hub. Popular options include:
| Model | Provider | Best For |
|---|---|---|
| gpt-4o | OpenAI | General purpose, fast |
| gpt-4o-mini | OpenAI | Cost-effective tasks |
| claude-sonnet-4-6 | Anthropic | Coding, analysis |
| gemini-2.5-pro | Long context, multimodal | |
| deepseek-chat | DeepSeek | Budget-friendly reasoning |
See the full list by calling the GET /v1/models endpoint or visiting our pricing page.
Next Steps
- API Reference -- Explore all available endpoints and parameters.
- Error Handling -- Learn how to handle errors and rate limits gracefully.
- Migration Guide -- Moving from OpenAI or Anthropic direct APIs? Follow our migration guide.
- API Playground -- Try the API interactively from your browser.