Skip to content

Commit 858227b

Browse files
committed
fix(llmtr): round per-million cost and drop the residency claim
Scaling the gateway's per-token prices by a million left binary float noise behind - $1e-7/token landed on 0.09999999999999999 instead of 0.1 - and those values are what a session's cost is rendered from. Also drops the data-residency wording from the README: the gateway hosts models in Türkiye, which is the claim worth making, and the compliance framing is the operator's to make, not the client's. Verified live against the gateway: completion, streaming, tool calling, catalog-derived reasoning efforts, a Türkiye-hosted model, and a full agent run through the CLI.
1 parent ac4c286 commit 858227b

4 files changed

Lines changed: 12 additions & 6 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ CyberStrike integrates with the entire AI ecosystem through 23 bundled SDK provi
112112
| **Cerebras** | LLaMA on Cerebras | Fastest inference available |
113113
| **Cohere** | Command R+ | RAG-optimized models |
114114
| **OpenRouter** | 300+ models | Single API, any model |
115-
| **LLMTR** | 180+ models | Türkiye-hosted models, KVKK residency |
115+
| **LLMTR** | 180+ models | Türkiye-hosted models, local pricing |
116116
| **Together AI** | Open-source models | Fine-tuning support |
117117
| **DeepInfra** | Open-source models | Pay-per-token, no GPU needed |
118118
| **Perplexity** | Sonar models | Search-augmented generation |

README.tr.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ Diger yapay zeka araclari siradaki ne yapacaginizi soylemenizi bekler. CyberStri
100100

101101
**Herhangi Bir LLM, Bagimlilik Yok**
102102

103-
Kutudan ciktigi gibi 15+ saglayici: Anthropic, OpenAI, Google, Amazon Bedrock, Azure, Groq, Mistral, OpenRouter, LLMTR (Turkiye'de barindirilan modeller ve KVKK veri yerelligi) — hatta OpenAI uyumlu uc noktalar araciligiyla yerel modeller bile. Claude, GPT, Gemini veya kendi barindiginiz LLM ile calistirin. Modeller iyilestikce ve ucuzladikca, CyberStrike de onlarla birlikte gelisir.
103+
Kutudan ciktigi gibi 15+ saglayici: Anthropic, OpenAI, Google, Amazon Bedrock, Azure, Groq, Mistral, OpenRouter, LLMTR (Turkiye'de barindirilan modeller) — hatta OpenAI uyumlu uc noktalar araciligiyla yerel modeller bile. Claude, GPT, Gemini veya kendi barindiginiz LLM ile calistirin. Modeller iyilestikce ve ucuzladikca, CyberStrike de onlarla birlikte gelisir.
104104

105105
</td>
106106
<td width="50%">

packages/cyberstrike/src/provider/llmtr.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,13 @@ export namespace LLMTR {
6767
}
6868

6969
// Catalog prices are per token; models.dev costs are per million tokens.
70+
// Scaling by a million leaves binary float noise ($1e-7/token lands on
71+
// 0.09999999999999999 rather than 0.1), so round back to a precision far
72+
// finer than any real price - cost is rendered to the user per session.
7073
function price(input: string | undefined) {
7174
const value = Number(input)
72-
return Number.isFinite(value) ? value * 1_000_000 : 0
75+
if (!Number.isFinite(value)) return 0
76+
return Math.round(value * 1_000_000 * 1e6) / 1e6
7377
}
7478

7579
function model(entry: Entry): ModelsDev.Model {

packages/cyberstrike/test/provider/llmtr.test.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,11 @@ describe("LLMTR catalog", () => {
6363

6464
test("converts per-token pricing to per-million-token cost", () => {
6565
const model = provider.models["llmtr/trendyol-asure-12b"]
66-
expect(model.cost?.input).toBeCloseTo(0.1, 10)
67-
expect(model.cost?.output).toBeCloseTo(0.5, 10)
68-
expect(model.cost?.cache_read).toBeCloseTo(0.025, 10)
66+
// Exact, not close-to: scaling per-token prices by a million must not leave
67+
// float noise behind, since these values are rendered as session cost.
68+
expect(model.cost?.input).toBe(0.1)
69+
expect(model.cost?.output).toBe(0.5)
70+
expect(model.cost?.cache_read).toBe(0.025)
6971
})
7072

7173
test("carries limits, modalities and capabilities across", () => {

0 commit comments

Comments
 (0)