Skip to main content

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

1

Get API Key

Register at app.nex-t1.ai to obtain your API key
2

Authenticate

Login to get a JWT access token for secure API access
3

Create Session

Create a chat session to maintain conversation context
4

Make Your First Call

Base URLs

Authentication

Authentication Flow

Nex-T1 uses a two-tier authentication system:
  1. User Authentication: JWT tokens for user login
  2. Session Authentication: Session-scoped tokens for chat interactions

Step 1: Register (Optional)

Register a new user account:
Response:

Step 2: Login

Authenticate with your credentials to get an access token:
Response:

Step 3: Create Chat Session

Create a session to maintain conversation context:
Response:
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

Response:

Core Endpoints

Chat API

The main conversational interface powered by LangGraph for natural language interactions.

Non-Streaming Chat

Request Schema:
Response:

Streaming Chat (Server-Sent Events)

Get real-time streaming responses for better user experience:

Get Session Messages

Retrieve all messages in a session:

Clear Chat History

Delete all messages in a session:
Response:

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.
Response:

Preview Run (End-to-End)

Execute a complete preview flow including routing, quote generation, and risk assessment:
Response:

Research Agent

Aggregate data from multiple sources for comprehensive DeFi analysis.
Response:

Trading Agent

Handle quotes, execution, and trade optimization across multiple DEXs.

Get Pseudo Quote (EVM)

Get a reference quote using Chainlink prices (non-executable):
Response:

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.
Response:

Risk Agent

Evaluate and manage transaction risks before execution.
Response:
Risk Levels:

Tool Integration APIs

Nex-T1 integrates with multiple MCP servers and external tools.

DefiLlama Tools

Response:

Binance Tools

Response:

Bitcoin Tools

Get real-time price feeds from Chainlink oracles:

Exa MCP (Optional)

Exa MCP server must be configured in your environment. See EXA_MCP.md for setup instructions.

DexScreener Tools

Wallet Management

Response:

Metrics & Analytics APIs

Track volume, PnL, TVL, and position data.

Volume Metrics

Response:

PnL Metrics

Response:
Response:

TVL Metrics

Position Management

Response:

Error Handling

Error Response Format

All API errors follow a consistent format:

HTTP Status Codes

Error Handling Examples

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

Health Check

Monitor API health and status:
Response:

MCP Server Integration

Nex-T1 exposes MCP (Model Context Protocol) endpoints for integration with MCP clients.

SSE Endpoint

Messages Endpoint

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:

Swagger UI

Visit https://api.nex-t1.ai/docs for interactive API documentation

OpenAPI Spec

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

API Status

Check status.nex-t1.ai for current API status and incidents

Developer Discord

Join our Discord for real-time support and community discussions

GitHub Issues

Report bugs and request features on GitHub