Quickstart

Point any OpenAI-compatible client at PGAIN, drop in your pgain_ key, and you're governed. Create a key in Settings first. Base URL: https://api.hiluxsoft.cloud/v1.

Hermes Agent

Hermes is the PGAIN-native gateway — the fastest path to a governed agent, since it ships wired for PGAIN out of the box.

1. Install

On the VPS, Hermes is already running and preconfigured — you can skip straight to testing. For a fresh node, clone the gateway repo and select the PGAIN profile so requests route through the governance layer:

git clone https://github.com/hiluxsoft/hermes-gateway.git
cd hermes-gateway
./hermes profile use pgain

2. Configure

Set the base URL and your key in the gateway environment. Every model call Hermes makes will now be cost-capped and audited:

export PGAIN_BASE_URL=https://api.hiluxsoft.cloud/v1
export PGAIN_API_KEY=pgain_...

3. Test

Fire a quick completion to confirm the gateway is talking to PGAIN:

curl https://api.hiluxsoft.cloud/v1/chat/completions \
  -H "Authorization: Bearer pgain_..." \
  -H "Content-Type: application/json" \
  -d '{"model":"openrouter/openai/gpt-4o-mini","messages":[{"role":"user","content":"ping"}]}'

Troubleshooting

  • 401 Unauthorized — your pgain_ key was revoked or has a typo. Re-issue one in Settings.
  • 412 Precondition Failed — no upstream provider key is configured. Add one in Settings before routing live traffic.

Cline (VS Code)

Cline is an open-source coding agent for VS Code that speaks the OpenAI protocol, so it drops onto PGAIN with zero forks.

1. Install

Open the Extensions panel in VS Code, search for Cline, and install it from the marketplace. Reload the window when prompted.

2. Configure

Open Cline's settings and pick the OpenAI Compatible provider, then fill in:

  • Base URL: https://api.hiluxsoft.cloud/v1
  • API Key: pgain_...
  • Model ID: openrouter/anthropic/claude-3.5-sonnet

3. Test

Open the Cline sidebar and ask it to "write a hello world in python". You should see a streamed plan and a diff you can apply.

Troubleshooting

  • Model not found — confirm the model ID against GET /v1/models; provider prefixes matter.
  • Empty replies — make sure a matching provider key is enabled in Settings for that model's provider.

Aider (terminal)

Aider is a terminal pair-programmer that edits your local git repo, and it honors the standard OpenAI environment variables.

1. Install

Install via the bundled installer (recommended) or straight from PyPI:

python -m pip install aider-install && aider-install
# or
pip install aider-chat

2. Configure

Export the OpenAI-compatible variables, then launch Aider with a PGAIN model id:

export OPENAI_API_BASE=https://api.hiluxsoft.cloud/v1
export OPENAI_API_KEY=pgain_...
aider --model openai/openrouter/openai/gpt-4o-mini

3. Test

Run aider inside a git repository and ask for a change, e.g. "add a docstring to main.py". Aider proposes an edit and commits it for you.

Troubleshooting

  • Auth errors — the env vars didn't carry into your shell; re-export OPENAI_API_BASE and OPENAI_API_KEY.
  • Cost cap hit — you've reached the daily $5 cap; review usage on the dashboard or raise the limit in Settings.

Cursor

Cursor is an AI-first code editor that lets you override the OpenAI endpoint, so you can route its chat through PGAIN.

1. Install

Download and install Cursor from cursor.com, then sign in and open any project.

2. Configure

Go to Settings → Models, enable Override OpenAI Base URL, and set it to https://api.hiluxsoft.cloud/v1. Paste a pgain_... key and add a custom model id such as openrouter/openai/gpt-4o-mini.

3. Test

Press Cmd-K in the editor and request an inline edit. A governed completion flows back through PGAIN.

Troubleshooting

  • Verify button fails — Cursor's verify probe may hit an endpoint PGAIN doesn't expose; ignore it and just use chat/Cmd-K, which work fine.
  • 412 Precondition Failed — add a provider key in Settings so the model has an upstream to call.

Continue (VS Code / JetBrains)

Continue is an open-source autopilot for VS Code and JetBrains that's configured with a simple JSON file.

1. Install

Install the Continue extension from the VS Code marketplace or JetBrains plugin registry.

2. Configure

Edit ~/.continue/config.json and add a model entry that points at PGAIN:

{
  "models": [
    {
      "title": "PGAIN gpt-4o-mini",
      "provider": "openai",
      "apiBase": "https://api.hiluxsoft.cloud/v1",
      "apiKey": "pgain_...",
      "model": "openrouter/openai/gpt-4o-mini"
    }
  ]
}

3. Test

Open the Continue sidebar, select the PGAIN model, and send a chat message to confirm responses come back.

Troubleshooting

  • Config not picked up — reload the editor window so Continue re-reads config.json.
  • 401 Unauthorized — double-check the apiKey value; it must be a live pgain_ key.

Any OpenAI SDK

If your client speaks OpenAI, it speaks PGAIN — just override the base URL and key. Here it is in Python and curl.

1. Install

Use the official SDK for your language, e.g. pip install openai for Python.

2. Configure

Point the client at PGAIN and use your key:

from openai import OpenAI

client = OpenAI(
    api_key="pgain_...",
    base_url="https://api.hiluxsoft.cloud/v1"
)

response = client.chat.completions.create(
    model="openrouter/openai/gpt-4o-mini",
    messages=[{"role": "user", "content": "Hello"}]
)

Or with plain curl:

curl https://api.hiluxsoft.cloud/v1/chat/completions \
  -H "Authorization: Bearer pgain_..." \
  -H "Content-Type: application/json" \
  -d '{"model":"openrouter/openai/gpt-4o-mini","messages":[{"role":"user","content":"Hello"}]}'

Streaming works exactly as upstream — pass stream=True (or "stream": true in curl) to receive server-sent token deltas.

3. Test

Run the Python snippet above; a successful run prints a chat completion object with a governed response.

Troubleshooting

  • 412 Precondition Failed — no provider key is configured for the requested model; add one in Settings.
  • 402 Payment Required — the daily cost cap has been reached; review spend or raise the cap on the dashboard.