Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ Works in Cursor, Cline, Continue and OpenClaw through the OpenAI-compatible endp
| [`curl/models.sh`](curl/models.sh) | List the models your key can call |
| [`cursor/README.md`](cursor/README.md) | Cursor, Cline and Continue settings |
| [`ollama-on-rented-gpu/README.md`](ollama-on-rented-gpu/README.md) | Calling Ollama or vLLM on a GPU you rented, via its public HTTPS endpoint |
| [`ollama-open-webui/README.md`](ollama-open-webui/README.md) | Open WebUI on your laptop connected to Ollama, locally or on a rented GPU |
| [`openai-compatible-api-quickstart/README.md`](openai-compatible-api-quickstart/README.md) | The OpenAI-compatible API from curl, the `openai` Python package and Aider |
| [`vllm-openai-server/README.md`](vllm-openai-server/README.md) | Serving a model with vLLM's OpenAI-compatible server on a Raw GPU instance, reached over SSH |

## Setup

Expand Down
117 changes: 117 additions & 0 deletions ollama-open-webui/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
# How do I connect Open WebUI to a remote Ollama server?

Set Open WebUI's `OLLAMA_BASE_URL` to the remote server's URL when you start it; Open WebUI then lists and chats with the models on that server instead of a local one ([Open WebUI README](https://github.com/open-webui/open-webui#readme), read 2026-10-27).

Updated 2026-10-27

This folder shows two ways to run it:

- **A. Everything on your own machine** (local Ollama + local Open WebUI).
- **B. Ollama on a rented GPU, Open WebUI on your laptop**, for models that don't fit your local VRAM.
VRAM need depends on model, precision and workflow; see [How much VRAM do I need to run an LLM?](https://cloudgpu.app/guides/how-much-vram-do-i-need-to-run-an-llm).

## A. Local: Ollama + Open WebUI on one machine

1. Install Ollama (Linux, official script):

```bash
curl -fsSL https://ollama.com/install.sh | sh
ollama pull qwen2.5:0.5b
```

2. Start Open WebUI with Docker (official command from the Open WebUI README):

```bash
docker run -d -p 3000:8080 --add-host=host.docker.internal:host-gateway \
-v open-webui:/app/backend/data --name open-webui --restart always \
ghcr.io/open-webui/open-webui:main
```

Or without Docker (also from the README):

```bash
pip install open-webui
open-webui serve
```

3. Open `http://localhost:3000` (Docker) or the address `open-webui serve` prints.

## B. Remote: Ollama on CloudGPU, Open WebUI on your laptop

### B1. Start an Ollama instance

1. Go to [Deploy](https://cloudgpu.app/deploy?utm_source=github&utm_medium=referral&utm_campaign=202611_seg05_localllm&utm_content=gh_ex_owui), pick the **Ollama** template and a card (we offer the RTX 5090 and the other cards listed on [/pricing](https://cloudgpu.app/pricing)), and click Deploy. The instance is billed per minute (see [/terms](https://cloudgpu.app/terms)).
2. In your Dashboard, open the instance and click **API**. Your endpoint looks like
`https://<random-id>-i.cloudgpu.app` (replace `<random-id>` with the id on your instance row).
3. Check it answers (the request from our [docs](https://cloudgpu.app/docs)):

```bash
curl https://<random-id>-i.cloudgpu.app/api/chat \
-H "Content-Type: application/json" \
-d '{"model": "qwen2.5:0.5b", "messages": [{"role": "user", "content": "Hello"}], "stream": false, "keep_alive": "30m"}'
```

`keep_alive` keeps the model loaded between requests; Ollama unloads idle models after 5 minutes by default.

### B2. Point Open WebUI at it

Use the README's "Ollama on a different server" form with your endpoint:

```bash
docker run -d -p 3000:8080 \
-e OLLAMA_BASE_URL=https://<random-id>-i.cloudgpu.app \
-v open-webui:/app/backend/data --name open-webui --restart always \
ghcr.io/open-webui/open-webui:main
```

Without Docker: `OLLAMA_BASE_URL=https://<random-id>-i.cloudgpu.app open-webui serve`.

Open `http://localhost:3000`. Per the Open WebUI README, it then uses the Ollama server at that URL, so the models on the instance should show up in the model picker. We haven't run this exact pairing ourselves; if the list is empty, run the B1 curl check again.

### B3. Pull a bigger model

Our [docs](https://cloudgpu.app/docs) say the Ollama template supports any model in the Ollama library: use the **Pick Model** button on the instance to pull one. Pick a model that fits the card's VRAM.

### B4. When you're done

Destroy the instance from the Dashboard. Billing stops when you destroy the instance (see [/terms](https://cloudgpu.app/terms)).

## Option: Raw GPU instead of the Ollama template

If you want your own Ollama version or extra tools, pick **Raw GPU** on Deploy (JupyterLab + CUDA pre-installed, SSH access). Check the environment first, then install Ollama with the official script:

```bash
nvidia-smi
nvcc --version
curl -fsSL https://ollama.com/install.sh | sh
OLLAMA_HOST=127.0.0.1:11434 ollama serve &
ollama pull qwen2.5:0.5b
```

Reach it from your laptop through an SSH tunnel, then use `OLLAMA_BASE_URL=http://host.docker.internal:11434` (Docker) or `http://127.0.0.1:11434` (pip):

```bash
ssh -N -L 11434:127.0.0.1:11434 <user>@<instance-ssh-host> -p <port>
```

Use the SSH user, host and port from your instance. We haven't checked this tunnel on a Raw GPU instance; Ollama's docs say it binds `127.0.0.1:11434` by default, which is what the tunnel forwards.

## FAQ

**How do I connect Open WebUI to a remote Ollama server?**
Start Open WebUI with `OLLAMA_BASE_URL` set to the remote server's URL, for example `-e OLLAMA_BASE_URL=https://<random-id>-i.cloudgpu.app` in the Docker command.

**Do I need a GPU on my laptop to use Open WebUI?**
No. Open WebUI is the interface; the model runs wherever Ollama runs. In option B that is the rented GPU.

**Which GPU should I rent for my model?**
VRAM need depends on model, precision and workflow. See [How much VRAM do I need to run an LLM?](https://cloudgpu.app/guides/how-much-vram-do-i-need-to-run-an-llm) and the cards on [/pricing](https://cloudgpu.app/pricing).

**How is the rented GPU billed?**
Billed per minute, rounded up, 1-minute minimum. Billing stops when you destroy the instance (see [/terms](https://cloudgpu.app/terms)).

## Sources (read 2026-10-27)

- Open WebUI README: install and `OLLAMA_BASE_URL` commands. Open WebUI is under the Open WebUI License; this folder only links to it and does not redistribute it.
- Ollama Linux install docs (`docs/linux.mdx` in the Ollama repo).
- CloudGPU [/docs](https://cloudgpu.app/docs) and [/deploy](https://cloudgpu.app/deploy).
159 changes: 159 additions & 0 deletions openai-compatible-api-quickstart/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
# How do I call CloudGPU's OpenAI-compatible API from curl, Python or a coding agent?

Send requests to `https://cloudgpu.app/v1` with an `Authorization: Bearer` header carrying your `cgw-sk-` key; existing OpenAI SDK code only needs a new `base_url` and key (CloudGPU /api/docs, read 2026-10-27).

Updated 2026-10-27

This folder has three small, copy-paste examples:

- **A. curl**: one chat request and the model list.
- **B. Python**: the official OpenAI Python SDK, normal and streaming.
- **C. Aider**: the terminal coding agent, pointed at the same endpoint.

Model ids are listed on the [CloudGPU AI API page](https://cloudgpu.app/api?utm_source=github&utm_medium=referral&utm_campaign=202611_seg04_codingagent&utm_content=gh_ex_api). The examples use `deepseek-v4-flash`, the model in the /api/docs examples; swap in any chat model id from that table or from `GET /v1/models`.

## 0. Get a key

1. Sign in at cloudgpu.app, open the API Console (cloudgpu.app/api/console) and create a key. Copy the `cgw-sk-...` value: it is shown once. CloudGPU stores only a hash of it, so if you lose it, create a new one.
2. Add balance on the [Billing](https://cloudgpu.app/billing) page. API calls are paid from your balance (the same balance GPU rentals use).
3. Put the key in an environment variable, so it stays out of your code and your git history:

```bash
export CLOUDGPU_API_KEY="cgw-sk-..."
```

## A. curl

### A1. Chat completion

The request from /api/docs:

```bash
curl https://cloudgpu.app/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $CLOUDGPU_API_KEY" \
-d '{
"model": "deepseek-v4-flash",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Say hi in one sentence."}
]
}'
```

/api/docs says the response has the same shape as OpenAI's chat completion, so the text is in `choices[0].message.content`.

For streaming, add `"stream": true` to the body; the response is Server-Sent Events in the OpenAI-compatible streaming format.

### A2. List models

```bash
curl https://cloudgpu.app/v1/models \
-H "Authorization: Bearer $CLOUDGPU_API_KEY"
```

Use an `id` from this list as `model`. An id that isn't in the catalog returns `400 model_not_found`.

### A3. Check your setup without spending anything

Without the header you get a 401 (checked 2026-10-27):

```bash
curl -s https://cloudgpu.app/v1/models
# {"error":{"type":"authentication_error","code":"missing_authorization","message":"Provide an Authorization: Bearer <api_key> header."}}
```

If you see `invalid_api_key` instead, the key is wrong or revoked.

## B. Python (official OpenAI SDK)

CloudGPU doesn't ship its own SDK; the OpenAI SDK works with a `base_url` override (/api/docs). According to the official `openai` docs on PyPI ([pypi.org/project/openai](https://pypi.org/project/openai/), read 2026-10-27), the SDK installs with `pip install openai` and needs Python 3.10 or later. The examples below use the 1.x-style client, so install at least 1.0:

```bash
pip install "openai>=1.0"
```

`quickstart.py`:

```python
import os
from openai import OpenAI

client = OpenAI(
api_key=os.environ["CLOUDGPU_API_KEY"], # cgw-sk-... from the API Console
base_url="https://cloudgpu.app/v1",
)

resp = client.chat.completions.create(
model="deepseek-v4-flash",
messages=[{"role": "user", "content": "Say hi."}],
)
print(resp.choices[0].message.content)
print(f"Used {resp.usage.total_tokens} tokens")
```

`stream.py` (same client, `stream=True`):

```python
for chunk in client.chat.completions.create(
model="deepseek-v4-flash",
messages=[{"role": "user", "content": "Count to 5."}],
stream=True,
):
delta = chunk.choices[0].delta.content
if delta:
print(delta, end="", flush=True)
```

Use `client.chat.completions` as above. The /api/docs endpoint list has `POST /v1/chat/completions` and no Responses endpoint, so don't rely on `client.responses.create`; we haven't checked what it returns.

## C. Aider (terminal coding agent)

According to the official Aider docs ([OpenAI compatible APIs](https://aider.chat/docs/llms/openai-compat.html), read 2026-10-27), Aider "can connect to any LLM which is accessible via an OpenAI compatible API endpoint": set `OPENAI_API_BASE` and `OPENAI_API_KEY`, then prefix the model name with `openai/`.

```bash
python -m pip install aider-install
aider-install

export OPENAI_API_BASE=https://cloudgpu.app/v1
export OPENAI_API_KEY=$CLOUDGPU_API_KEY

cd /to/your/project
aider --model openai/deepseek-v4-flash
```

On Windows the Aider docs use `setx OPENAI_API_BASE <endpoint>` and `setx OPENAI_API_KEY <key>`, then a new shell. Aider may print a model warning for model names it doesn't know; the docs cover this in their model warnings section. We haven't run Aider against every model; try a small edit first.

## Errors you may see

Errors follow the OpenAI-compatible shape: HTTP status plus `{ "error": { "type", "code", "message" } }` (/api/docs).

| Status | code | What to do |
|---|---|---|
| 401 | `missing_authorization` | Add the `Authorization: Bearer $CLOUDGPU_API_KEY` header. |
| 401 | `invalid_api_key` | Key unknown or revoked: create a new one in the API Console. |
| 400 | `model_not_found` | Use an id from `GET /v1/models`. |
| 402 | `insufficient_balance` | Add balance under Billing. |
| 429 | `rate_limit_exceeded` | Per-minute or per-day limit hit; wait and retry. |
| 503 | `upstream_not_configured` | The model is temporarily unavailable; retry later or use another model. |

## FAQ

**What is the base URL for the CloudGPU API?**
`https://cloudgpu.app/v1`. Chat requests go to `POST /v1/chat/completions` and the model list is `GET /v1/models`.

**Do I need a special SDK?**
No. Use the official OpenAI Python or Node.js SDK and set `base_url` (Python) or `baseURL` (Node) to `https://cloudgpu.app/v1`, with your `cgw-sk-` key as the API key.

**Which model id should I use?**
Any id from `GET /v1/models` or the table on cloudgpu.app/api. The examples here use `deepseek-v4-flash`, the id used in the /api/docs examples.

**How do I use it with a coding agent such as Aider?**
Point the agent's OpenAI-compatible base URL at `https://cloudgpu.app/v1` and use your key. For Aider that is `OPENAI_API_BASE` and `OPENAI_API_KEY`, then `aider --model openai/<model-id>`.

## Sources (read 2026-10-27)

- CloudGPU /api/docs: base URL, `Authorization: Bearer` header, endpoint list, curl / Python / streaming examples, error codes.
- CloudGPU /api: OpenAI-compatible endpoint description and model table.
- Official Aider docs, ["OpenAI compatible APIs"](https://aider.chat/docs/llms/openai-compat.html): `OPENAI_API_BASE`, `OPENAI_API_KEY`, `openai/` model prefix, install commands.
- Official `openai` docs on PyPI ([pypi.org/project/openai](https://pypi.org/project/openai/), read 2026-10-27): install command, Python 3.10+ requirement.
Loading