AI Endpoints
QsnDEX integrates AI-powered analytics across multiple endpoints. These features leverage Groq-hosted LLMs (Llama 3.3 70B, Llama 3.1 8B, DeepSeek R1 70B) to provide real-time insights on tokens, pools, and trading conditions.
AI Chat
POST /api/ai/chat
Multi-turn conversational AI assistant with context about DeFi, QsnDEX features, and on-chain data.
Request Body:
{
"messages": [
{ "role": "user", "content": "What is impermanent loss?" },
{ "role": "assistant", "content": "Impermanent loss occurs when..." },
{ "role": "user", "content": "How can I minimize it?" }
],
"language": "en"
}
Response:
{
"success": true,
"data": {
"response": "To minimize impermanent loss, you can...",
"model": "llama-3.3-70b-versatile"
}
}
Token Analysis
POST /api/ai/analyze/token
Deep AI-driven analysis of a token, including on-chain metrics, risk factors, and market outlook.
Request Body:
{
"token_address": "0x...",
"chain_id": 167000
}
Pool Analysis
POST /api/ai/analyze/pool
AI analysis of a liquidity pool with yield projections, risk assessment, and optimization suggestions.
Request Body:
{
"pool_address": "0x...",
"chain_id": 167000
}
Swap Insight
POST /api/ai/swap-insight
Sentiment and market analysis for a specific swap pair.
Request Body:
{
"token_in": "0x...",
"token_out": "0x...",
"chain_id": 167000
}
Anti-Rug Shield
GET /api/safety/{token}
Performs 8 on-chain safety checks on a token and returns a composite safety score.
Path Parameters:
| Parameter | Type | Description |
|---|---|---|
token | string | Token contract address |
Query Parameters:
| Parameter | Type | Description |
|---|---|---|
chain_id | integer | Target chain ID |
Response:
{
"success": true,
"data": {
"token": "0x...",
"score": 8,
"max_score": 10,
"checks": {
"ownership_renounced": true,
"mint_disabled": true,
"liquidity_locked": true,
"honeypot_check": false,
"proxy_contract": false,
"high_tax": false,
"verified_source": true,
"sufficient_liquidity": true
},
"risk_level": "LOW"
}
}
Safety Checks
| Check | Description |
|---|---|
ownership_renounced | Contract ownership has been renounced |
mint_disabled | No minting function or minting is disabled |
liquidity_locked | LP tokens are locked in a timelock contract |
honeypot_check | Token can be freely bought and sold |
proxy_contract | Whether the token uses an upgradeable proxy |
high_tax | Transfer tax exceeds acceptable threshold |
verified_source | Source code is verified on the block explorer |
sufficient_liquidity | Pool has adequate liquidity depth |
Smart Entry Signal
GET /api/entry-signal/{token}
Technical analysis signal for a token, combining RSI, momentum, and trend indicators.
Path Parameters:
| Parameter | Type | Description |
|---|---|---|
token | string | Token contract address |
Query Parameters:
| Parameter | Type | Description |
|---|---|---|
chain_id | integer | Target chain ID |
Response:
{
"success": true,
"data": {
"token": "0x...",
"signal": "BUY",
"confidence": 0.78,
"rsi": 32.5,
"momentum": "bullish",
"trend": "upward",
"summary": "RSI indicates oversold conditions with improving momentum."
}
}
Autopilot
GET /api/autopilot/{wallet}
Analyzes a wallet's portfolio health and generates actionable suggestions for optimization.
Path Parameters:
| Parameter | Type | Description |
|---|---|---|
wallet | string | User wallet address |
Query Parameters:
| Parameter | Type | Description |
|---|---|---|
chain_id | integer | Target chain ID |
Response:
{
"success": true,
"data": {
"wallet": "0x...",
"health_score": 72,
"risk_level": "MODERATE",
"suggestions": [
"Consider diversifying: 85% of portfolio is in a single asset.",
"WETH/USDC pool has higher APR than your current LP position.",
"Token XYZ has a low safety score (3/10). Review your holding."
]
}
}
Rate Limits
All AI endpoints are rate-limited per wallet or IP address using Redis:
| Endpoint | Rate Limit |
|---|---|
POST /api/ai/chat | 10 requests per hour |
POST /api/ai/analyze/token | 10 requests per hour |
POST /api/ai/analyze/pool | 10 requests per hour |
POST /api/ai/swap-insight | 10 requests per hour |
GET /api/safety/{token} | 20 requests per hour |
GET /api/entry-signal/{token} | 20 requests per hour |
GET /api/autopilot/{wallet} | 5 requests per hour |
Exceeding the limit returns HTTP 429 with a Retry-After header indicating when the next request can be made.