Skip to main content
Glama

llmkit_local_session

Track current session costs across AI coding tools like Claude Code and Cline without requiring API keys.

Instructions

Current session cost across all detected AI coding tools (Claude Code, Cline). No API key needed.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handleLocalSession function retrieves and summarizes costs from active local AI coding tool sessions.
    export async function handleLocalSession() {
      const active = await detectAdapters();
      if (active.length === 0) return fail('No AI coding tool data found. Works with Claude Code and Cline.');
    
      const sessions = await Promise.allSettled(active.map(a => a.getCurrentSession()));
      const found = sessions
        .map(r => r.status === 'fulfilled' ? r.value : null)
        .filter(s => s !== null);
    
      if (found.length === 0) return fail('No active session data found.');
    
      const total = found.reduce((s, x) => s + x.cost, 0);
      const lines = [
        'Local Session Costs',
        '\u2500'.repeat(25),
        `${found.length} source(s), $${total.toFixed(4)} total`,
        '',
      ];
    
      for (const s of found) {
        const tokens = s.inputTokens + s.outputTokens;
        lines.push(`${s.source}: $${s.cost.toFixed(4)} (${s.messages} msgs, ${(tokens / 1000).toFixed(0)}k tokens, ${s.topModel})`);
      }
  • Registration of llmkit_local_session in the handler map in packages/mcp-server/src/tools.ts.
    llmkit_local_session: () => handleLocalSession(),

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/smigolsmigol/llmkit-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server