Skip to content

Add MartLLM as a model gateway backend - #145

Open
al-global-tech wants to merge 2 commits into
CodeGraphContext:mainfrom
al-global-tech:add-uberllm-provider
Open

al-global-tech wants to merge 2 commits into
CodeGraphContext:mainfrom
al-global-tech:add-uberllm-provider

Conversation

@al-global-tech

@al-global-tech al-global-tech commented Nov 12, 2026 •

Copy link
Copy Markdown

Update 2026-11-28: UberLLM is now MartLLM. Same service, same accounts and API keys; the new site is https://martllm.com and the API base URL is https://api.martllm.com/v1 (the old uberllm.dev addresses keep working). This PR now uses the new name, links and identifiers. The live runs described below were made before the rename, against the same service at api.uberllm.dev.

Summary

Adds martllm as a fifth OpenAI-wire backend, so cost_ceiling_usd can enforce real dollars on a second backend besides OpenRouter.

  • MartLLM puts what each call was billed in the usage block (usage.cost_usd). MartLLMChatModel._provider_cost reads it, so the SpendMeter is charged the billed figure instead of counting the call in unpriced_calls. Streamed turns have the same limit as OpenRouter (the usage arrives in the final SSE chunk), and the module docstring says so.
  • One MARTLLM_API_KEY reaches models from several vendors. Ids are already vendor/model (deepseek/deepseek-v4.1-flash, anthropic/claude-sonnet-4.6), so vendor() needs no BACKEND_VENDOR entry and different_providers() still sees the real author.
  • New grapharc/gateway/martllm.py, a subclass of OpenAICompatChatModel with the fixed endpoint https://api.martllm.com/v1. Key lookup goes through config.py (MARTLLM_API_KEY / MARTLLM_KEY / martllm-api-key, env or .env).
  • Mirrors Add Novita as a model gateway backend #102 file for file: registry.py and the lazy map in gateway/__init__.py, grapharc models and models --check, a martllm extra in pyproject.toml (only langchain-openai, already a dependency) plus uv lock, the backend table and verified CLI output in docs/cookbook/02-models.md, and the backend lists in the existing tests. docs/deep-dive.md is refreshed for the new test count, as CONTRIBUTING asks.

Testing

  • uv run pytest tests/test_gateway_martllm.py tests/test_gateway_novita.py tests/test_cli.py tests/test_cookbook_models.py tests/test_gateway_openai_ollama.py tests/test_gateway_openrouter.py tests/test_deep_dive.py → 323 passed, 11 deselected.
  • uv sync --all-extras then uv run pytest (full suite) → 2405 passed, 15 skipped, 14 deselected, 5 failed. All 5 are in tests/test_cookbook_agents.py (sandbox snippets 02, 11, 12, 13, 18) and fail the same way on the unmodified base tree on macOS.
  • uv run ruff check . → clean.
  • uv run pytest -m live tests/test_gateway_martllm.py with a real key → 1 passed (get_model("martllm/deepseek/deepseek-v4.1-flash").invoke(...), asserting cost_usd is set and the call is not counted as unpriced).

Tested with deepseek/deepseek-v4.1-flash: get_model(...).invoke("Reply with exactly: ok") returned "ok", last_usage["cost_usd"] was 2.17e-06, and spend.spent_usd matched it with 0 unpriced calls.

Models: https://martllm.com/models

After the rename (62844d4): ruff check clean; uv run pytest tests/test_gateway_martllm.py tests/test_cli.py tests/test_cookbook_models.py tests/test_gateway_openrouter.py tests/test_gateway_openai_ollama.py → all passed. No live call was made with the new host.

I work on MartLLM.

al-global-tech and others added 2 commits November 12, 2026 22:21
UberLLM is now MartLLM: same service, accounts and keys. The backend is
now `martllm`, the key is MARTLLM_API_KEY and the endpoint is
https://api.martllm.com/v1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@al-global-tech al-global-tech changed the title Add UberLLM as a model gateway backend Add MartLLM as a model gateway backend Nov 28, 2026

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.

1 participant