onlinecompiler.io

Dify plugin

Give a Dify workflow or agent tools to run code in any of 46 languages and judge it against test cases. Each run happens in a fresh sandbox with no network on our servers, not on your Dify server.

  1. Get a free API key. Sign in with Google or email; every new account already has a key on its API Keys page. The Free plan has 100,000 runs a month and needs no card.
  2. Install the plugin. In Dify, open Plugins, click Install plugin, choose Marketplace and search for OnlineCompiler.io. It is on the Dify Marketplace and needs Dify 1.10 or later.
  3. Add your key. Select OnlineCompiler.io under Plugins, click Authorize, paste the key and save. Dify checks it once, which counts no run; a wrong or disabled key is refused there with the reason.

The tools

  • Run Code: runs one program with optional standard input and a time limit of up to 30 seconds. A workflow gets the variables output, error, status, exit_code, time, memory and truncated, plus the full result as JSON. Files the program writes (PNG, SVG, CSV, JSON or text) come back as files, so a matplotlib chart shows as an image in chat.
  • Run Tests: runs the program once per test and returns verdict, score (the percent of tests passed), passed, total, summary, compile_error and submission. Output can be compared as trim, exact, tokens, float, rows, table or table ordered.
  • List Compilers: every compiler id with its language and installed packages, such as python-3.14, g++-15 or openjdk-25. They are also on the compilers page.

Run Tests takes its tests as a JSON list. A test marked "hidden": true returns only its verdict, so a learner or a model never sees its input or expected output:

tests
[
  {"input": "2 3", "expected_output": "5"},
  {"input": "-1 1", "expected_output": "0"},
  {"input": "10 -4", "expected_output": "6", "hidden": true}
]

Example: check the code a model wrote

A Workflow app where an LLM writes a program and Run Tests decides whether it is right:

Workflow
Start      task (paragraph), tests (paragraph)
LLM        "Write a Python program for {{task}} that reads standard
            input and prints the answer. Reply with the code only."
Tool       OnlineCompiler.io, Run Tests
             compiler  python-3.14
             code      {{LLM.text}}
             tests     {{Start.tests}}
IF/ELSE    verdict is accepted?
End        verdict, score, summary

Run it with the task "Print the sum of two integers given on one line" and the tests above. When the model's code is right, the tool returns:

Run Tests
{
  "verdict": "accepted",
  "score": 100,
  "passed": 3,
  "total": 3,
  "summary": "2 of 2 sample tests passed. 1 of 1 hidden test passed.",
  "submission": "sub_...",
  "tests": [ ... ]
}

On the IF/ELSE node's other branch, send summary back to the LLM and ask it to fix the code. A program that fails to compile, throws or runs out of time is a normal result with its verdict and the error, not a failed tool call.

In an Agent app

Add Run Code and Run Tests under Tools in an Agent app or a chatflow's Agent node. The agent can then work out exact answers by running a program, test the code it writes before showing it, and draw charts with matplotlib, which appear in the chat as images. See code execution for AI agents.

Limits

Each run gets up to 30 seconds, 512 MB of memory and 2 CPUs, with no network, so code cannot install packages or call other services. Output and errors are each cut at 64 KB. Python 3.14 comes with numpy, pandas, scipy, scikit-learn and matplotlib, among others. When a plan limit is reached the tool reports it and nothing runs or counts; your current figures are on the limits page.

Source and issues: github.com/onlinecompiler-io/dify-plugin-onlinecompiler. The same checks are available over the run-tests API.

Questions

Why not use Dify's Code node?
Dify's Code node runs Python and JavaScript in the sandbox that comes with your Dify server, for glue code you wrote yourself. This plugin runs 46 languages, among them C, C++, Java, Go, Rust, SQL and R, each in a fresh sandbox with no network on our servers, so it suits code you didn't write: code a model wrote, a student's submission or code pasted into a chat.
Is it free?
Yes, with a free API key: the Free plan has 100,000 runs a month, commercial use included, and needs no card. Each Run Code call is one run, and each test in Run Tests is one run. Checking the key and listing compilers count none.
Does it work on Dify Cloud and on a self-hosted Dify?
Both, on Dify 1.10 or later. On a self-hosted Dify the plugin runtime must reach api.onlinecompiler.io over HTTPS (port 443), so allow that host if your server sits behind a proxy or firewall.
Where is the API key kept?
With the plugin's authorization in your Dify workspace, not inside an app, so the apps that use the tools share one key and an exported app does not carry it.