API Reference

Complete reference for the KANA SDK. All methods, parameters, and return values documented.

Core Methods

METHOD

kana.chat(message, options?)

Send a message to KANA and receive a response based on the knowledge base.

Parameters

message : string — The user's query or message
options? : ChatOptions — Optional configuration

Returns

Promise<ChatResponse> — KANA's response with metadata

Example

const response = await kana.chat('What is Jito?')
console.log(response.content)
// "◈ JITO - MEV INFRASTRUCTURE ◈..."
METHOD

kana.getKnowledge(topic)

Retrieve specific knowledge without natural language processing.

Parameters

topic : KnowledgeTopic — Topic identifier

Example

const solanaInfo = await kana.getKnowledge('solana')
const securityTips = await kana.getKnowledge('phishing')
METHOD

kana.validateAddress(address)

Validate a Solana wallet address and check for known risks.

Example

const validation = await kana.validateAddress('7xKXt...AbC')
if (validation.isValid && !validation.isScam) {
  console.log('Address is safe')
}

TypeScript Types

ChatOptions

interface ChatOptions {
  temperature?: number      // 0-1, default: 0.7
  maxTokens?: number        // Max response length, default: 500
  knowledge?: string[]      // Filter knowledge domains
  includeMetadata?: boolean // Include response metadata
}

ChatResponse

interface ChatResponse {
  content: string           // KANA's response
  confidence: number        // Confidence score (0-1)
  topics: string[]          // Detected topics
  timestamp: Date           // Response timestamp
  metadata?: {
    tokens: number
    latency: number
    sources: string[]
  }
}

KnowledgeTopic

type KnowledgeTopic =
  | 'solana' | 'svm' | 'jito' | 'jupiter'
  | 'web3' | 'blockchain' | 'wallet'
  | 'security' | 'phishing' | 'privatekey'
  | 'bugs' | 'coffee' | 'stackoverflow' | 'coding'
  | 'gaming' | 'anime' | 'gacha'
  | 'meme' | 'wojak'

Error Handling

All KANA methods can throw errors. Always wrap calls in try-catch blocks:

try {
  const response = await kana.chat('gm')
  console.log(response.content)
} catch (error) {
  if (error instanceof KanaError) {
    console.error('KANA Error:', error.code, error.message)
  }
}
RATE_LIMIT_EXCEEDED

Too many requests. Wait before retrying.

INVALID_API_KEY

API key is missing or invalid.

NETWORK_ERROR

Failed to connect to KANA servers.

INVALID_PARAMETERS

Invalid method parameters provided.

Rate Limits

100
Requests per minute
10,000
Requests per day
1,000
Max tokens per request

Rate limits apply per API key. Contact support for higher limits.