Base URL
https://your-domain.com/api/v1Authentication
Bearer YOUR_API_KEYContent-Type
application/jsonAvailable Models
gemini-2.5-flashFast & efficient
gemini-2.0-flashBalanced performance
gpt-4o-miniOpenAI compatible
Request Parameters
messagesarrayRequired
Array of message objects with role and content
modelstringOptional
Model to use (default: gemini-2.5-flash)
streambooleanOptional
Enable streaming response (default: false)
temperaturenumberOptional
Sampling temperature 0-2 (default: 1)
max_tokensnumberOptional
Maximum tokens in response (default: 4096)
Code Examples
cURL
# Basic Chat Completion
curl -X POST https://your-domain.com/api/v1/chat \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello, how are you?"}
],
"model": "gemini-2.5-flash"
}'
# With Streaming
curl -X POST https://your-domain.com/api/v1/chat \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"messages": [{"role": "user", "content": "Write a poem about coding"}],
"model": "gemini-2.5-flash",
"stream": true
}'OpenAI SDK Compatible
Our API is fully compatible with the official OpenAI SDKs. Simply change the base_url (Python) or baseURL (Node.js) to point to our API endpoint, and use your API key. This means you can use all the features of the OpenAI SDK including streaming, function calling, and more!
pip install openainpm install openaiResponse Format
{
"id": "chatcmpl-abc123",
"object": "chat.completion",
"created": 1704067200,
"model": "gemini-2.5-flash",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello! How can I help you today?"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 10,
"completion_tokens": 20,
"total_tokens": 30
}
}Error Codes
400
Bad Request
Invalid request parameters
401
Unauthorized
Invalid or missing API key
429
Rate Limited
API limit exceeded, upgrade your plan
500
Server Error
Internal server error, try again later