How to use Darkbloom with LiteLLM

Updated · Checked with LiteLLM 1.106.2 on

Short answer: yes. LiteLLM sends any model name that starts with openai/ to an OpenAI-compatible endpoint, and Darkbloom is one. Use openai/<model-id> as the model, https://api.darkbloom.dev/v1 as api_base, and your Darkbloom key as api_key. The same three settings work in Python and in the LiteLLM proxy’s config.yaml. Darkbloom runs open-weight models on Macs and is a public alpha, so try it on a small task first.

At a glance

ItemValue
Base URLhttps://api.darkbloom.dev/v1
KeyCreated on the API console page of the Darkbloom console. LiteLLM sends it as Authorization: Bearer <key>.
BillingPrepaid credits, charged per token, with a minimum of $0.0001 per request. Minimum deposit $0.50 (Darkbloom docs).
Model name in LiteLLMopenai/<model-id>, for example openai/gemma-4-26b
Tested withLiteLLM 1.106.2 on October 22, 2026
Darkbloom statusPublic alpha (Darkbloom console)
Python3.10 or newer (LiteLLM on PyPI)

How do I use LiteLLM with Darkbloom in Python?

Call litellm.completion() with model="openai/<model-id>", api_base="https://api.darkbloom.dev/v1" and your Darkbloom key as api_key. It takes about five minutes.

  1. Get a Darkbloom API key. Open the Darkbloom console and sign in, add credits (the minimum is $0.50, and Darkbloom says credits are non-refundable and never expire), then choose API console in the console’s left menu and Create API key (Darkbloom’s docs call this page Settings → API Keys). The console shows the key only once, so copy it right away. Every key spends from your prepaid balance, so add only what you are willing to spend while you test, and watch the first runs, because a loop or a batch job can send far more requests than you expect.
  2. Install LiteLLM. It needs Python 3.10 or newer. On an older Python, pip can quietly install an old LiteLLM release without an error (LiteLLM docs), so check python --version first.
    pip install litellm
  3. Put your key in an environment variable, so it stays out of your code. Use the terminal where you will run Python:
    macOS and Linux
    export DARKBLOOM_API_KEY="YOUR_DARKBLOOM_API_KEY"
    Windows (then open a new terminal)
    setx DARKBLOOM_API_KEY "YOUR_DARKBLOOM_API_KEY"
  4. See which models you can use. Darkbloom’s model list gives each ID with its context window and prices:
    curl -s https://api.darkbloom.dev/v1/models \
      -H "Authorization: Bearer $DARKBLOOM_API_KEY"
  5. Make a request. Save this as app.py and run python app.py, with an ID from that list and the openai/ prefix:
    app.py
    import os
    import litellm
    
    response = litellm.completion(
        model="openai/gemma-4-26b",
        api_base="https://api.darkbloom.dev/v1",
        api_key=os.environ["DARKBLOOM_API_KEY"],
        messages=[{"role": "user", "content": "Say hello in five words."}],
    )
    print(response.choices[0].message.content)

Streaming and tool calls work the same way. Add stream=True to get chunks as they arrive, or pass a tools list. In our test gemma-4-26b answered a request with a tool by returning a tool call (finish_reason “tool_calls”). The Features column below shows which models Darkbloom lists with tool support.

To avoid passing api_base and api_key in every call, you can set the environment variables OPENAI_API_BASE and OPENAI_API_KEY instead, and LiteLLM uses them for every openai/ model in that process (checked). The catch is that you then cannot call OpenAI itself from the same process with the same variables.

How do I use Darkbloom through the LiteLLM proxy?

The LiteLLM proxy is a local server that speaks the OpenAI API and forwards requests to the models in its config.yaml. Use it when several apps or tools should share one Darkbloom key and one URL. Add Darkbloom to the config, start the proxy, and point any OpenAI-compatible client at it. You need a Darkbloom key from step 1 above.

  1. Install LiteLLM with the proxy extras.
    pip install "litellm[proxy]"
  2. Create a config file named config.yaml, with one entry per model. model_name is the name your apps will ask for, and you can choose it freely. os.environ/DARKBLOOM_API_KEY makes LiteLLM read the key from that environment variable, so the key is not written in the file.
    config.yaml
    model_list:
      - model_name: darkbloom-gemma
        litellm_params:
          model: openai/gemma-4-26b
          api_base: https://api.darkbloom.dev/v1
          api_key: os.environ/DARKBLOOM_API_KEY
  3. Set two environment variables in the terminal that will run the proxy: your Darkbloom key, and a master key that your apps will use to call the proxy. Make up a long random string that starts with sk-, and keep a copy, because your apps need it.
    macOS and Linux
    export DARKBLOOM_API_KEY="YOUR_DARKBLOOM_API_KEY"
    export LITELLM_MASTER_KEY="sk-$(openssl rand -hex 16)"
    Windows (then open a new terminal)
    setx DARKBLOOM_API_KEY "YOUR_DARKBLOOM_API_KEY"
    setx LITELLM_MASTER_KEY "sk-YOUR_LONG_RANDOM_STRING"
  4. Start the proxy. It listens on port 4000. --host 127.0.0.1 makes it reachable from your own computer only.
    litellm --config config.yaml --host 127.0.0.1
  5. Call it as you would call OpenAI, with the master key as the API key and your model_name as the model:
    curl
    curl http://127.0.0.1:4000/v1/chat/completions \
      -H "Authorization: Bearer $LITELLM_MASTER_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "model": "darkbloom-gemma",
        "messages": [{"role": "user", "content": "Say hello in five words."}]
      }'
    OpenAI Python library
    import os
    from openai import OpenAI
    
    client = OpenAI(base_url="http://127.0.0.1:4000/v1", api_key=os.environ["LITELLM_MASTER_KEY"])
    reply = client.chat.completions.create(
        model="darkbloom-gemma",
        messages=[{"role": "user", "content": "Say hello in five words."}],
    )
    print(reply.choices[0].message.content)

Any other tool that takes a base URL and a key can use the proxy as well: give it http://127.0.0.1:4000/v1 and the master key, and ask for your model_name.

Which Darkbloom model should I use with LiteLLM?

Use any ID that GET /v1/models returns. On October 23, 2026 it listed 12 models, shown here from the cheapest output price up, in US dollars per million tokens. Check the live prices before you rely on a number; that public list also names models that are not online. A key can be limited to some models, and Darkbloom refuses any other with a 403 (see the errors table).

Model IDContext window, tokensInput, $ per million tokensOutput, $ per million tokensFeatures Darkbloom lists
gpt-oss-20b131,072$0.018$0.09none listed
nvidia-nemotron-3.5-lightning262,144$0.025$0.12tools, reasoning
EigenLabs/Ternary-Bonsai-2-9B-MLX-2bit262,144$0.08$0.13tools, reasoning
Qwen3.5-9B262,144$0.08$0.13tools, image input
glm-5.3-flash262,144$0.065$0.18tools, reasoning, image input
gemma-4-26b131,072$0.042$0.22tools, reasoning, json mode, image input
mimo-v2.6-flash-mopd1,048,576$0.10$0.28tools, reasoning
nvidia-nemotron-3.5-super262,144$0.075$0.35tools, reasoning, json mode, image input
ternary-bonsai-2-27b262,144$0.075$0.50tools, reasoning, image input
qwen3.6-35b-a3b-vl-mtp-mxfp8262,144$0.05$0.70tools, image input
qwen3.5-35b-a3b262,144$0.065$0.75tools, image input
EigenLabs/Qwen3.8-27B-4bit-mtp262,144$0.035$2.20tools, image input

In the proxy, apps ask for the model_name from your config, such as darkbloom-gemma, and not for Darkbloom’s ID. To offer another model, add another entry with its own model_name and model: openai/<model-id>.

Can one proxy entry cover every Darkbloom model?

Yes, with a wildcard entry (LiteLLM docs). This one sends any model name that starts with darkbloom/ to Darkbloom and uses the rest of the name as the model ID, so darkbloom/gemma-4-26b reaches gemma-4-26b:

config.yaml
model_list:
  - model_name: "darkbloom/*"
    litellm_params:
      model: "openai/*"
      api_base: https://api.darkbloom.dev/v1
      api_key: os.environ/DARKBLOOM_API_KEY

This works for any ID Darkbloom serves, including IDs that contain a slash, such as darkbloom/EigenLabs/Qwen3.8-27B-4bit-mtp. A key limited to some models still gets the 403 for the others. One thing does not work well: the proxy’s own /v1/models does not list Darkbloom’s models. With this entry it listed 211 names that start with darkbloom/ and are OpenAI model names, and none of Darkbloom’s. An app that fills its model menu from the proxy would show those, so type the model name yourself, or use one named entry per model as in the config above.

How much does LiteLLM cost with Darkbloom, and what will it report?

LiteLLM adds no charge. Darkbloom bills the tokens you use from your prepaid balance: (input tokens × input price + output tokens × output price) ÷ 1,000,000, with a minimum of $0.0001 per request. At the October 23, 2026 prices, a request with 1,000 tokens in and 200 out is worth $0.000086 on gemma-4-26b, so Darkbloom bills the $0.0001 minimum, while 20,000 tokens in and 2,000 out costs about $0.00128. Because of the minimum, 10,000 small requests cost at least $1.00 on any model. Each of our small test requests was billed exactly $0.0001 in Darkbloom’s usage log.

To give the proxy the prices, add model_info to the entry (these are the October 23, 2026 list prices for gemma-4-26b, in dollars per token). The proxy then reports the estimate for each response in the x-litellm-response-cost header. The entry below also sets max_tokens, which the next paragraph explains:

config.yaml
model_list:
  - model_name: darkbloom-gemma
    litellm_params:
      model: openai/gemma-4-26b
      api_base: https://api.darkbloom.dev/v1
      api_key: os.environ/DARKBLOOM_API_KEY
      max_tokens: 500
    model_info:
      input_cost_per_token: 0.000000042
      output_cost_per_token: 0.00000022

In Python, pass the same numbers with a call and read the estimate from the response:

response = litellm.completion(
    model="openai/gemma-4-26b",
    api_base="https://api.darkbloom.dev/v1",
    api_key=os.environ["DARKBLOOM_API_KEY"],
    messages=[{"role": "user", "content": "Say hello in five words."}],
    max_tokens=500,
    input_cost_per_token=0.000000042,
    output_cost_per_token=0.00000022,
)
print(response._hidden_params["response_cost"])

LiteLLM sends no max_tokens unless you set one (in a call, or in litellm_params for every request through the proxy, as above). Without it Darkbloom adds 8192 (Darkbloom docs) and reserves balance for the whole amount while the request runs, so a limit that fits your use keeps that reservation small.

How do I keep my API keys out of my code?

Export DARKBLOOM_API_KEY in the terminal that runs Python or the proxy, as in the steps above. Read it with os.environ in code and os.environ/DARKBLOOM_API_KEY in config.yaml. LiteLLM also loads a .env file, but only if it finds one, and where it looks depends on where LiteLLM is installed. In our test it found .env in the project folder when the virtual environment was inside that folder (python -m venv .venv), and it did not find it when LiteLLM was installed somewhere else. Exporting the variables works in both cases.

If you do use a .env file, add it to .gitignore so the keys are never committed.

echo ".env" >> .gitignore

What do the common errors mean?

These are the messages you are most likely to see, with what causes each and the fix. All but the empty-balance row were reproduced with LiteLLM 1.106.2. Through the proxy, an error from Darkbloom arrives as an HTTP error with LiteLLM’s text inside.

What you seeCauseFix
BadRequestError ... LLM Provider NOT provided ... You passed model=gemma-4-26bThe model name has no openai/ prefix, so LiteLLM does not know where to send it. In a proxy config, LiteLLM logs this when it starts, and your app later gets There are no healthy deployments for this model.Use openai/gemma-4-26b.
NotFoundError ... OpenAIException - 404 page not foundThe base URL does not end at /v1. LiteLLM adds the endpoint path itself.Use exactly https://api.darkbloom.dev/v1 as api_base.
AuthenticationError ... invalid API keyDarkbloom does not accept the key. This is the text its API returns for a wrong key.Copy the key again in full, without quotes or spaces, or create a new key in the console.
APIError ... this API key is not permitted to use model "..." (proxy: HTTP 403)Darkbloom answered 403 model_not_allowed. Either the key has an Allowed models list that does not include this model, or the ID is not a real one: Darkbloom gives the same answer for an ID that does not exist. The proxy retries twice before it answers, so the error took about six seconds to arrive in our test.Check the ID letter for letter against GET /v1/models. If it is listed, open the key on the console’s API console page, choose Edit, and add the model to Allowed models, or leave that list blank to allow every model.
APIError ... another message, or HTTP 403 with no model namedIf your balance is too low, Darkbloom answers 403 (Darkbloom docs: insufficient balance), and every request fails the same way.Add credits in the console under Billing.
InternalServerError ... Missing credentials. Please pass an api_key (proxy: HTTP 500)The proxy did not find DARKBLOOM_API_KEY, because it is not set in the terminal that started the proxy. LiteLLM retries twice before it answers.Export the variable in that terminal and start the proxy again.
LiteLLM proxy refused to start: no master key is setThe proxy would otherwise accept every request without a password.Set LITELLM_MASTER_KEY in the terminal that starts the proxy.
LiteLLM proxy refused to start: the master key is a publicly known defaultLiteLLM 1.106.2 does not accept sk-1234, the example key in LiteLLM’s docs.Use your own random string that starts with sk-.
HTTP 400 No connected db. when you call the proxyThe key your app sent is not the master key. LiteLLM checks other keys against a database, and this setup has none. With no key at all, the proxy answers HTTP 500 Internal Server Error.Send the value of LITELLM_MASTER_KEY as the API key, in the header Authorization: Bearer <master key>.
HTTP 400 Invalid model name passed in model=gemma-4-26bYour app asked the proxy for a name that is not a model_name in config.yaml. The proxy knows its own names, not Darkbloom’s IDs.Ask for your model_name, such as darkbloom-gemma, or add an entry with that name.
WARNING ... register_model: model=openai/gemma-4-26b has custom pricing but not in built-in cost mapLiteLLM prints this when you add model_info prices for a model it does not know.Harmless. The prices are used.

Is Darkbloom private, and is it ready for production?

Not yet for sensitive work. Darkbloom’s quickstart calls the service “an experimental research prototype” and says not to use it in production applications, and its console labels it Public alpha. Darkbloom says prompts are encrypted to a verified provider Mac. Its security overview says the coordinator re-encrypts each request for the chosen provider and runs in a confidential VM. An independent review by Wavect (September 2026) reads Darkbloom’s technical documentation as saying that both the coordinator and the provider handle your prompt as plaintext inside protected boundaries.

LiteLLM sends the messages you give it to Darkbloom. If you turn on LiteLLM’s logging or callbacks, those can store your prompts too. Do not send secrets, customer data or code you are not allowed to share.

How this guide was checked

About this guide

BloomGauge is a free Mac app for people who run Darkbloom providers, so we benefit when Darkbloom has more paying demand. We are independent of Darkbloom and not endorsed by it. Our Darkbloom sign-in links carry our referral code, BLOOMGAUGE. If you sign in to Darkbloom after opening one, Darkbloom attaches the code to your account and pays us a share of your eligible token spend. Darkbloom funds that reward, so it does not change your price.

Sources

Found something out of date? Tell us in #bloomgauge on the Darkbloom Slack or at Support.