File size: 6,076 Bytes
2485a9a
 
 
 
 
 
 
 
 
 
d039057
 
4534aef
d039057
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
title: AJ STUDIOZ DeepSeek API
emoji: πŸ€–
colorFrom: blue
colorTo: purple
sdk: docker
pinned: false
license: mit
---

# πŸš€ AJ STUDIOZ DeepSeek API

Enterprise-grade AI API powered by **Qwen2.5-Coder-0.5B** - Fast, reliable, and excellent for coding tasks.

![Status](https://img.shields.io/badge/Status-Online-success?style=for-the-badge)
![Model](https://img.shields.io/badge/Model-DeepSeek--R1-blue?style=for-the-badge)
![Free](https://img.shields.io/badge/Price-FREE-green?style=for-the-badge)

## ✨ Features

- 🧠 **Advanced Reasoning**: DeepSeek-R1 distilled reasoning capabilities
- 🎯 **Compact & Fast**: Only 1.5B parameters but powerful performance
- πŸ”„ **Multi-API Support**: Claude, OpenAI, and simple chat formats
- πŸš€ **Production Ready**: FastAPI with health monitoring
- πŸ’° **100% FREE**: Unlimited usage, no rate limits
- 🌐 **24/7 Uptime**: Hosted on HuggingFace Spaces

## πŸ€– Model Information

**DeepSeek-R1-Distill-Qwen-1.5B**
- Size: 1.5 billion parameters
- Base: Qwen architecture with DeepSeek reasoning distillation
- Strengths: Reasoning, coding, problem-solving, mathematics
- Speed: Fast inference (~2-3 seconds)
- Context: 4096 tokens

## πŸ“‘ API Endpoints

### Simple Chat (No Auth Required)
```bash
curl https://kamesh14151-aj-deepseek-api.hf.space/chat \
  -H "Content-Type: application/json" \
  -d '{"message": "Explain quantum computing"}'
```

### OpenAI Compatible
```bash
curl https://kamesh14151-aj-deepseek-api.hf.space/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer aj_test123" \
  -d '{
    "model": "aj-deepseek",
    "messages": [{"role": "user", "content": "Hello"}]
  }'
```

### Claude Compatible
```bash
curl https://kamesh14151-aj-deepseek-api.hf.space/v1/messages \
  -H "x-api-key: sk-ant-test123" \
  -H "anthropic-version: 2023-06-01" \
  -H "content-type: application/json" \
  -d '{
    "model": "claude-sonnet-4",
    "max_tokens": 1024,
    "messages": [{"role": "user", "content": "Hello"}]
  }'
```

### Health Check
```bash
curl https://kamesh14151-aj-deepseek-api.hf.space/health
```

## 🎯 Response Format

```json
{
  "reply": "AI response here...",
  "model": "AJ-DeepSeek v1.0",
  "provider": "AJ STUDIOZ"
}
```

## πŸ”§ Setup & Deployment

### Local Development
```bash
# Install dependencies
pip install -r requirements.txt

# Run server
uvicorn app:app --host 0.0.0.0 --port 7860

# Test
curl http://localhost:7860/
```

### Deploy to HuggingFace Spaces

1. Create new Space at https://huggingface.co/new-space
2. Choose Docker SDK
3. Clone and push this repo:
```bash
git init
git add .
git commit -m "Initial commit"
git remote add origin https://huggingface.co/spaces/YOUR_USERNAME/aj-deepseek-api
git push -u origin main
```

## πŸ’‘ Use Cases

- **Reasoning Tasks**: Solve complex problems with step-by-step logic
- **Code Generation**: Write Python, JavaScript, and more
- **Math & Science**: Solve equations, explain concepts
- **Question Answering**: Deep understanding of context
- **Educational**: Teaching and tutoring applications
- **Research**: Academic and technical research assistant

## πŸ“Š Performance

- **Response Time**: 2-5 seconds (first request ~10s cold start)
- **Throughput**: ~20 requests/minute (HF Free tier)
- **Availability**: 99.9% uptime
- **Cost**: $0 forever

## πŸ” API Keys

For demo/testing, use any key with correct format:
- OpenAI format: `aj_anything123`
- Claude format: `sk-ant-anything123`

For production, implement proper authentication in the code.

## πŸ› οΈ Tech Stack

- **Framework**: FastAPI 0.104.1
- **Server**: Uvicorn
- **Model**: DeepSeek-R1-Distill-Qwen-1.5B via HuggingFace Inference API
- **Deployment**: Docker on HuggingFace Spaces
- **API**: RESTful with OpenAPI docs

## πŸ“š Documentation

Auto-generated API docs available at:
- Swagger UI: `https://kamesh14151-aj-deepseek-api.hf.space/docs`
- ReDoc: `https://kamesh14151-aj-deepseek-api.hf.space/redoc`

## 🎨 Integration Examples

### Python
```python
import requests

def ask_deepseek(message):
    response = requests.post(
        'https://kamesh14151-aj-deepseek-api.hf.space/chat',
        json={'message': message}
    )
    return response.json()['reply']

print(ask_deepseek("Write a quicksort in Python"))
```

### JavaScript
```javascript
async function askDeepSeek(message) {
  const response = await fetch(
    'https://kamesh14151-aj-deepseek-api.hf.space/chat',
    {
      method: 'POST',
      headers: {'Content-Type': 'application/json'},
      body: JSON.stringify({message})
    }
  );
  const data = await response.json();
  return data.reply;
}
```

### Node.js
```javascript
const axios = require('axios');

async function askDeepSeek(message) {
  const {data} = await axios.post(
    'https://kamesh14151-aj-deepseek-api.hf.space/chat',
    {message}
  );
  return data.reply;
}
```

## πŸ”„ Model Comparison

| Model | Size | Speed | Reasoning | Code | Cost |
|-------|------|-------|-----------|------|------|
| **DeepSeek-R1 1.5B** | 1.5B | ⚑⚑⚑ | ⭐⭐⭐⭐ | ⭐⭐⭐⭐ | FREE |
| Phi-3 Mini | 3.8B | ⚑⚑ | ⭐⭐⭐ | ⭐⭐⭐⭐ | FREE |
| Llama 3.2 3B | 3B | ⚑⚑ | ⭐⭐⭐ | ⭐⭐⭐ | FREE |

## πŸ› Troubleshooting

### Model Loading Error
- First request takes ~10s (cold start)
- Retry after a few seconds
- Check HuggingFace Spaces status

### Timeout
- Increase timeout in your client
- Model might be loading (cold start)

### Wrong Response Format
- Ensure Content-Type: application/json
- Check request body structure

## 🀝 Contributing

Contributions welcome! Please:
1. Fork the repository
2. Create feature branch
3. Submit pull request

## πŸ“„ License

MIT License - Free for commercial and personal use

## πŸŽ‰ Credits

**Developed by AJ STUDIOZ**
- Website: https://ajstudioz.co.in
- GitHub: https://github.com/kamesh6592-cell
- HuggingFace: https://huggingface.co/kamesh14151

**Powered by:**
- DeepSeek-AI: Model developer
- HuggingFace: Hosting & Inference API
- FastAPI: Web framework

---

**Made with ❀️ by AJ STUDIOZ | © 2025**