Skip to content

feat(dothoosh): add provider - #696

Open
Alirezajalilii wants to merge 1 commit into
charmbracelet:mainfrom
Alirezajalilii:feat/provider-dothoosh
Open

Alirezajalilii wants to merge 1 commit into
charmbracelet:mainfrom
Alirezajalilii:feat/provider-dothoosh

Conversation

@Alirezajalilii

@Alirezajalilii Alirezajalilii commented Oct 22, 2026 •

Copy link
Copy Markdown
  • I have read CONTRIBUTING.md.
  • I have created a discussion that was approved by a maintainer (for new features). I did not open a discussion for this provider; I can open one if you prefer.

Adds DotHoosh as an openai-compat provider. DotHoosh is an Iranian AI API gateway: users pay in Toman from a prepaid wallet. One key (DOTHOOSH_API_KEY, created at https://gateway.dothoosh.com/api-keys) serves an OpenAI-compatible API at https://gateway.dothoosh.com/v1. Docs: https://gateway.dothoosh.com/docs.

What changed:

  • cmd/dothoosh/main.go generates internal/providers/configs/dothoosh.json from the gateway's public model list (no key needed). The Iran-hosted API is not reachable from outside Iran, GitHub runners included, so the generator reads the public mirror of the same catalog, https://www.dothoosh.com/gateway/v1/models. Only ids, names, limits, prices, modalities and capability flags are copied. Run it with task gen:dothoosh or go run ./cmd/dothoosh. It is wired into Taskfile.yaml and .github/workflows/update.yml like the other generators.
  • internal/providers/configs/dothoosh.json is generator output, not hand-edited. Model name is the listing's name (the id when the listing has none). Prices are per million tokens; cache write goes in cost_per_1m_in_cached and cache read in cost_per_1m_out_cached, as CRUSH.md describes.
  • internal/providers/providers.go embeds and registers it; pkg/catwalk/provider.go adds InferenceProviderDotHoosh to the constants and to KnownProviders() (TestKnownProvidersMatchesRegistry passes).

Which models are included: those served on Chat Completions that support tools and take text in and out. Left out on purpose:

  • Claude models are served only on the Anthropic Messages route, and a catwalk provider has one type.
  • The GPT-6 models also list the Responses API, and their Chat Completions route admits function tools only with reasoning off or not at all, so they need the Responses route.
  • Catwalk has no field for long-context price tiers, so the base price is used.

Reasoning: the list does not carry a model's effort values, so reasoning models get low and high. Kimi K2.6 (on/off thinking toggle) and Kimi K2.7 Code (always on) take no effort, so they are listed as reasoning models without levels.

Defaults: large is the model with the highest output price and small the one with the lowest, so a new model reaches the defaults without a code change. Today that is kimi-k3 (1M context) and deepseek-flash.

A short, duplicate-id or price-less list, or one that would drop more than a third of the models already in dothoosh.json, is refused instead of overwriting the file.

Testing:

  • go test ./..., go vet ./... and golangci-lint run ./... pass on the head commit. cmd/dothoosh/main_test.go covers the field mapping, the skip rules, the refusals and the retirement guard with inline fixtures.
  • Running the generator against the live mirror reproduces the committed dothoosh.json byte for byte.
  • Not tested with Crush against the live API: the API is reachable only from Iran, and no authenticated inference was run from where this was developed. The request shape is plain OpenAI Chat Completions, and the model list, limits and prices come from the same public catalog the gateway documents.

🤖 Generated with Claude Code

@Alirezajalilii

Copy link
Copy Markdown
Author

DotHoosh now serves the full vendor context windows and bills long prompts at the vendor's long-context tier. This commit (eafef3f) updates the values to match https://gateway.dothoosh.com/models.

@Alirezajalilii

Copy link
Copy Markdown
Author

Pushed 8fe5a5c: the generator now fails (file untouched) when a served model has no prompt/completion price or when fewer than three usable models are left after filtering, and reads max_output_tokens when max_completion_tokens is 0 or null. The model list is regenerated from the live catalog: DeepSeek (deepseek-flash, deepseek-v4-pro) now lists tool support and is back.

@Alirezajalilii

Copy link
Copy Markdown
Author

Pushed 2623f3c; dothoosh.json is regenerated from the live mirror. Changes in cmd/dothoosh:

  • Models that also list the Responses API (the three GPT-6 models) are no longer offered: their Chat Completions route admits function tools only with reasoning off or not at all. Default large/small models are recomputed from what remains.
  • Prices keep micro-dollar precision (0.385001, not 0.385).
  • Kimi K2.6 and K2.7 Code no longer get reasoning levels (toggle-only and always-on models take no effort).
  • The generator refuses duplicate ids and a list that would drop more than a third of the models already in dothoosh.json.

go test ./... passes.

Add DotHoosh, an OpenAI-compatible gateway, as an openai-compat provider.
cmd/dothoosh generates internal/providers/configs/dothoosh.json from the
gateway's public, keyless model list; the Iran-hosted API is not reachable
from GitHub runners, so it reads the public mirror of the same catalog.

The generator keeps models served on Chat Completions with tool support,
skips models that also list the Responses API, and refuses a short list,
duplicate ids, a served model without prices, or a list that would drop
more than a third of the checked-in models. Default large and small models
are the highest and lowest output price in the list.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@Alirezajalilii

Copy link
Copy Markdown
Author

The branch is now a single commit on top of v0.52.83. Earlier comments cite hashes from the previous history. dothoosh.json is regenerated from the live public catalog (names, limits and prices come from the gateway; nothing is hand-written).

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