You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TypeScript SDK for Targe — the LLM key sharing marketplace for AI agents. Pay per token in USDC on Base.
Install
npm install @targe/sdk ethers
Quick Start
import{Targe}from'@targe/sdk';consttarge=newTarge({privateKey: process.env.WALLET_KEY!});// Call Claude via the LLM key poolconstresult=awaittarge.proxyPool('anthropic','/v1/messages',{model: 'claude-sonnet-4-5-20250929',max_tokens: 256,messages: [{role: 'user',content: 'Hello!'}],});
Streaming
const{ stream }=awaittarge.proxyPoolStream('anthropic','/v1/messages',{model: 'claude-sonnet-4-5-20250929',max_tokens: 1024,messages: [{role: 'user',content: 'Tell me a story'}],});forawait(consteventofstream){if(event.data==='[DONE]')break;constparsed=JSON.parse(event.data);if(parsed.delta?.text)process.stdout.write(parsed.delta.text);}
import{Targe,InsufficientBalanceError,RateLimitError}from'@targe/sdk';try{awaittarge.proxyPool('anthropic','/v1/messages',body);}catch(err){if(errinstanceofInsufficientBalanceError){console.log('Top up your balance first');}elseif(errinstanceofRateLimitError){console.log(`Rate limited. Retry after ${err.retryAfter}s`);}}