Embed in your app

Run Pie inside a Python, Node.js, browser, iOS, Android, or C program.

Pie does not have to run as a separate server process. You can embed the engine directly inside your application from six languages, and still open the HTTP port when needed.

Pie enginePythonpie-serverNode.js@pie-project/serverBrowserWebGPUiOS, macOSSwift · MetalAndroidKotlin · VulkanClibpie
The same engine, linked into your process. No separate server needed.

Python

pie-server runs the Pie server inside a Python process on the native GPU backends:

import asyncio
from pie.config import Config, EngineConfig, ModelConfig, ServerConfig
from pie.server import Server

async def main():
    cfg = Config(
        server=ServerConfig(listen="127.0.0.1:0"),
        model=ModelConfig(source="Qwen/Qwen3.5-0.8B"),
        engine=EngineConfig(type="cuda", device=["cuda:0"]),
    )
    async with Server(cfg) as server:
        print(server.http_url)              # OpenAI, Anthropic, and Gemini base URL
        client = await server.connect()     # PieClient for launching inferlets

asyncio.run(main())

JavaScript and the browser

@pie-project/server runs on Node.js with the native GPU backends. When bundled with Vite or webpack 5, the same import resolves to the browser build, which runs on WebGPU:

import { Server } from '@pie-project/server';
import '@pie-project/language-python';

const server = await Server.start({ model: 'Qwen/Qwen3.5-0.8B' });
const client = await server.connect();
const proc = await client.launchProcess('text-completion', { prompt: 'Hello' });
console.log(await proc.result());
await server.shutdown();

In the browser, model is the URL of a .wgpu.zt file. The hosting page must be cross-origin isolated (COOP/COEP), and the browser must support WebGPU and WebAssembly JSPI (Chrome 137 or later). The Playground uses this setup.

Swift (iOS and macOS)

PieServer runs the Metal engine in-process on iOS and macOS:

import PieServer
import PieLanguagePython

let model = Bundle.main.url(forResource: "qwen", withExtension: "zt")!
let server = try await PieServer.start(model: model, languages: [.python])
let client = try await server.connect()
let name = try await server.install(contentsOf: Bundle.main.url(forResource: "main", withExtension: "py")!)
let process = try await client.launch(name, input: ["prompt": "Hi!"])

Kotlin (Android)

org.pieproject.server.PieServer runs the Vulkan engine on Android (arm64):

val server = PieServer.start(
    model = File(context.filesDir, "qwen.vulkan.zt"),
    home = File(context.cacheDir, "pie"),
    languages = listOf(PieServer.Language.python),
)
val client = server.connect()

C

libpie exposes the engine through pie.h for any language with a C FFI:

pie_server *server = NULL;
char *error = NULL;
pie_server_start("qwen.vulkan.zt", NULL, "/var/lib/myapp/pie", NULL, &server, &error);

Building .zt files for phones and browsers

Phones and browsers do not run pie model import locally. Convert the model on a computer first and ship the resulting .zt file with your app:

pie model import Qwen/Qwen3.5-0.8B --deployment qwen35-d0.8b-u4g64-kv-bf16

For browser apps, build the .wgpu.zt file with a wgpu build of Pie whose version matches your @pie-project/server npm package.

Go deeperShip your own logic with your app →

An inferlet bundled with your app runs unchanged on every target device.