Managed router: your machines plus OpenAI, Anthropic and more
Connect your own OpenAI, Anthropic, Gemini, OpenRouter, OmniRoute or LiteLLM accounts to Tokmine, then choose, per endpoint, the order requests try your machines and those services. One URL and one Tokmine token for your tools; Tokmine does the routing and the fallback.
Nothing runs on your computer for this
How it works
- Connect a service with its API key. Tokmine checks the key straight away and discovers the models it offers.
- Set the order on a static endpoint: for example your machines, then OpenAI, then Anthropic.
- Call the endpoint as usual. The first hop that can serve the request does. If it is offline, busy, rate limited or fails before it starts answering, the request moves to the next hop. Your client sees one normal response.
your tool -> https://tunnel.tokmine.ai/t/acme-prod (one URL, one Tokmine token)
1. your machines online, has the model, not busy? -> answer
2. OpenAI key ok, not rate limited? -> answer
3. Anthropic ... -> answerConnect a service
In the app open Services, pick the service, name it and paste the key. Workspace admins on a paid plan can connect up to 10 services.
| Service | Base URL | API format |
|---|---|---|
| OpenAI | filled in | OpenAI |
| Anthropic | filled in | Anthropic Messages |
| Google Gemini | filled in | Gemini |
| OpenRouter | filled in | OpenAI |
| OmniRoute, LiteLLM, any OpenAI-compatible router | you enter it (public https URL, without /v1) | OpenAI |
Or from a terminal (keys come from the environment or stdin, never from a flag, so they stay out of your shell history):
OPENAI_API_KEY=sk-... tokmine upstream add openai --name "My OpenAI"
printf %s "$KEY" | tokmine upstream add custom --name "My router" --url https://router.example.com --key-stdin
tokmine upstream list
tokmine upstream test "My OpenAI"
tokmine upstream key "My OpenAI" --key-env NEW_OPENAI_KEY # replace a keyChoose the order
On the Endpoints page, each static endpoint has a Routing order. Add your machines, any connected service and the marketplace, move them up and down, and save. A service hop can also be limited to some models (gpt-*) and can rename models, for example fast=gpt-4o-mini so callers keep asking for fast while the service receives its own name.
tokmine upstream route acme-prod # show the current order
tokmine upstream route acme-prod machines "My OpenAI" marketplace # set it
tokmine upstream route acme-prod --default # machines, then marketplace againWithout a stored order an endpoint behaves exactly as before: your machines, then the marketplace if you allowed it. The default endpoint has a fixed order; create a static endpoint to choose.
When a request moves to the next hop
| What happened | What Tokmine does |
|---|---|
| No machine online, the model is missing, or all machines are busy | Next hop. |
| The service cannot be reached, times out, or answers with a server error (5xx) | Next hop. After three failures in a minute the service is skipped for 30 seconds. |
| The service answers 429 (rate limited) | Next hop. The service is skipped for the time it asked for (up to 5 minutes). |
| The service rejects the key (401 or 403) | Next hop, and the service shows Key rejected in the app. It is skipped for 5 minutes. Replace the key to fix it. |
| The service says the request itself is wrong (400, 404, 422) | Returned to you unchanged. Another hop would not help. |
| The answer already started streaming and then breaks | Not retried: part of the answer has been delivered. |
A hop is also skipped silently when it cannot serve the request: the service is disabled, speaks a different API format than the request (an Anthropic request is only routed to Anthropic-format services), or does not offer the model. If every hop fails you get a plain error that names the service but never repeats the service's own error text, which can echo credentials.
Every response carries x-tokmine-route: machines, upstream or marketplace, so you can see which hop answered. GET /v1/models lists the models of all hops together.
Your keys
- Stored encrypted in your workspace. The app and the API only ever show the last four characters.
- Used only to call that service for your workspace's requests. Callers never see them, and your Tokmine token is never sent to the service.
- Removing a service erases its key. You can replace a key at any time without changing any endpoint.
- Services must be reachable from the internet (public
https). Addresses on private networks, localhost and cloud metadata are refused.
Costs
You pay the service directly with your own key, at its prices. Tokmine does not meter or bill those tokens. Seats and rate limits still apply to the people calling your endpoint, and usage appears in your reports as coming from the service rather than from a machine.
Local or private services: use tokmine provider
A router on your own network (an OmniRoute or LiteLLM on your laptop or LAN) cannot be reached by the Tokmine server. Keep using tokmine provider add on a machine that can see it: it then appears as one of that machine's models and is served by the your machines hop.
| Connected service | tokmine provider | |
|---|---|---|
| Called from | The Tokmine server | Your machine |
| Needs the CLI running | No | Yes |
| URL | Public https only | Local, LAN or public |
| Key stored | Encrypted in your workspace | In your machine's config or environment |
| Fallback order | Yes, per endpoint | Counts as your machines |
FAQ
Do I need to run the Tokmine CLI to use OpenAI or Anthropic through Tokmine?
No. Connected services are called by the Tokmine server. The CLI is only needed to run your own machines, or if you prefer to manage connections from a terminal.Can I send an Anthropic-format request to OpenAI?
Not yet. A request is only routed to services that speak the same API format. Point Anthropic clients at the Anthropic format of your endpoint and keep an Anthropic service in the order.What if my machine is offline?
That is the point of the order: the next hop answers, so your tools keep working without any change.Can I use a router on my own network?
Not as a connected service, because the Tokmine server cannot reach private addresses. Add it with tokmine provider add on a machine that can, and it is served by the your machines hop.Who can connect services?
Workspace admins on a paid plan, up to 10 services per workspace. Everyone in the workspace can see which services are connected, never their keys.Does Tokmine charge for the tokens used on my OpenAI account?
No. You pay the service directly with your key. Tokmine's own pricing for machines and seats is unchanged.What happens if I delete a service that an endpoint still lists?
The endpoint skips it and carries on with the other hops. Open the endpoint's routing order afterwards to tidy it up.