Skip to content

feat(providers): add Tokenify as an OpenAI-compatible provider - #44163

Open
BeEdward wants to merge 8 commits into
BerriAI:mainfrom
tokenify-dev:feat/add-tokenify-provider
Open

BeEdward wants to merge 8 commits into
BerriAI:mainfrom
tokenify-dev:feat/add-tokenify-provider

Conversation

@BeEdward

@BeEdward BeEdward commented Oct 2, 2026

Copy link
Copy Markdown

TLDR

Problem this solves:

  • Tokenify users can only reach it through openai/ plus a manual api_base
  • No cost tracking or Admin UI entry for Tokenify

How it solves it:

User Flow

Before: a developer has to know the base URL and route through the generic OpenAI provider

  1. They call litellm.completion(model="tokenify/deepseek/deepseek-v4-pro", ...)
  2. LiteLLM raises "LLM Provider NOT provided" because tokenify is not a known prefix
  3. They fall back to model="openai/deepseek/deepseek-v4-pro" with api_base="https://api.tokenify.dev/v1"

After: the provider prefix works on its own

  1. They set TOKENIFY_API_KEY and call litellm.completion(model="tokenify/deepseek/deepseek-v4-pro", ...)
  2. The request goes to https://api.tokenify.dev/v1/chat/completions with their key and returns a normal completion
  3. litellm.responses(...) and litellm.anthropic.messages.acreate(...) with the same model reach /v1/responses and /v1/messages
  4. In the Admin UI, "Tokenify" appears in the provider list with API Base and API Key fields

Pre-Submission checklist

  • I have added meaningful tests (tests/unit/llms/openai_like/test_tokenify_provider.py, mirroring the Cortecs tests)
  • The test files covering my change pass locally: pytest tests/unit/llms/openai_like/test_tokenify_provider.py tests/unit/llms/openai_like/test_cortecs_provider.py → 14 passed; ruff check and ruff format --check clean
  • My PR passes all required CI/CD checks
  • My PR's scope is as isolated as possible; it only adds one provider
  • Greptile Confidence Score of at least 4/5

Type

🆕 New Feature

Docs: https://www.tokenify.dev/docs/ — models: GET https://api.tokenify.dev/v1/models. A docs page for docs.litellm.ai can follow in BerriAI/litellm-docs once this lands.

🤖 Generated with Claude Code

Tokenify serves DeepSeek and GLM models on /v1/chat/completions,
/v1/responses and /v1/messages at https://api.tokenify.dev/v1. Registered
through the JSON provider config, following the Cortecs provider.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@BeEdward
BeEdward requested a review from a team October 2, 2026 09:07
@CLAassistant

CLAassistant commented Oct 2, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@greptile-apps

greptile-apps Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium risk] Adds a new OpenAI-compatible provider to the routing system.

The PR appears safe to merge; no outstanding findings remain.

Summary

Adds Tokenify as an OpenAI-compatible provider, with model pricing, endpoint declarations, Admin UI fields, and request tests.

  • The latest change makes the five expected model IDs explicit so the tests detect missing price entries.

Reviews (4) · Last reviewed commit: "test(providers): pin the expected Tokeni..."

Comment thread litellm/llms/openai_like/providers.json Resolved
@codspeed

codspeed Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

1 warning

⚠️ 1 benchmark is dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

✅ 35 untouched benchmarks


Comparing BeEdward:feat/add-tokenify-provider (2eb5791) with main (295d79f)1

Open in CodSpeed

Footnotes

  1. No successful run was found on main (38b4d31) during the generation of this report, so 295d79f was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

@codecov

codecov Bot commented Oct 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Adds cost-map entries for the five models Tokenify serves (identical in the
root and backup maps), with capabilities taken from its GET /v1/models, and
tests that the costs match the published per-1M prices and that the Admin UI
placeholder model is priced.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@BeEdward

BeEdward commented Oct 2, 2026

Copy link
Copy Markdown
Author

@greptileai

…or price literals

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@BeEdward

BeEdward commented Oct 2, 2026

Copy link
Copy Markdown
Author

@greptileai

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@BeEdward

BeEdward commented Oct 2, 2026

Copy link
Copy Markdown
Author

@greptileai

@BeEdward

BeEdward commented Oct 9, 2026

Copy link
Copy Markdown
Author

Hi maintainers — this is ready for review whenever you have a moment: all required checks pass, Greptile is at 5/5, and the CLA is signed. It follows the Cortecs provider (#43872): a JSON openai_like entry, cost-map entries for the five models, and unit tests. Happy to adjust anything, or for you to land it as an internal copy if that is easier. Thank you!

BeEdward and others added 2 commits October 27, 2026 03:19
…rovider

# Conflicts:
#	litellm/constants.py
#	litellm/llms/openai_like/providers.json
#	litellm/model_prices_and_context_window_backup.json
#	litellm/types/utils.py
#	model_prices_and_context_window.json
…rows

Upstream now rejects max_tokens in model_prices_and_context_window.json
(test_no_row_carries_the_retired_max_tokens_field); max_output_tokens is
unchanged.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@BeEdward

Copy link
Copy Markdown
Author

@greptileai

@BeEdward

Copy link
Copy Markdown
Author

Hi @moe-berri @krrish-berri-2 — following up on this one, since you merged the recent JSON openai_like providers (#48497, #43872).

I've merged current main into the branch (7f3ba5a): the conflicts were all append-at-end collisions with newer providers, and I dropped the retired max_tokens field from our five price rows so test_no_row_carries_the_retired_max_tokens_field passes. test_tokenify_provider.py passes and ruff is clean. The only red check is osv-scan, which flags pillow in uv.lock and fails the same way on other open PRs (e.g. #48534).

The shape matches Refuseless (#48497): a providers.json entry, cost-map rows for five models, and unit tests. Happy to change anything you'd like.

…rovider

Resolve the append-at-end conflict in model_prices_and_context_window.json
(and its backup) with the new bedrock_mantle/openai.gpt-6.1-terra row;
both sides kept, Tokenify rows unchanged.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@BeEdward

Copy link
Copy Markdown
Author

Merged current main into the branch again (78c241d) — GitHub was reporting a conflict. It was the usual append-at-end collision in model_prices_and_context_window.json (and the backup) with the new bedrock_mantle/openai.gpt-6.1-terra row; both sides are kept and the Tokenify rows are unchanged. tests/unit/llms/openai_like/test_tokenify_provider.py passes (15/15), ruff is clean, and the two price-map files are byte-identical.

@BeEdward

Copy link
Copy Markdown
Author

@greptileai

Run scripts/generate_provider_endpoints_support.py after merging main
(BerriAI#48619 now derives the matrix from the cost map) and drop
test_tokenify_supported_endpoints, as BerriAI#48619 did for the other
openai_like providers.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@BeEdward

Copy link
Copy Markdown
Author

Pushed 2eb5791 to fix code-quality (and the lint passed rollup): after #48619, provider_endpoints_support.json is generated from the cost map, and our branch had the old hand-written tokenify entry. I ran scripts/generate_provider_endpoints_support.py, so --check is clean now. I also removed test_tokenify_supported_endpoints, the same way #48619 removed the matching cortecs/prism/reka tests. test_tokenify_provider.py passes 14/14, ruff is clean, and the price maps are unchanged and byte-identical. osv-scan is still the upstream pillow finding.

@BeEdward

Copy link
Copy Markdown
Author

@greptileai

@BeEdward

Copy link
Copy Markdown
Author

Quick housekeeping note: the fork behind this PR has moved from BeEdward/litellm to tokenify-dev/litellm, the official GitHub organization for Tokenify. The branch and commits are unchanged (head 2eb57913f), so nothing changes for review. Happy to make any changes you need.

This branch has not been deployed

No deployments
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.

2 participants