Back to Documentation
API Reference
Complete API documentation for developers
Base URL
https://api.cozhub.aiAuthentication
All API requests require authentication using your API key in the Authorization header.
curl https://api.cozhub.ai/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek-ai/DeepSeek-V3.2",
"messages": [{"role": "user", "content": "Hello!"}]
}'Endpoints
POST
/v1/chat/completionsChat Completions
Generate conversational responses using chat models
POST
/v1/embeddingsEmbeddings
Create vector embeddings for text
POST
/v1/images/generationsImage Generation
Generate images from text prompts
POST
/v1/audio/transcriptionsAudio
Speech-to-text and text-to-speech
Example: Chat Completions
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| model | string | Yes | Model ID (e.g., deepseek-ai/DeepSeek-V3.2) |
| messages | array | Yes | Array of message objects with role and content |
| temperature | number | No | Sampling temperature (0-2), default 1 |
| max_tokens | integer | No | Maximum tokens to generate |
| stream | boolean | No | Enable streaming response, default false |
Response
{
"id": "chatcmpl-abc123",
"object": "chat.completion",
"created": 1705636520,
"model": "deepseek-ai/DeepSeek-V3.2",
"choices": [{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello! How can I help you today?"
},
"finish_reason": "stop"
}],
"usage": {
"prompt_tokens": 9,
"completion_tokens": 12,
"total_tokens": 21
}
}Rate Limits
API requests are rate limited based on your account tier. If you exceed the limit, you'll receive a 429 error.
| Tier | Requests/min | Tokens/min |
|---|---|---|
| Free | 20 | 40,000 |
| Starter | 60 | 150,000 |
| Pro | 300 | 1,000,000 |
Error Handling
The API uses standard HTTP response codes to indicate success or failure.
| Code | Description |
|---|---|
| 200 | Success |
| 400 | Bad request - Invalid parameters |
| 401 | Unauthorized - Invalid API key |
| 429 | Rate limit exceeded |
| 500 | Internal server error |
SDKs & Libraries
COZHUB API is compatible with the OpenAI SDK. Just change the base URL to use our API.
Python
pip install openaiNode.js
npm install openai