Overview
The AI Trading Assistant provides a conversational interface for interacting with the Joyride exchange. It can look up market data, analyze positions, and present actionable strategies. The model cannot place orders. A trade starts only when the user taps the strategy card’s Buy or Sell button in the Joyride app. The app keeps that trade intent while it completes any required setup. It connects the user’s wallet when needed, opens the USDC deposit flow when the available balance is too low, and submits the original order after the deposit is credited. The visible action remains Buy or Sell throughout the flow. Balance guidance is based on the latest account read. A genuine zero balance is treated as zero. If account data is temporarily unavailable, the assistant does not state a balance or claim that a trade is affordable.Authentication
The AI Chat endpoint uses SIWS (Sign In With Solana) authentication with JWT sessions, separate from the main exchange API’s wallet header auth.Auth Flow
- Get a nonce:
GET /v1/auth/nonce— returns a random nonce valid for 5 minutes - Sign the message: Construct a SIWS message with the nonce and sign it with your Solana wallet
- Verify and get JWT:
POST /v1/auth/verifywith wallet, signature, and nonce — returns a JWT - Use the JWT: Include
Authorization: Bearer <jwt>on all/v1/ai/chatrequests
Sending Messages
Send a POST request to/v1/ai/chat with a JSON body:
message— your message text (max 10,000 characters)conversation_id— omit or set tonullfor a new conversation; include a UUID to continue an existing one
SSE Response Format
Responses are streamed as Server-Sent Events (text/event-stream). Each event has a type and JSON data:
Event Types
Data Conventions
SSE events use human-readable units, unlike the main REST API:Error Codes
Rate Limiting
The AI Chat endpoint is rate-limited to 20 requests per minute per wallet (configurable viaAI_RATE_LIMIT_RPM). When rate limited, the API returns HTTP 429 with the number of seconds to wait.