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.
Use an HTTP Request node.
Make →Use HTTP → Make a request.
Visual Studio / VS Code →Run the example from your editor.
Python →Copy a short requests function.
Node.js →Use built-in fetch.
ComfyUI →Install our small text node.
n8n
- Add an HTTP Request node before your AI/model node. Set method POST and the URL above.
- Select Generic Credential Type → Header Auth. Create a credential with name
Authorizationand valueBearer YOUR_API_KEY. - Enable Send Body. Choose JSON → Using JSON. Paste this test body:
{
"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:
{{ { 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
- Add HTTP → Make a request (HTTP version 4). Set method POST and the URL above.
- Choose API key authentication. In Credentials, create a keychain: key
Bearer YOUR_API_KEY, placement In the header, parameter nameAuthorization. - Choose application/JSON for Body content type. Use Data structure with the fields below.
| Field | Type | First test value |
|---|---|---|
| text | Text | Payment is due in 30 days. Delivery is on Tuesday. |
| query | Text | When is payment due? |
| ratio | Number | 5 |
| guarded | Boolean | true |
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.
- Open your project folder and its terminal. In VS Code, choose Terminal → New Terminal.
- Choose Node.js or Python below and make sure that runtime is installed.
- Set
OPTIMISE_API_KEYin that terminal, using the quick-start command for PowerShell or Bash. - Save the example file and run it in the same terminal. You should see selected text in the terminal output.
node optimise.mjs
# Or, for the Python example:
python optimise.pyVisual 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
- Use Python 3.10+ and install the HTTP client:
python -m pip install requests. - Set
OPTIMISE_API_KEY, then copy the Python example intooptimise.py. - Run
python optimise.py. In your app, calloptimise(document_text, question)and use the returned string as context.
Node.js
- Use Node.js 18 or newer. No package installation is needed.
- Set
OPTIMISE_API_KEYand copy the JavaScript example intooptimise.mjs. - Run
node optimise.mjs. In your app, callawait optimise(documentText, question)and use the returned string as context.
ComfyUI
For a local/self-hosted installation that permits custom nodes. Hosted ComfyUI services may restrict installation.
- Download the Underpin Optimise node. Save it as
ComfyUI/custom_nodes/underpin_optimise/__init__.py, creating the folder first. - Set
OPTIMISE_API_KEYin the environment used to start ComfyUI. Restart ComfyUI from that environment so the node can read it. - Add Underpin Optimise — Text Context. Enter source text, a focused query and a ratio (start at 5).
- Connect its
contextSTRING 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.