The openai-compatible provider talks to a server that answers POST {base_url}/chat/completions
(non-streaming). The adapter holds no vendor list, no model list and no price: you give it a
base_url, the catalog entry names the model, and prices are data you declare.
A connection is named by an endpoint id that you choose (local, groq). A model is written
openai-compatible/<endpoint id>/<model>, for example openai-compatible/local/llama3.1:8b. A model’s
identity is the triple (provider, endpoint id, model): the same model name on two endpoints is two
models, each with its own approval, family and price, and a policy rule or the “require a different
model” gate for one never matches the other.
Prerequisites
Section titled “Prerequisites”- A team that already runs on the fake model, and an owner account on the server (Connect a model).
- The address of the service (
base_url) and whether it needs a key. - For a service with a key: the operator can place a key file and a binding file on the server, outside the repository.
- Check that your service is in the list: Which services are verified.
- For a service with a key, the operator writes the binding file and sets
NURAMESH_OPENAI_COMPATIBLE_KEYS: The operator key binding. - As an owner, create the connection with the service’s address: Connections and addresses.
- Declare a price for each model, also when it is US$0: Prices and the declared US$0.
Which services are verified
Section titled “Which services are verified”Each service below has one test against a fake or local server in the test suite (the request shape, the path, the answer and the usage mapping). Verified here means that test passes; it does not mean we ran a paid call against the vendor. No real model API is ever called by the tests.
| Service | Typical base_url |
Status |
|---|---|---|
| OpenAI direct | https://api.openai.com/v1 |
verified (shape) |
Ollama (needs NURAMESH_ALLOW_PRIVATE_NETWORK=1) |
http://127.0.0.1:11434/v1 |
verified (shape) |
| vLLM | http://127.0.0.1:8000/v1 |
verified (shape) |
| LM Studio | http://127.0.0.1:1234/v1 |
verified (shape) |
| llama.cpp server | http://127.0.0.1:8080/v1 |
verified (shape) |
| Hugging Face TGI, Inference Endpoints and Inference Providers | https://<endpoint>/v1, https://router.huggingface.co/v1 |
verified (shape) |
| Groq | https://api.groq.com/openai/v1 |
verified (shape) |
| Together | https://api.together.xyz/v1 |
verified (shape) |
| Google Gemini (OpenAI-compatible API) | https://generativelanguage.googleapis.com/v1beta/openai |
verified (shape); cost accuracy not verified: reasoning (“thinking”) tokens may be left out of completion_tokens, so until checked against a real account the recorded cost can be too low |
Not supported (added only if a customer asks): running models in-process (for example transformers),
AutoGen, LlamaIndex and plain LangChain chains. LangChain chat models and tools work inside a LangGraph graph.
Not in this version: streaming, tool calls and JSON mode, embeddings, image input and /responses.
Small models can be weak at tool calling. Use a stronger model for roles that call tools or verify, and
a small local model for simple work. Assign models per role (and per agent): a role’s default_model,
an agent’s model, or an admin assignment; the agent assignment beats the role default. A verifier must be
of a different declared family than the worker it checks, for any mix of providers.
Connections and addresses
Section titled “Connections and addresses”httpsis allowed to any host.httpis allowed only to the literal127.0.0.1or[::1](never the namelocalhost, never a private range) and never with a key. A user, a query or a fragment in the address is refused.- A model on this machine or your own network needs
NURAMESH_ALLOW_PRIVATE_NETWORK=1. Every outbound model call resolves the host and refuses it when any answer is private, loopback or link-local (R_PRIVATE), whatever the URL rules above accept. Set the variable to1(in the environment ofserve,run,workerand the other commands that call models) to allow it. The choice is recorded: each process that honours the variable first writes the ledger entrynetwork.private_allowed, and a process that has not written it keeps refusing. The refusal is the default and cannot be set from the team’s configuration. - A trailing
/is removed; the path is kept as written (case included). The request goes tobase_url/chat/completions. - No proxy variable is ever read and redirects are refused (credentials never go through a proxy).
Certificate checks are the library default; nothing can switch them off. For
httpsto a loopback address the certificate must verify against the system trust store or the operator’sSSL_CERT_FILE/SSL_CERT_DIR. - Hosted mode refuses this provider (
NURAMESH_HOSTED=1): a hosted variant needs an egress policy. - The organization admin is treated as the operator of the server’s network (self-hosted): the admin can aim the
server at any
httpshost it can reach, and the connection test is an admin-only reachability check.
The operator key binding
Section titled “The operator key binding”A key never comes from the API, the CLI or the ledger. The operator sets NURAMESH_OPENAI_COMPATIBLE_KEYS to
the absolute path of a binding file outside the repository (mode 0400 or 0600, owned by the server user, at most
16,384 bytes):
{"keys": {"groq": {"file": "/etc/nuramesh/groq.key", "hosts": ["api.groq.com:443"]}}}The connection holds only the key name (--auth key --key groq). Before any key file is opened the server checks
that the name exists and that the host and port actually posted to are listed; a repointed connection therefore never
carries the key to an unlisted host. A key file that is another setting’s key (the Anthropic key, the anchor key,
anything under NURAMESH_KEY_DIR) cannot be bound. A bad binding file refuses the service start with one line:
openai-compatible: the key binding file is not usable. Key files follow the same rules as other key files (outside the repository, 0400 or
0600, never readable by the agent user, read on every call and never cached). Limit: hosts binds host and port,
not a path, so on a host that puts the tenant in the path an admin can aim the key at another tenant on the same host.
Prices and the declared US$0
Section titled “Prices and the declared US$0”A missing price blocks the call. A price of exactly zero is valid only as declared free (local): USD, the source
declared free (local), and a bound_endpoint that is a literal loopback address, which the service sets from the
connection. A free price is bound to the connection as it was declared (the same address, auth and key name since that declaration). It stops applying the moment the connection is repointed, disabled or re-created; and a repoint, even one that moves the address away and back, voids it for good: the admin must declare it again, and a human re-approval of the model does not bring it back. A price
override can never be zero. A free call still reserves (0), records and passes budgets, residency, autonomy policy and
the halt switch. These are admin statements: a loopback address can be a forwarder to a paid vendor, and a tiny non-zero
rate is an ordinary price.
If a served answer has missing or invalid usage, the cost is recorded as unknown and the reservation is charged
as the upper bound (never zero); model.called shows usage: null. The Azure adapter subtracts cached tokens, this
provider charges the whole prompt at the input rate.
Residency
Section titled “Residency”A remote endpoint can only declare global processing, so it takes only synthetic data. A loopback endpoint may
declare any scope the organization permits; that is the approver’s statement.
What is retried when a call fails
Section titled “What is retried when a call fails”Only a failure that certainly processed nothing is retried: 429, 503 with a valid Retry-After, and a connection
refused before any byte was sent (at most 3 attempts, every attempt recorded as attempts in model.called). A
timeout or a reset is never retried because it could be billed twice; a request billed but never answered is the
reconciler’s incident.
Troubleshooting
Section titled “Troubleshooting”| You see | Do this |
|---|---|
openai-compatible: the key binding file is not usable at start |
The binding file is missing, too large, or has the wrong owner or mode (0400 or 0600) |
| A call is refused before the key is read | The key name does not exist in the binding file, or the host and port posted to are not in its hosts |
| A call is blocked for an unknown price | Declare the price of the model, also for a local model that costs nothing |
| A timeout was not retried | By design: a timeout or a reset could be billed twice, so it is never retried |
Next steps
Section titled “Next steps”- Local models and Connect any OpenAI-compatible server.
- Support matrix: what is tested.
- Override a price.
Was this page helpful?