Getting Started
Welcome to the Serika.dev API! This guide will help you make your first API request in minutes.
1. Get Your API Key
First, you need an API key.
Log in to your Serika.dev Developer Dashboard.
Navigate to the API Keys section.
Click Create New Key and copy it.
2. Install the OpenAI Library
Serika.dev is compatible with the standard OpenAI client libraries, making integration effortless.
pip install openai
npm install openai
3. Make Your First Request
Create a file named test_api.py (or test_api.js) and add the following code.
from openai import OpenAI
# Initialize the client with Serika's base URL
client = OpenAI(
base_url="https://api.serika.dev/api/openai/v1",
api_key="your_api_key"
)
# Create a chat completion
response = client.chat.completions.create(
model="openai/gpt-4o-mini",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "What is the capital of France?"}
]
)
print(response.choices[0].message.content)
import OpenAI from 'openai';
const client = new OpenAI({
baseURL: 'https://api.serika.dev/api/openai/v1',
apiKey: 'your_api_key',
});
async function main() {
const chatCompletion = await client.chat.completions.create({
messages: [{ role: 'user', content: 'What is the capital of France?' }],
model: 'openai/gpt-4o-mini',
});
console.log(chatCompletion.choices[0].message.content);
}
main();
curl https://api.serika.dev/api/openai/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your_api_key" \
-d '{
"model": "openai/gpt-4o-mini",
"messages": [{"role": "user", "content": "What is the capital of France?"}]
}'
Next Steps
Explore Chat Completions to build conversational apps.
Check out Image Generation to create art.
See the Examples page for more code snippets.