@teroai/sdk
v1.0.2
Published
TypeScript SDK for TeroAI - Type-safe RPC-based AI and geospatial analysis platform
Readme
TeroAI TypeScript SDK
TypeScript SDK for the TeroAI platform. Authenticate with an API key and call the LLM ask API.
Installation
npm install @teroai/sdkConfiguration
Create a client with your API key. Create and manage API keys at app.teroatlas.ai (Dashboard → API Keys). The SDK uses the production API at api2.teroatlas.ai; you cannot change the base URL.
import { TeroAI } from "@teroai/sdk";
const client = new TeroAI({
apiKey: "your-api-key",
});Usage
Ask a question
const response = await client.ask({
query: "What is the average temperature in New York?",
});
console.log(response.answer); // same as response.natural_language_answer
console.log(response.conversation_id); // for follow-up in the same thread
console.log(response.usage); // current_month_tokens, monthly_token_limit, etc.You can use prompt instead of query; both are sent as query to the API. Optional options:
conversationId– continue an existing conversationincludeContext– whether to include context (default true on the API)
Health check
const health = await client.health();
console.log(health.status, health.timestamp);Response shape (ask)
The ask() response includes:
answer– convenience alias fornatural_language_answernatural_language_answer– the model’s answer textconversation_id– use for follow-up questionsusage–current_month_tokens,monthly_token_limit,current_month_queries,monthly_query_limit, etc.input_tokens,output_tokens,total_tokensexecution_results,generated_sql,geometries,timestamp, and other API fields
Project structure
sdk/typescript/
├── src/
│ ├── client/ # HTTP client and ask/health
│ ├── types/ # Config, errors, shared types
│ ├── utils/ # Auth headers (x-api-key)
│ └── index.ts # TeroAI class and exports
├── examples/
└── package.jsonScripts
npm run dev– build with watchnpm run build– production buildnpm run test– run testsnpm run type-check– type check only
Development
The SDK is built with tsup and ships CommonJS (dist/index.js), ESM (dist/index.mjs), and TypeScript declarations (dist/index.d.ts).
