Official SDKs are available for TypeScript and Python. Both provide typed methods for every endpoint, automatic retries, and built-in pagination.
Installation
npm install @yoshi-ai/sdk
# or
pnpm add @yoshi-ai/sdk
Quick example
import Yoshi from "@yoshi-ai/sdk" ;
const yoshi = new Yoshi (); // reads YOSHI_API_KEY from env
const accounts = await yoshi . accounts . list ();
const scores = await yoshi . scores . list ();
const me = await yoshi . me . retrieve ();
const summary = await yoshi . me . summary ();
Configuration
Both SDKs accept the same core options:
Option Default Description apiKey / api_keyYOSHI_API_KEY env varYour API key (starts with yoshi_) environment"production""production" or "staging"maxRetries / max_retries2Maximum number of automatic retries on failure timeout30000 ms / 30.0 sRequest timeout
import Yoshi from "@yoshi-ai/sdk" ;
const yoshi = new Yoshi ({
apiKey: "yoshi_3xK9mP..." ,
environment: "staging" ,
maxRetries: 3 ,
timeout: 60_000 ,
});
List endpoints return paginated results. The SDKs handle cursor-based pagination automatically with async iterators:
TypeScript
Python (sync)
Python (async)
// Iterate over all transactions automatically
for await ( const tx of yoshi . transactions . list ({ limit: 100 })) {
console . log ( tx . merchant_name , tx . amount );
}
You can also fetch a single page:
const page = await yoshi . transactions . list ({ limit: 50 });
console . log ( page . data );
console . log ( page . has_more );
Error handling
The SDKs raise typed exceptions for common HTTP error codes:
import Yoshi from "@yoshi-ai/sdk" ;
try {
await yoshi . accounts . list ();
} catch ( err ) {
if ( err instanceof Yoshi . AuthenticationError ) {
// 401 — invalid or revoked API key
} else if ( err instanceof Yoshi . RateLimitError ) {
// 429 — rate limited
console . log ( "Retry after:" , err . headers [ "retry-after" ]);
} else if ( err instanceof Yoshi . NotFoundError ) {
// 404 — resource not found
}
}
Available resources
The SDKs expose methods that map directly to the API reference:
SDK method Endpoint accounts.list()GET /accountsaccounts.balanceSeries.list(id)GET /accounts/{id}/balancestransactions.list()GET /transactionsscores.list()GET /scoresgoals.list()GET /goalsrecurring.list()GET /recurringinvestments.list()GET /investmentsincome.retrieve()GET /incomeme.retrieve()GET /meme.summary()GET /me/summarypaperTrading.accounts.create()POST /paper-trading/accountspaperTrading.accounts.list()GET /paper-trading/accountspaperTrading.accounts.trades.create(id)POST /paper-trading/accounts/{id}/tradespaperTrading.accounts.trades.list(id)GET /paper-trading/accounts/{id}/tradespaperTrading.accounts.holdings.list(id)GET /paper-trading/accounts/{id}/holdingsactions.create()POST /actionsactions.list()GET /actionsactions.retrieve(id)GET /actions/{id}approvals.retrieve(threadId)GET /approvals/{threadId}
Python method names use snake_case (e.g., paper_trading.accounts.create()).
Requirements
SDK Minimum version TypeScript Node.js 18+ Python Python 3.8+