Local LLM Inference on COSMA
COSMA now has an experimental local AI service, giving users access to open-weight LLMs for basic chat use and agentic coding.
Signing Up
To request access to the LLM service, first establish an SSH tunnel to b119:9999. This is where the web interface is currently hosted, but is subject to change.
Use the following:
ssh -L localhost:9999:b119:9999 USER@login8a.cosma.dur.ac.uk
where USER is your COSMA username, then point your web browser to http://localhost:9999 to connect to the web interface.
Register for an account using your university email address, and someone from cosma support will add you to the user group.
Usage
Chat
Once you have an account, Open-WebUI works similarly to commercial AI chats like ChatGPT and Claude. Before sending a message, however, you may select which model you’d like a response from.
As we are currently in a testing phase of the service, available models change frequently, and the hardware they run on may also change. If you have feedback on any of the models you use, please pass it on to the cosma-support inbox, as it would be useful to know what works well and what does not.
Agentic
Open-WebUI can also replace commercial inference servers in agentic coding tools such as Claude Code.
Firstly, to access Open-WebUI’s API, you require an API key. This can be generated by logging into the interface, opening the “settings” panel (bottom left), then selecting Profile -> Account. At the bottom of the Account page, there is an “API keys” section. Click the “Show” button on the right-hand-side, and you will have the option of creating a key. You can copy this key to set as an environment variable later.

Claude Code
To use Claude Code, set the following environment variables:
export ANTHROPIC_BASE_URL="http://localhost:9999/api"
export ANTHROPIC_AUTH_TOKEN=“MY_API_KEY"
export ANTHROPIC_MODEL="Qwen_Qwen3-32B-Q5_K_M.gguf"
export ANTHROPIC_SMALL_FAST_MODEL="Qwen_Qwen3-32B-Q5_K_M.gguf"
Replace Qwen_Qwen3-32B-Q5_K_M.gguf with any name available in the model selection menu on the interface, make sure it matches exactly.
Then, you should be able to run claude --model <model-name>
OpenCode
OpenCode is much more configurable when it comes to using multiple models and back-ends. Once installed, you can edit the configuration file in ~/.config/opencode/opencode.json.
Below is a sample configuration file, copy this and edit according to what is currently available, using your own API key generated before:
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"open-webui": {
"npm": "@ai-sdk/openai-compatible",
"name": "Open-WebUI",
"options": {
"baseURL": "http://localhost:9999/api",
"apiKey": "API_KEY"
},
"models": {
"unsloth/GLM-4.7-Flash": {
"name": "GLM-4.7-Flash"
},
"Qwen_Qwen3-32B-Q5_K_M.gguf": {
"name": "Qwen3-32B"
}
}
}
}
}
Once configured, you should be able to select these models from the OpenCode interface. See here for more information on configuring OpenCode