API Usage
Nex-T1 provides a comprehensive REST API with WebSocket support for real-time operations. All endpoints are documented with OpenAPI/Swagger specifications and include SDKs for Python and TypeScript.
Quick Start
Authenticate
Login to get a JWT access token for secure API access
Create Session
Create a chat session to maintain conversation context
Make Your First Call
curl -X POST https://api.nex-t1.ai/api/v1/chatbot/chat \
-H "Authorization: Bearer SESSION_TOKEN" \
-H "Content-Type: application/json" \
-d '{"messages":[{"role":"user","content":"What is the current ETH price?"}]}'
Base URLs
Authentication
Authentication Flow
Nex-T1 uses a two-tier authentication system:
User Authentication : JWT tokens for user login
Session Authentication : Session-scoped tokens for chat interactions
Step 1: Register (Optional)
Register a new user account:
curl -X POST "https://api.nex-t1.ai/api/v1/auth/register" \
-H "Content-Type: application/json" \
-d '{
"email": "[email protected] ",
"password": "SecurePass123!"
}'
Response :
{
"id" : 123 ,
"email" : "[email protected] " ,
"token" : {
"access_token" : "eyJhbGciOiJIUzI1NiIs..." ,
"token_type" : "bearer" ,
"expires_at" : "2025-10-04T12:00:00Z"
}
}
Step 2: Login
Authenticate with your credentials to get an access token:
ACCESS_TOKEN = $( curl -sS -X POST "https://api.nex-t1.ai/api/v1/auth/login" \
-H "Content-Type: application/x-www-form-urlencoded" \
--data-urlencode "[email protected] " \
--data-urlencode "password=SecurePass123!" \
--data-urlencode "grant_type=password" | jq -r .access_token )
echo $ACCESS_TOKEN
Response :
{
"access_token" : "eyJhbGciOiJIUzI1NiIs..." ,
"token_type" : "bearer" ,
"expires_at" : "2025-10-04T12:00:00Z"
}
Step 3: Create Chat Session
Create a session to maintain conversation context:
SESSION_JSON = $( curl -sS -X POST "https://api.nex-t1.ai/api/v1/auth/session" \
-H "Authorization: Bearer $ACCESS_TOKEN " )
SESSION_ID = $( echo " $SESSION_JSON " | jq -r .session_id )
SESSION_TOKEN = $( echo " $SESSION_JSON " | jq -r .token.access_token )
echo "Session ID: $SESSION_ID "
echo "Session Token: $SESSION_TOKEN "
Response :
{
"session_id" : "sess_abc123xyz" ,
"name" : "" ,
"token" : {
"access_token" : "eyJhbGciOiJIUzI1NiIs..." ,
"token_type" : "bearer" ,
"expires_at" : "2025-10-04T13:00:00Z"
}
}
Use the session_token (not the access_token) for all chat and multi-agent endpoints. The session token binds messages to a specific conversation context.
Session Management
curl -X GET "https://api.nex-t1.ai/api/v1/auth/sessions" \
-H "Authorization: Bearer $ACCESS_TOKEN "
Response :[
{
"session_id" : "sess_abc123" ,
"name" : "ETH Trading Discussion" ,
"token" : {
"access_token" : "eyJ..." ,
"token_type" : "bearer" ,
"expires_at" : "2025-10-04T13:00:00Z"
}
}
]
curl -X PATCH "https://api.nex-t1.ai/api/v1/auth/session/ $SESSION_ID /name" \
-H "Authorization: Bearer $SESSION_TOKEN " \
-H "Content-Type: application/x-www-form-urlencoded" \
--data-urlencode "name=ETH Trading Discussion"
curl -X DELETE "https://api.nex-t1.ai/api/v1/auth/session/ $SESSION_ID " \
-H "Authorization: Bearer $SESSION_TOKEN "
Core Endpoints
Chat API
The main conversational interface powered by LangGraph for natural language interactions.
Non-Streaming Chat
curl -X POST "https://api.nex-t1.ai/api/v1/chatbot/chat" \
-H "Authorization: Bearer $SESSION_TOKEN " \
-H "Content-Type: application/json" \
-d '{
"messages": [
{
"role": "user",
"content": "Give me a quick BTC update."
}
]
}'
Request Schema :
{
"messages" : [
{
"role" : "user | assistant | system" ,
"content" : "string (1-3000 chars)"
}
]
}
Response :
{
"messages" : [
{
"role" : "user" ,
"content" : "Give me a quick BTC update."
},
{
"role" : "assistant" ,
"content" : "Bitcoin (BTC) is currently trading at $67,342..."
}
]
}
Streaming Chat (Server-Sent Events)
Get real-time streaming responses for better user experience:
cURL (POST)
Python
JavaScript (EventSource)
curl -N -X POST "https://api.nex-t1.ai/api/v1/chatbot/chat/stream" \
-H "Authorization: Bearer $SESSION_TOKEN " \
-H "Content-Type: application/json" \
-d '{
"messages": [
{
"role": "user",
"content": "Two-sentence market recap."
}
]
}'
Get Session Messages
Retrieve all messages in a session:
curl -X GET "https://api.nex-t1.ai/api/v1/chatbot/messages" \
-H "Authorization: Bearer $SESSION_TOKEN "
Clear Chat History
Delete all messages in a session:
curl -X DELETE "https://api.nex-t1.ai/api/v1/chatbot/messages" \
-H "Authorization: Bearer $SESSION_TOKEN "
Response :
{
"message" : "Chat history cleared successfully"
}
Multi-Agent APIs
Nex-T1’s multi-agent system provides specialized capabilities for trading, research, risk analysis, and more.
Intent Router & Preview
Routes user requests to appropriate specialized agents with intent detection and entity extraction.
curl -X POST "https://api.nex-t1.ai/api/v1/multi-agent/preview" \
-H "Authorization: Bearer $SESSION_TOKEN " \
-H "Content-Type: application/json" \
-d '{
"text": "Swap 1 ETH to USDC on Base"
}'
Response :
{
"intent" : "swap_tokens" ,
"entities" : {
"token_in" : "ETH" ,
"token_out" : "USDC" ,
"amount" : "1" ,
"chain" : "base"
},
"team" : "trading"
}
Preview Run (End-to-End)
Execute a complete preview flow including routing, quote generation, and risk assessment:
curl -X POST "https://api.nex-t1.ai/api/v1/multi-agent/preview/run" \
-H "Authorization: Bearer $SESSION_TOKEN " \
-H "Content-Type: application/json" \
-d '{
"text": "Swap 1 ETH to USDC on Base",
"evm_input": {
"chain_id": 8453,
"token_in_address": "0x4200000000000000000000000000000000000006",
"token_out_address": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
"amount_in": "1",
"slippage_bps": 50
},
"thresholds": {
"max_slippage_bps": 100,
"max_price_impact_bps": 200
}
}'
Response :
{
"intent" : "swap_tokens" ,
"team" : "trading" ,
"summary" : "Swap 1 ETH to ~3,420 USDC on Base via Uniswap V3" ,
"quote" : {
"route" : [ "Uniswap V3" ],
"expected_out" : "3420.50" ,
"price_impact_bps" : 15 ,
"slippage_bps" : 50 ,
"fees" : {
"swap_fee_bps" : 30 ,
"gas_estimate_usd" : "0.15"
},
"gas_estimate" : "150000" ,
"venue" : "Uniswap V3" ,
"quote_id" : "q_1234567890" ,
"expires_at" : "2025-10-03T12:05:00Z"
},
"risk" : {
"level" : "low" ,
"aggregate_score" : 8.5 ,
"checks" : [
{
"type" : "price_sanity" ,
"passed" : true ,
"details" : "Price within expected range"
}
],
"flags" : []
}
}
Research Agent
Aggregate data from multiple sources for comprehensive DeFi analysis.
cURL (DefiLlama TVL)
Python (The Graph Query)
cURL (Dune Analytics)
curl -X POST "https://api.nex-t1.ai/api/v1/multi-agent/research/preview" \
-H "Authorization: Bearer $SESSION_TOKEN " \
-H "Content-Type: application/json" \
-d '{
"tvl_chain": "ethereum",
"pools_chain": "ethereum",
"pools_limit": 10
}'
Response :
{
"graph_data" : {
"pools" : [
{
"id" : "0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640" ,
"token0" : { "symbol" : "USDC" },
"token1" : { "symbol" : "WETH" },
"totalValueLockedUSD" : "156789123.45" ,
"volumeUSD" : "89234567.89" ,
"feeTier" : "500"
}
]
},
"summary" : "Top 10 Uniswap V3 pools by TVL on Ethereum. USDC/WETH 0.05% leads with $156M TVL..."
}
Trading Agent
Handle quotes, execution, and trade optimization across multiple DEXs.
Get Pseudo Quote (EVM)
Get a reference quote using Chainlink prices (non-executable):
curl -X POST "https://api.nex-t1.ai/api/v1/multi-agent/quote/evm/pseudo" \
-H "Authorization: Bearer $SESSION_TOKEN " \
-H "Content-Type: application/json" \
-d '{
"input": {
"chain_id": 1,
"token_in_address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
"token_out_address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"amount_in": "1.5",
"slippage_bps": 50
}
}'
Response :
{
"route" : [ "Chainlink Reference" ],
"expected_out" : "5130.75" ,
"price_impact_bps" : 0 ,
"slippage_bps" : 50 ,
"fees" : {},
"gas_estimate" : null ,
"venue" : "chainlink-reference" ,
"quote_id" : "pseudo_q_1234567890" ,
"expires_at" : "2025-10-03T12:05:00Z"
}
Execute EVM Trade
Execute a trade with confirmation and risk checks:
Trade execution requires confirm: true and passes through risk assessment. Always verify the quote before execution.
curl -X POST "https://api.nex-t1.ai/api/v1/multi-agent/execute/evm" \
-H "Authorization: Bearer $SESSION_TOKEN " \
-H "Content-Type: application/json" \
-d '{
"input": {
"chain_id": 1,
"token_in_address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
"token_out_address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"amount_in": "1.0",
"slippage_bps": 50,
"simulate_only": false
},
"confirm": true,
"wallet_ref": "main_wallet",
"thresholds": {
"max_slippage_bps": 100,
"max_price_impact_bps": 200
}
}'
Response :
{
"tx" : {
"to" : "0x..." ,
"data" : "0x..." ,
"value" : "0" ,
"gas" : "150000"
},
"tx_hash" : "0xabcd1234..." ,
"explorer_url" : "https://etherscan.io/tx/0xabcd1234..." ,
"status" : "pending" ,
"message" : "Transaction submitted successfully"
}
Risk Agent
Evaluate and manage transaction risks before execution.
curl -X POST "https://api.nex-t1.ai/api/v1/multi-agent/risk/preview" \
-H "Authorization: Bearer $SESSION_TOKEN " \
-H "Content-Type: application/json" \
-d '{
"quote": {
"expected_out": "3420.50",
"slippage_bps": 50,
"price_impact_bps": 15,
"venue": "Uniswap V3",
"quote_id": "q_123",
"expires_at": "2025-10-03T12:05:00Z"
},
"input": {
"chain": "evm",
"addresses": [
"0x4200000000000000000000000000000000000006",
"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
],
"checks": ["rug", "price_sanity", "gas_spike"]
},
"thresholds": {
"max_slippage_bps": 100,
"max_price_impact_bps": 200
}
}'
Response :
{
"level" : "low" ,
"aggregate_score" : 8.5 ,
"checks" : [
{
"type" : "rug" ,
"passed" : true ,
"score" : 9.0 ,
"details" : "No rug pull indicators detected"
},
{
"type" : "price_sanity" ,
"passed" : true ,
"score" : 9.5 ,
"details" : "Price within expected range"
},
{
"type" : "gas_spike" ,
"passed" : true ,
"score" : 7.0 ,
"details" : "Gas prices slightly elevated but acceptable"
}
],
"flags" : []
}
Risk Levels :
Level Score Description low7-10 Safe to proceed medium4-6.9 Review warnings carefully high0-3.9 Not recommended unknownN/A Insufficient data
Nex-T1 integrates with multiple MCP servers and external tools.
Subscribe to Real-time Data
curl -X POST "https://api.nex-t1.ai/api/v1/multi-agent/binance/subscribe" \
-H "Authorization: Bearer $SESSION_TOKEN " \
-H "Content-Type: application/json" \
-d '{
"symbol": "BTCUSDT",
"market": "spot",
"streams": ["aggTrade", "kline"],
"interval": "1m"
}'
Response :{
"subscription_id" : "sub_12345" ,
"status" : "subscribed" ,
"streams" : [ "BTCUSDT@aggTrade" , "BTCUSDT@kline_1m" ]
}
curl -X POST "https://api.nex-t1.ai/api/v1/multi-agent/binance/unsubscribe" \
-H "Authorization: Bearer $SESSION_TOKEN " \
-H "Content-Type: application/json" \
-d '{
"subscription_id": "sub_12345"
}'
curl -X GET "https://api.nex-t1.ai/api/v1/multi-agent/bitcoin/latest-block" \
-H "Authorization: Bearer $SESSION_TOKEN "
curl -X POST "https://api.nex-t1.ai/api/v1/multi-agent/bitcoin/tx/decode" \
-H "Authorization: Bearer $SESSION_TOKEN " \
-H "Content-Type: application/json" \
-d '{
"raw_tx": "01000000..."
}'
curl -X POST "https://api.nex-t1.ai/api/v1/multi-agent/bitcoin/address/validate" \
-H "Authorization: Bearer $SESSION_TOKEN " \
-H "Content-Type: application/json" \
-d '{
"address": "bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh"
}'
Get real-time price feeds from Chainlink oracles:
curl -X POST "https://api.nex-t1.ai/api/v1/multi-agent/chainlink/price" \
-H "Authorization: Bearer $SESSION_TOKEN " \
-H "Content-Type: application/json" \
-d '{
"chain": "ethereum",
"pair": "ETH/USD"
}'
Exa MCP (Optional)
Exa MCP server must be configured in your environment. See EXA_MCP.md for setup instructions.
curl -X POST "https://api.nex-t1.ai/api/v1/multi-agent/exa/refresh" \
-H "Authorization: Bearer $SESSION_TOKEN "
Wallet Management
curl -X POST "https://api.nex-t1.ai/api/v1/multi-agent/wallet/evm/balance" \
-H "Authorization: Bearer $SESSION_TOKEN " \
-H "Content-Type: application/json" \
-d '{
"address": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb"
}'
Response :{
"address" : "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb" ,
"balance" : "1.234567890123456789" ,
"balance_usd" : "4234.56" ,
"chain_id" : 1 ,
"tokens" : [
{
"address" : "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48" ,
"symbol" : "USDC" ,
"balance" : "1000.0" ,
"balance_usd" : "1000.0"
}
]
}
Metrics & Analytics APIs
Track volume, PnL, TVL, and position data.
Volume Metrics
curl -X GET "https://api.nex-t1.ai/api/v1/metrics/volume?start=2025-10-01T00:00:00Z&end=2025-10-03T23:59:59Z&agent=trading" \
-H "Authorization: Bearer $SESSION_TOKEN "
Response :
{
"total_volume_usd" : 1234567.89 ,
"by_agent" : [
{
"key" : "trading" ,
"value" : 987654.32
},
{
"key" : "research" ,
"value" : 246913.57
}
]
}
PnL Metrics
curl -X GET "https://api.nex-t1.ai/api/v1/metrics/pnl?start=2025-10-01T00:00:00Z&end=2025-10-03T23:59:59Z" \
-H "Authorization: Bearer $SESSION_TOKEN "
Response :{
"realized_pnl_usd" : 12345.67 ,
"by_agent" : [
{
"key" : "trading" ,
"value" : 10000.50
},
{
"key" : "research" ,
"value" : 2345.17
}
]
}
curl -X GET "https://api.nex-t1.ai/api/v1/metrics/pnl/unrealized?agent=trading" \
-H "Authorization: Bearer $SESSION_TOKEN "
Response :{
"unrealized_pnl_usd" : 5432.10 ,
"by_agent" : [
{
"key" : "trading" ,
"value" : 5432.10
}
]
}
TVL Metrics
curl -X GET "https://api.nex-t1.ai/api/v1/metrics/tvl?mode=agents&agent=trading" \
-H "Authorization: Bearer $SESSION_TOKEN "
curl -X GET "https://api.nex-t1.ai/api/v1/metrics/tvl?mode=defillama&chain=ethereum" \
-H "Authorization: Bearer $SESSION_TOKEN "
Position Management
curl -X GET "https://api.nex-t1.ai/api/v1/positions?agent=trading&wallet_address=0x..." \
-H "Authorization: Bearer $SESSION_TOKEN "
Response :[
{
"id" : 1 ,
"agent" : "trading" ,
"wallet_address" : "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb" ,
"chain_id" : 1 ,
"token_address" : "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2" ,
"token_symbol" : "WETH" ,
"quantity" : 10.5 ,
"cost_basis_usd_per_unit" : 3200.00 ,
"realized_pnl_usd" : 2500.00 ,
"last_price_usd" : 3420.00 ,
"market_value_usd" : 35910.00 ,
"unrealized_pnl_usd" : 2310.00 ,
"updated_at" : "2025-10-03T12:00:00Z"
}
]
curl -X POST "https://api.nex-t1.ai/api/v1/positions/mark-to-market" \
-H "Authorization: Bearer $SESSION_TOKEN " \
-H "Content-Type: application/json" \
-d '{
"agent": "trading",
"chain": "ethereum"
}'
curl -X POST "https://api.nex-t1.ai/api/v1/metrics/wallets/snapshot" \
-H "Authorization: Bearer $SESSION_TOKEN " \
-H "Content-Type: application/json" \
-d '{
"agent": "trading",
"wallet_address": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
"chain_id": 1,
"holdings": [
{
"token_address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
"token_symbol": "WETH",
"quantity": 10.5,
"usd_value": 35910.00
}
]
}'
curl -X POST "https://api.nex-t1.ai/api/v1/metrics/trades" \
-H "Authorization: Bearer $SESSION_TOKEN " \
-H "Content-Type: application/json" \
-d '{
"agent": "trading",
"wallet_address": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
"chain_id": 1,
"venue": "Uniswap V3",
"token_in_address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
"token_out_address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"token_in_symbol": "WETH",
"token_out_symbol": "USDC",
"amount_in": "1.0",
"amount_out": "3420.50",
"amount_in_usd": 3420.00,
"amount_out_usd": 3420.50,
"price_in_usd_per_unit": 3420.00,
"price_out_usd_per_unit": 1.00,
"fees_usd": 10.26,
"status": "success",
"simulated": false,
"tx_hash": "0xabcd1234..."
}'
Error Handling
All API errors follow a consistent format:
{
"detail" : [
{
"type" : "value_error" ,
"loc" : [ "body" , "messages" , 0 , "content" ],
"msg" : "Content must be between 1 and 3000 characters" ,
"input" : "" ,
"ctx" : {
"error" : "validation_error"
}
}
]
}
HTTP Status Codes
Status Code Description 200 OK Request successful 400 Bad Request Invalid request parameters 401 Unauthorized Missing or invalid authentication token 403 Forbidden Insufficient permissions 404 Not Found Resource not found 422 Unprocessable Entity Validation error 429 Too Many Requests Rate limit exceeded 500 Internal Server Error Server error 503 Service Unavailable Temporary outage
Error Handling Examples
import requests
from requests.exceptions import HTTPError
try :
response = requests.post(
"https://api.nex-t1.ai/api/v1/chatbot/chat" ,
headers = { "Authorization" : f "Bearer { session_token } " },
json = { "messages" : [{ "role" : "user" , "content" : "Hello" }]}
)
response.raise_for_status()
data = response.json()
except HTTPError as e:
if e.response.status_code == 401 :
print ( "Authentication failed. Please login again." )
elif e.response.status_code == 422 :
print ( f "Validation error: { e.response.json() } " )
elif e.response.status_code == 429 :
print ( "Rate limit exceeded. Please wait and retry." )
else :
print ( f "Error { e.response.status_code } : { e.response.text } " )
Rate Limiting
Nex-T1 uses slowapi for rate limiting to ensure fair usage and system stability.
Rate Limit Behavior
Rate limits are applied per endpoint
Exceeded limits return HTTP 429 status
Retry after the specified backoff period
Best Practices
Implement Exponential Backoff Retry failed requests with increasing delays (1s, 2s, 4s, 8s…)
Cache Responses Cache frequently accessed data like prices and TVL to reduce API calls
Use Streaming Use streaming endpoints for chat to reduce multiple request overhead
Batch Operations Combine multiple operations when possible (e.g., preview/run)
Retry Example
import time
import requests
from requests.adapters import HTTPAdapter
from urllib3.util.retry import Retry
# Configure retry strategy
retry_strategy = Retry(
total = 3 ,
backoff_factor = 1 , # 1s, 2s, 4s
status_forcelist = [ 429 , 500 , 502 , 503 , 504 ],
allowed_methods = [ "GET" , "POST" ]
)
adapter = HTTPAdapter( max_retries = retry_strategy)
session = requests.Session()
session.mount( "https://" , adapter)
# Make request with automatic retries
response = session.post(
"https://api.nex-t1.ai/api/v1/chatbot/chat" ,
headers = { "Authorization" : f "Bearer { session_token } " },
json = { "messages" : [{ "role" : "user" , "content" : "Hello" }]}
)
Health Check
Monitor API health and status:
curl -X GET "https://api.nex-t1.ai/api/v1/health"
Response :{
"status" : "healthy" ,
"version" : "1.0.0" ,
"timestamp" : "2025-10-03T12:00:00Z"
}
curl -X GET "https://api.nex-t1.ai/health"
Response :{
"status" : "healthy" ,
"environment" : "production" ,
"version" : "1.0.0" ,
"uptime" : "12d 5h 23m"
}
MCP Server Integration
Nex-T1 exposes MCP (Model Context Protocol) endpoints for integration with MCP clients.
SSE Endpoint
curl -X GET "https://api.nex-t1.ai/mcp/sse"
Messages Endpoint
curl -X POST "https://api.nex-t1.ai/mcp/messages" \
-H "Content-Type: application/json" \
-d '{
"method": "tools/list",
"params": {}
}'
API Limits and Quotas
Request Size Limits
Maximum request body size: 10MB
Maximum message content: 3,000 characters
Maximum response size: 50MB
Timeout Limits
Standard endpoints: 30 seconds
Chat streaming: Connection timeout after 5 minutes of inactivity
Research endpoints: 120 seconds
Execution endpoints: 60 seconds
OpenAPI Documentation
Interactive API documentation is available through OpenAPI/Swagger:
# Download OpenAPI specification
curl https://api.nex-t1.ai/openapi.json > nex-t1-openapi.json
Best Practices
Use Session Tokens Always use session tokens (not access tokens) for chat and multi-agent endpoints to maintain context
Validate Input Validate all input parameters client-side before making API calls
Handle Errors Gracefully Implement proper error handling with user-friendly messages
Test in Sandbox Use development environment for testing before production deployment
Monitor Token Expiry Track token expiration times and refresh before expiry
Secure Credentials Never expose API keys or tokens in client-side code or version control
Code Examples Repository
For complete working examples, visit our GitHub repository:
Nex-T1 API Examples Browse full integration examples in Python, TypeScript, Go, and more
Support
Developer Discord Join our Discord for real-time support and community discussions
GitHub Issues Report bugs and request features on GitHub