u. underpin.optimiseDEVELOPER DOCS / FREE BETAGet API key ↗
BUILD / HOSTED API

Set up your tools

Pick your tool. Connect once. Use Optimise in your existing workflow.

First get your free API key. Every setup calls the same API and receives a text field to pass to your model.

POSThttps://underpin-optimise-api.westernroseglobal.workers.dev/v1/compress

n8n

  1. Add an HTTP Request node before your AI/model node. Set method POST and the URL above.
  2. Select Generic Credential Type → Header Auth. Create a credential with name Authorization and value Bearer YOUR_API_KEY.
  3. Enable Send Body. Choose JSON → Using JSON. Paste this test body:
JSON
{
  "text": "Payment is due in 30 days. Delivery is on Tuesday.",
  "query": "When is payment due?",
  "ratio": 5,
  "guarded": true
}

Execute the node. Its JSON output should contain text. Map {{ $json.text }} into the next model node’s context field. Keep “Include Response Headers and Status” off for this mapping.

For real inputs, switch the JSON body to expression mode and use this object, replacing the incoming field names to match your workflow:

JavaScript
{{ { text: $json.documentText, query: $json.question, ratio: 5, guarded: true } }}

Use the credential store, not a key embedded in the workflow. n8n HTTP Request documentation ↗

Make

  1. Add HTTP → Make a request (HTTP version 4). Set method POST and the URL above.
  2. Choose API key authentication. In Credentials, create a keychain: key Bearer YOUR_API_KEY, placement In the header, parameter name Authorization.
  3. Choose application/JSON for Body content type. Use Data structure with the fields below.
FieldTypeFirst test value
textTextPayment is due in 30 days. Delivery is on Tuesday.
queryTextWhen is payment due?
ratioNumber5
guardedBooleantrue

Enable response parsing and run once. Map the returned text field from the HTTP output into your AI module’s context. For real documents, map earlier module outputs into the structure’s text and query fields; this preserves JSON escaping.

Make HTTP settings ↗ · Keychain setup ↗

Visual Studio / VS Code

Your editor does not need an Optimise extension. Run the API call in the application you are editing.

  1. Open your project folder and its terminal. In VS Code, choose Terminal → New Terminal.
  2. Choose Node.js or Python below and make sure that runtime is installed.
  3. Set OPTIMISE_API_KEY in that terminal, using the quick-start command for PowerShell or Bash.
  4. Save the example file and run it in the same terminal. You should see selected text in the terminal output.
Terminal
node optimise.mjs
# Or, for the Python example:
python optimise.py

Visual Studio users can run the same commands from a project terminal. No debugger configuration is required. Environment variables set in one terminal do not automatically apply to separately launched debug sessions.

Python

  1. Use Python 3.10+ and install the HTTP client: python -m pip install requests.
  2. Set OPTIMISE_API_KEY, then copy the Python example into optimise.py.
  3. Run python optimise.py. In your app, call optimise(document_text, question) and use the returned string as context.

Open the Python example →

Node.js

  1. Use Node.js 18 or newer. No package installation is needed.
  2. Set OPTIMISE_API_KEY and copy the JavaScript example into optimise.mjs.
  3. Run node optimise.mjs. In your app, call await optimise(documentText, question) and use the returned string as context.

Open the Node.js example →

ComfyUI

For a local/self-hosted installation that permits custom nodes. Hosted ComfyUI services may restrict installation.

  1. Download the Underpin Optimise node. Save it as ComfyUI/custom_nodes/underpin_optimise/__init__.py, creating the folder first.
  2. Set OPTIMISE_API_KEY in the environment used to start ComfyUI. Restart ComfyUI from that environment so the node can read it.
  3. Add Underpin Optimise — Text Context. Enter source text, a focused query and a ratio (start at 5).
  4. Connect its context STRING output to a text input in your workflow. Queue the workflow to run it; unconnected unused nodes may not execute.

The node uses Python’s standard library. It sends text to the hosted API; it does not compress images or directly reduce ComfyUI GPU costs. ComfyUI may reuse a cached result when inputs have not changed.

ComfyUI custom-node reference ↗

Check your connection

A successful request returns JSON with text. A short test may return the original text because guarded fallback is enabled. A 401 means the key is missing or invalid; 429 means a request or capacity limit. Troubleshooting →

These are HTTP integration recipes, not marketplace-certified plugins. n8n and Make instructions were checked against their official docs. Their app workflows and the ComfyUI interface have not yet been tested end-to-end here.