# How to serve with Ollama in Production

## Environment Variables Recap

The following lists the environment variables to consider prior to hosting and selecting your cloud compute services.

<details>

<summary>List</summary>

* CUDA\_VISIBLE\_DEVICES
* GPU\_DEVICE\_ORDINAL
* HIP\_VISIBLE\_DEVICES
* HSA\_OVERRIDE\_GFX\_VERSION
* HTTPS\_PROXY
* HTTP\_PROXY
* NO\_PROXY
* OLLAMA\_CONTEXT\_LENGTH=4096
* OLLAMA\_DEBUG=INFO
* OLLAMA\_FLASH\_ATTENTION=false
* OLLAMA\_GPU\_OVERHEAD=0
* OLLAMA\_HOST=<http://0.0.0.0:11434>
* OLLAMA\_INTEL\_GPU=false
* OLLAMA\_KEEP\_ALIVE=15m0s
* OLLAMA\_KV\_CACHE\_TYPE
* OLLAMA\_LLM\_LIBRARY
* OLLAMA\_LOAD\_TIMEOUT=5m0s
* OLLAMA\_MAX\_LOADED\_MODELS=0
* OLLAMA\_MAX\_QUEUE=512
* OLLAMA\_MODELS=/root/.ollama/models
* OLLAMA\_MULTIUSER\_CACHE=false
* OLLAMA\_NEW\_ENGINE=false
* OLLAMA\_NOHISTORY=false
* OLLAMA\_NOPRUNE=false
* OLLAMA\_NUM\_PARALLEL=1
* OLLAMA\_ORIGINS=\[<http://localhost> <https://localhost> <http://localhost:\\>\* <https://localhost:\\>\* <http://127.0.0.1> <https://127.0.0.1> <http://127.0.0.1:\\>\* <https://127.0.0.1:\\>\* <http://0.0.0.0> <https://0.0.0.0> <http://0.0.0.0:\\>\* <https://0.0.0.0:\\>\* app\://\* file://\* tauri://\* vscode-webview://\* vscode-file://\*]
* OLLAMA\_REMOTES=\[ollama.com]
* OLLAMA\_SCHED\_SPREAD=false
* ROCR\_VISIBLE\_DEVICES
* http\_proxy
* https\_proxy
* no\_proxy

</details>

## Load-balancing your weights

To ensure the persisted model won't consume all your compute resources over night, ensure to set this correctly:&#x20;

OLLAMA\_KEEP\_ALIVE=15m0s


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://whoamimi.gitbook.io/blog/ai-ml-and-data-science-development/deep-neural-network-servers-for-local-hosting-or-prod/serving-ollama-in-production.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
