Getting Started
Quick Start
Get up and running with the CatLove AI API in just a few minutes.
Step 1: Get Your API Key
First, you need to create an API key to authenticate your requests.
- Sign in to your dashboard
- Navigate to API Keys in the sidebar
- Click "Create new secret key"
- Copy and save your API key securely
Important
Your API key is only shown once when created. Store it securely - you won't be able to view it again.
Step 2: Install the SDK
Our API is fully compatible with the OpenAI SDK. Install it using your preferred package manager:
pip install openaiStep 3: Set Your Environment Variable
Set your API key as an environment variable to keep it secure:
export CATLOVE_API_KEY="sk-your-api-key-here"Step 4: Make Your First Request
Now you're ready to make your first API call! Here's a simple chat completion example:
curl https://api.catlove.cc/v1/chat/completions \
-H "Authorization: Bearer $CATLOVE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o-mini",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello! What can you help me with?"}
]
}'Expected Response
If everything is set up correctly, you'll receive a response like this:
{
"id": "chatcmpl-abc123",
"object": "chat.completion",
"created": 1705368400,
"model": "gpt-4o-mini",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello! I'm an AI assistant powered by CatLove. I can help you with a variety of tasks such as answering questions, writing content, coding, analysis, and much more. What would you like help with today?"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 25,
"completion_tokens": 42,
"total_tokens": 67
}
}Next Steps
Congratulations! You've made your first API call. Here's what to explore next: