Skip to content

feat(llmtr): add new provider - #757

Open
knowhycodata wants to merge 1 commit into
charmbracelet:mainfrom
knowhycodata:add-llmtr-provider
Open

knowhycodata wants to merge 1 commit into
charmbracelet:mainfrom
knowhycodata:add-llmtr-provider

Conversation

@knowhycodata

Copy link
Copy Markdown

Adds LLMTR, an OpenAI-compatible gateway at https://llmtr.com/v1. One key reaches models hosted in Turkey (llmtr/...) and global models from Anthropic, Google, OpenAI, DeepSeek, Mistral, Qwen and others.

Changes

  • cmd/llmtr/main.go: generator that reads the public GET https://llmtr.com/v1/models (no key needed, OpenRouter-style schema) and writes internal/providers/configs/llmtr.json.
    • Keeps models that are served on /v1/chat/completions, support tools, take and return text, and have at least 20K context. Responses-only models are skipped.
    • Prices come straight from the API, which returns USD per token. They are converted to USD per 1M tokens (input_cache_read → cache_hit). Nothing is estimated or converted from another currency.
    • Reasoning: reasoning.mandatory → always; a reasoning parameter → toggleable, with effort levels taken from supported_efforts when the model accepts reasoning_effort; otherwise never.
    • Vision and audio come from input_modalities. default_max_tokens is half of max_completion_tokens, the same as the OpenRouter generator.
  • internal/providers/configs/llmtr.json: generated output, formatted with go run ./cmd/format.
  • pkg/catwalk/provider.go: InferenceProviderLLMTR and KnownProviders() entry.
  • internal/providers/providers.go: embed and registry entry, in alphabetical order.
  • .github/workflows/update.yml: LLMTR step, so the config stays current.

Defaults are anthropic/claude-sonnet-4.6 (large) and anthropic/claude-haiku-4.5 (small), the same as OpenRouter.

Testing

  • go test ./... passes, including TestValidDefaultModels and TestKnownProvidersMatchesRegistry.
  • go vet and gofumpt -l are clean on the changed packages.
  • My machine can't reach llmtr.com directly, so I generated llmtr.json by running the same command against a saved copy of the public /v1/models response from today. That copy had 73 models that pass the filter. The scheduled update job will regenerate the file from the live endpoint, so the list may grow on the first run.

No live call to LLMTR was made for this change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant