Spaces:
Sleeping
Sleeping
File size: 6,348 Bytes
7603b27 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 | # AJ STUDIOZ API - Quick Start Guide
## π OpenAI-Compatible API with `aj_` Keys
AJ STUDIOZ API is enterprise-grade AI with Claude-like thoughtfulness and full OpenAI compatibility.
### Base URL
```
Production: https://api.ajstudioz.co.in
Development: https://kamesh14151-aj-studioz-api.hf.space
```
### Authentication
All API requests require an API key starting with `aj_`:
```bash
Authorization: Bearer aj_your_api_key_here
```
---
## π Available Endpoints
### 1. Chat Completions (OpenAI-compatible)
```bash
POST /v1/chat/completions
```
**Example Request:**
```bash
curl -X POST "https://kamesh14151-aj-studioz-api.hf.space/v1/chat/completions" \
-H "Authorization: Bearer aj_test_key_123456789" \
-H "Content-Type: application/json" \
-d '{
"model": "aj-mini",
"messages": [
{"role": "system", "content": "You are a helpful AI assistant."},
{"role": "user", "content": "Explain quantum computing in simple terms."}
],
"max_tokens": 500,
"temperature": 0.3
}'
```
**Example Response:**
```json
{
"id": "chatcmpl-abc123def456",
"object": "chat.completion",
"created": 1730505600,
"model": "aj-mini",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Quantum computing is a revolutionary approach to computation..."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 25,
"completion_tokens": 150,
"total_tokens": 175
}
}
```
### 2. Text Completions
```bash
POST /v1/completions
```
**Example:**
```bash
curl -X POST "https://kamesh14151-aj-studioz-api.hf.space/v1/completions" \
-H "Authorization: Bearer aj_test_key_123456789" \
-H "Content-Type: application/json" \
-d '{
"model": "aj-mini",
"prompt": "Write a Python function to calculate fibonacci:",
"max_tokens": 300,
"temperature": 0.3
}'
```
### 3. List Models
```bash
GET /v1/models
```
**Example:**
```bash
curl "https://kamesh14151-aj-studioz-api.hf.space/v1/models" \
-H "Authorization: Bearer aj_test_key_123456789"
```
---
## π Python SDK Examples
### Using OpenAI Python Library
```python
from openai import OpenAI
# Initialize client with AJ STUDIOZ API
client = OpenAI(
api_key="aj_test_key_123456789",
base_url="https://kamesh14151-aj-studioz-api.hf.space/v1"
)
# Chat completion
response = client.chat.completions.create(
model="aj-mini",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "What is machine learning?"}
],
max_tokens=500,
temperature=0.3
)
print(response.choices[0].message.content)
```
### Using Requests
```python
import requests
headers = {
"Authorization": "Bearer aj_test_key_123456789",
"Content-Type": "application/json"
}
data = {
"model": "aj-mini",
"messages": [
{"role": "user", "content": "Explain neural networks"}
],
"max_tokens": 500
}
response = requests.post(
"https://kamesh14151-aj-studioz-api.hf.space/v1/chat/completions",
headers=headers,
json=data
)
print(response.json()["choices"][0]["message"]["content"])
```
---
## π JavaScript/Node.js Examples
### Using OpenAI Node SDK
```javascript
import OpenAI from 'openai';
const client = new OpenAI({
apiKey: 'aj_test_key_123456789',
baseURL: 'https://kamesh14151-aj-studioz-api.hf.space/v1'
});
async function chat() {
const response = await client.chat.completions.create({
model: 'aj-mini',
messages: [
{ role: 'user', content: 'Tell me about AI safety' }
],
max_tokens: 500,
temperature: 0.3
});
console.log(response.choices[0].message.content);
}
chat();
```
### Using Fetch
```javascript
const response = await fetch('https://kamesh14151-aj-studioz-api.hf.space/v1/chat/completions', {
method: 'POST',
headers: {
'Authorization': 'Bearer aj_test_key_123456789',
'Content-Type': 'application/json'
},
body: JSON.stringify({
model: 'aj-mini',
messages: [
{ role: 'user', content: 'Explain transformers' }
]
})
});
const data = await response.json();
console.log(data.choices[0].message.content);
```
---
## π API Key Format
All API keys must follow this format:
```
aj_<your_unique_key>
```
**Examples of valid keys:**
- `aj_test_key_123456789`
- `aj_prod_a1b2c3d4e5f6`
- `aj_dev_mycompany_2024`
**Invalid keys will return:**
```json
{
"error": {
"message": "Invalid API key. Your API key should start with 'aj_'",
"type": "invalid_request_error",
"code": "invalid_api_key"
}
}
```
---
## π Response Format
All responses follow OpenAI's format for seamless integration:
**Success Response:**
```json
{
"id": "chatcmpl-...",
"object": "chat.completion",
"created": 1730505600,
"model": "aj-mini",
"choices": [...],
"usage": {
"prompt_tokens": 50,
"completion_tokens": 100,
"total_tokens": 150
}
}
```
**Error Response:**
```json
{
"error": {
"message": "Error description",
"type": "error_type",
"code": "error_code"
}
}
```
---
## π― Model Parameters
| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `model` | string | `"aj-mini"` | Model to use |
| `messages` | array | required | Chat messages |
| `max_tokens` | integer | `2000` | Max completion length |
| `temperature` | float | `0.3` | Sampling temperature (0-2) |
| `stream` | boolean | `false` | Stream responses |
---
## π’ Enterprise Features
β
**OpenAI-Compatible** - Drop-in replacement for OpenAI API
β
**Claude-like Responses** - Thoughtful, well-structured answers
β
**Secure Authentication** - API key validation with `aj_` prefix
β
**Rate Limiting** - Production-ready throttling (coming soon)
β
**Usage Analytics** - Track API consumption (coming soon)
β
**Custom Domain** - api.ajstudioz.co.in (coming soon)
---
## π Support
- **Website:** https://ajstudioz.co.in
- **Documentation:** https://docs.ajstudioz.co.in (coming soon)
- **API Status:** https://status.ajstudioz.co.in (coming soon)
---
## π Rate Limits (Coming Soon)
| Tier | Requests/min | Tokens/day |
|------|--------------|------------|
| Free | 60 | 50,000 |
| Pro | 600 | 1,000,000 |
| Enterprise | Custom | Custom |
---
**Made with β€οΈ by AJ STUDIOZ**
|