{"slug": "logostype-and-the-cost-of-tokens-that-coding-agents-write", "title": "LogosType and the cost of tokens that coding agents write", "summary": "The ThinkIac project reported a 42% reduction in source-writing tokens after migrating one module from JavaScript to its declarative LogosType language, which derives tool parameter and return types from the function signature instead of requiring agents to generate verbose JSDoc metadata. Because output tokens cost five times uncached input tokens on OpenAI and Claude APIs, the project estimates a 5,000-token JavaScript generation would drop to about 2,900 tokens, saving roughly $0.076 per generation on GPT-6.2 Astra after subtracting $0.008 for the 1,000 instruction tokens needed to teach the model the syntax.", "body_md": "When a coding agent reads a test log, the log counts as input. When the agent writes a tool definition into a file, the code counts as output. On the APIs below, an output token costs five times as much as an uncached input token.\n\nSeveral token-saving tools for Claude Code, Codex, and other agent harnesses focus on input. RTK filters terminal output, Context Mode indexes tool results for targeted retrieval, and Headroom compresses data such as logs and JSON before it reaches the model. [RTK](https://github.com/rtk-ai/rtk) · [Context Mode](https://github.com/mksglu/context-mode) · [Headroom](https://github.com/headroomlabs-ai/headroom)\n\nCaveman works on a different part of the bill. It steers the agent toward shorter messages during the task and in the final response. Any effect on internal reasoning tokens needs to be measured for the model and workload in use. [Caveman](https://github.com/JuliusBrussee/caveman)\n\nStandard API rates in US dollars per million tokens, using uncached input and short-context rates where applicable. [OpenAI API pricing](https://developers.openai.com/api/docs/pricing) · [Claude API pricing](https://platform.claude.com/docs/en/about-claude/pricing)\n\n| Model | Input | Output | Output / input | \n|---|---|---|---|\n| GPT-6.2 Astra | $8 | $40 | 5× | \n| GPT-6.2 Sol | $2 | $10 | 5× | \n| GPT-6.1 Terra | $1 | $5 | 5× | \n| Claude Fable 5.2 | $8 | $40 | 5× | \n| Claude Opus 5.5 | $4 | $20 | 5× | \n\nWhen an agent writes a package with several tools, each declaration adds to the cost of generating the package. Some of those tokens describe the tool's contract, including its name, parameters, and return type. A language can put that information directly in the declaration.\n\nHere's a Celsius-to-Fahrenheit tool using ThinkIac's JavaScript convention. An exported function handles the call, and JSDoc carries the registration metadata.\n\n```\n/** @register_tool toFahrenheit\n * @description Converts Celsius to Fahrenheit\n * @param {number} celsius - Temperature in degrees Celsius\n * @returns {number}\n */\nexport function toFahrenheit({ celsius }) {\n  return celsius * 9 / 5 + 32\n}\n```\n\nLogosType is a declarative resource language based on CoffeeScript 2. In a host with a `tool` provider, the same tool can be written in an `index.type` file.\n\n``` php\ntool toFahrenheit = (celsius: number): number ->\n  @description \"Converts Celsius to Fahrenheit\"\n  @param celsius - Temperature in degrees Celsius\n  celsius * 9 / 5 + 32\n```\n\nThe `tool` declaration identifies the resource, and the compiler derives the parameter and return types from the signature. The directives carry the descriptions. The compiler emits JavaScript and metadata that the host can use to register the tool. That shortens the source the agent has to generate. [LogosType compiler documentation](https://github.com/ThinkIac/LogosType#api-do-compilador)\n\nThe ThinkIac project reported a **42% reduction in source-writing tokens** when it migrated one module from JavaScript to LogosType. The percentage describes that module's source. The calculation below applies it to an illustrative generation size.\n\nThe model needs instructions for writing `.type` files. If those instructions add 1,000 uncached input tokens across a task, they cost **$0.008** on GPT-6.2 Astra. The break-even point is **200 output tokens saved**.\n\nSuppose the JavaScript version would take 5,000 output tokens. Applying the observed 42% reduction brings the estimate to 2,900 tokens. The 2,100 output tokens saved are worth **$0.084** on Astra. Subtract the **$0.008** for instructions and the estimated saving is **$0.076** for that generation. [OpenAI API pricing](https://developers.openai.com/api/docs/pricing) · [Claude API pricing](https://platform.claude.com/docs/en/about-claude/pricing)\n\nA small edit can fall below the break-even point. Generating several resources gives the agent more code over which to spread the instruction cost. For an end-to-end comparison, count instructions resent across model calls, code read back into context, and tokens spent on corrections.\n\nLogosType was created for **ThinkIac**, a runtime for composable agents. ThinkIac is where the language is used to declare package resources, with providers supplied by the host. The compiler can also be used independently. Another host can compile `.type` files, read their declarations, and supply its own providers. [LogosType](https://github.com/ThinkIac/LogosType) · [ThinkIac](https://github.com/ThinkIac/ThinkIac)\n\n*This article was drafted and translated using AI from a brief and technical feedback supplied by the ThinkIac project.*", "url": "https://wpnews.pro/news/logostype-and-the-cost-of-tokens-that-coding-agents-write", "canonical_source": "https://dev.to/thinkiac/logostype-and-the-cost-of-tokens-that-coding-agents-write-2k0l", "published_at": "2026-11-27 18:37:32+00:00", "updated_at": "2026-11-27 18:44:50.918291+00:00", "lang": "en", "topics": ["ai-agents", "ai-tools", "large-language-models", "developer-tools"], "entities": ["ThinkIac", "LogosType", "Claude Code", "Codex", "OpenAI", "Anthropic", "RTK", "Caveman"], "also_reported_by": [], "takeaway": "A declarative tool language that derives parameter and return types from the signature cut source-writing tokens 42% on one module, saving an estimated $0.076 per 5,000-token generation on GPT-6.2 Astra once 1,000 instruction tokens are amortized.", "recommendation": {"advice": "When agents generate tool definitions, prefer declarative syntax that infers types from signatures over verbose metadata, but only for multi-resource generations that clear the ~200-output-token break-even against instruction overhead.", "playbook": "llm-cost", "playbook_url": "https://wpnews.pro/playbooks/llm-cost"}, "alternates": {"html": "https://wpnews.pro/news/logostype-and-the-cost-of-tokens-that-coding-agents-write", "markdown": "https://wpnews.pro/news/logostype-and-the-cost-of-tokens-that-coding-agents-write.md", "text": "https://wpnews.pro/news/logostype-and-the-cost-of-tokens-that-coding-agents-write.txt", "jsonld": "https://wpnews.pro/news/logostype-and-the-cost-of-tokens-that-coding-agents-write.jsonld"}}