Spaces:
Sleeping
Sleeping
π§ͺ Simple Test Examples for AJ STUDIOZ API
β Super Simple Tests (No Auth Required)
1. Basic Chat Test
curl https://kamesh14151-aj-studioz-api.hf.space/chat \
-H "Content-Type: application/json" \
-d "{\"message\": \"Hello AJ!\"}"
2. Code Generation Test
curl https://kamesh14151-aj-studioz-api.hf.space/chat \
-H "Content-Type: application/json" \
-d "{\"message\": \"Write a Python function to reverse a string\"}"
3. Direct Generation
curl https://kamesh14151-aj-studioz-api.hf.space/api/generate \
-H "Content-Type: application/json" \
-d "{\"prompt\": \"Explain what is an API\", \"max_tokens\": 500}"
4. Health Check
curl https://kamesh14151-aj-studioz-api.hf.space/health
5. Service Info
curl https://kamesh14151-aj-studioz-api.hf.space/
π With Authentication
OpenAI Format
curl https://kamesh14151-aj-studioz-api.hf.space/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer aj_test123456" \
-d "{
\"model\": \"aj-mini\",
\"messages\": [{\"role\": \"user\", \"content\": \"Hello\"}]
}"
Anthropic Claude Format
curl https://kamesh14151-aj-studioz-api.hf.space/v1/messages \
-H "x-api-key: sk-ant-test123456" \
-H "anthropic-version: 2023-06-01" \
-H "content-type: application/json" \
-d "{
\"model\": \"claude-sonnet-4-20250514\",
\"max_tokens\": 1024,
\"messages\": [{\"role\": \"user\", \"content\": \"Hello world\"}]
}"
π» PowerShell Examples (Windows)
Simple Chat
curl.exe https://kamesh14151-aj-studioz-api.hf.space/chat `
-H "Content-Type: application/json" `
-d '{\"message\": \"Hello AJ!\"}'
Code Generation
$body = @{
message = "Write a JavaScript function to check if a number is prime"
} | ConvertTo-Json
Invoke-RestMethod -Uri "https://kamesh14151-aj-studioz-api.hf.space/chat" `
-Method Post `
-ContentType "application/json" `
-Body $body
π Python Examples
Simple Chat
import requests
response = requests.post(
"https://kamesh14151-aj-studioz-api.hf.space/chat",
json={"message": "Write a function to calculate factorial"}
)
print(response.json()["reply"])
With OpenAI SDK
from openai import OpenAI
client = OpenAI(
base_url="https://kamesh14151-aj-studioz-api.hf.space/v1",
api_key="aj_test123456"
)
response = client.chat.completions.create(
model="aj-mini",
messages=[
{"role": "user", "content": "Explain Python decorators"}
]
)
print(response.choices[0].message.content)
With Anthropic SDK
import anthropic
client = anthropic.Anthropic(
api_key="sk-ant-test123",
base_url="https://kamesh14151-aj-studioz-api.hf.space"
)
message = client.messages.create(
model="claude-sonnet-4-20250514",
max_tokens=1024,
messages=[
{"role": "user", "content": "Explain async/await"}
]
)
print(message.content[0].text)
π JavaScript/Node.js Examples
Fetch API
const response = await fetch('https://kamesh14151-aj-studioz-api.hf.space/chat', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
message: 'Write a sorting algorithm in JavaScript'
})
});
const data = await response.json();
console.log(data.reply);
Axios
const axios = require('axios');
const response = await axios.post(
'https://kamesh14151-aj-studioz-api.hf.space/chat',
{ message: 'Explain promises in JavaScript' }
);
console.log(response.data.reply);
π Expected Response Formats
Chat Endpoint Response
{
"reply": "Hello! I'm AJ, your AI assistant...",
"model": "AJ-Mini v1.0",
"provider": "AJ STUDIOZ"
}
Health Check Response
{
"status": "healthy",
"model": "aj-mini",
"provider": "huggingface"
}
OpenAI Format Response
{
"id": "chatcmpl-abc123...",
"object": "chat.completion",
"created": 1704067200,
"model": "aj-mini",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Response text here..."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 10,
"completion_tokens": 50,
"total_tokens": 60
}
}
Anthropic Format Response
{
"id": "msg_abc123...",
"type": "message",
"role": "assistant",
"content": [
{
"type": "text",
"text": "Response text here..."
}
],
"model": "claude-sonnet-4-20250514",
"stop_reason": "end_turn",
"usage": {
"input_tokens": 10,
"output_tokens": 50
}
}
π― Quick Start
Test if it's working:
curl https://kamesh14151-aj-studioz-api.hf.space/healthSend your first message:
curl https://kamesh14151-aj-studioz-api.hf.space/chat \ -H "Content-Type: application/json" \ -d '{"message": "Hello!"}'Ask for code:
curl https://kamesh14151-aj-studioz-api.hf.space/chat \ -H "Content-Type: application/json" \ -d '{"message": "Write a Python web scraper"}'
Your API is ready! π
URL: https://kamesh14151-aj-studioz-api.hf.space
Status: FREE FOREVER β’ UNLIMITED USAGE β’ NO RATE LIMITS