Stack 3.0 API
Build AI-powered applications with Stack 3.0. OpenAI-compatible endpoint, 1,000 free requests/day, zero setup required.
Quickstart
1. Get an API Key
Sign up at stack-ai.me/signup, then go to API Keys to generate your key.
2. Make Your First Request
curl https://www.stack-ai.me/api/v1/chat \
-H "Authorization: Bearer sk_stk_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"messages": [
{"role": "user", "content": "Hello, who are you?"}
]
}'3. That's It!
The API responds instantly using Groq's infrastructure — no server setup, no GPU costs.
Authentication
All API requests require your secret key in the Authorization header.
Authorization: Bearer sk_stk_your_api_key_here⚠️ Keep your key secret: Do not share your API key in public repositories, client-side code, or screenshots. If compromised, revoke it immediately from your dashboard.
Chat Completions
OpenAI-compatible chat endpoint. Send a conversation and receive an AI response.
/api/v1/chatRequest Body
| Parameter | Type | Description |
|---|---|---|
messages* | array | Array of message objects with role and content |
messages[].role* | string | "system", "user", or "assistant" |
messages[].content* | string | The message text |
model | string | Model to use (defaults to llama-3.1-8b-instant) |
Example Request
const response = await fetch('https://www.stack-ai.me/api/v1/chat', {
method: 'POST',
headers: {
'Authorization': 'Bearer sk_stk_your_api_key_here',
'Content-Type': 'application/json',
},
body: JSON.stringify({
messages: [
{ role: 'system', content: 'You are a helpful coding assistant.' },
{ role: 'user', content: 'Write a Python function to fibonacci.' }
]
})
});
const data = await response.json();
console.log(data.choices[0].message.content);Response
{
"id": "chatcmpl_1713542400",
"object": "chat.completion",
"created": 1713542400,
"model": "llama-3.1-8b-instant",
"choices": [{
"index": 0,
"message": {
"role": "assistant",
"content": "Here is a Python fibonacci function..."
},
"finish_reason": "stop"
}],
"usage": {
"prompt_tokens": 42,
"completion_tokens": 128,
"total_tokens": 170
}
}Rate Limits
Rate limits are per API key. Upgrade to Pro for higher limits (coming soon).
Error Codes
authentication_errorMissing or invalid API key
rate_limit_exceededDaily request limit reached
invalid_request_errorMalformed request body
internal_errorServer error — try again
Python Example
import requests
API_KEY = "sk_stk_your_api_key_here"
BASE_URL = "https://www.stack-ai.me/api/v1"
headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json",
}
response = requests.post(
f"{BASE_URL}/chat",
headers=headers,
json={
"messages": [
{"role": "user", "content": "Explain async/await in JavaScript"}
]
}
)
data = response.json()
print(data["choices"][0]["message"]["content"])