Project Status: π§ Under Active Development β Core is stable; English documentation is being gradually translated. Most documentation is currently in Chinese. Please use AI/translation tools to read Chinese docs if needed.
zAPI is a cross-language RPC framework based on pure C ABI, enabling services written in 10+ languages β C++, Python, Go, Rust, Java, C#, Pascal, Node.js, and more β to call each other as easily as calling local functions.
Core Promise: No IDL, no code generation, no new protocols to learn β use your familiar language, call the world.
zAPI is built on a pure C dynamic library. Any language that supports FFI can connect. No IDL, no code generation, no complex configuration β just a header file, and your functions can run across languages, processes, and machines.
// Register an API in C
static void __cdecl AddCallback(void* trigger, void* input, void* output) {
int a, b;
API_ReadBuffer((TDataHnd)input, &a, sizeof(a));
API_ReadBuffer((TDataHnd)input, &b, sizeof(b));
int sum = a + b;
API_WriteBuffer((TDataHnd)output, &sum, sizeof(sum));
}
int main() {
API_LoadLibrary();
TAppHnd app = API_Create_APPHnd("Calc", "Calculator");
API_Reg_Call(app, "add", "Add two ints", NULL, AddCallback);
// Prepare network...
API_Prepare_Service("0.0.0.0", "127.0.0.1:9898");
API_Prepare_Client("127.0.0.1:9898", app);
API_Prepare_Done();
// This API can now be called from any language
}| Feature | Description |
|---|---|
| π 10+ Language Bindings | C++, Python, Go, Rust, Java, C#, Pascal, VB.NET, Node.js, Web.js β out of the box |
| β‘ High Performance | IPC mode < 1ms latency, 10,000+ requests/second |
| π Dual Communication Modes | TCP (cross-machine) + IPC (same-machine microsecond latency) |
| π Automatic Service Discovery | C4-based service mesh with auto-registration, discovery, and load balancing |
| π‘οΈ Fault Tolerance & Reconnection | Auto-reconnect on disconnect; services re-register automatically |
| π§΅ Full Thread Safety | All APIs (except status logging) support concurrent calls |
| π¦ Zero-Copy Transfer | Direct internal buffer access for maximum performance |
| π― Two Call Modes | Request-Response (Call) + One-Way Notification (Notify) |
| π§ Zero-Configuration Startup | Auto-generates config file on first run; tune without recompilation |
| Language | Binding Method | Docs | Examples |
|---|---|---|---|
| C++ | RAII wrapper (API_HubTool.hpp) |
π Guide (CN) | 7 examples |
| C | Explicit dynamic loading (API_HubTool.h) |
π Guide (CN) | 7 examples |
| Python | ctypes + @expose decorator |
π Complete Guide (CN) | 20+ examples |
| Go | CGO bindings | π Complete Guide (CN) | 14 examples |
| Rust | libloading + RAII |
π Guide (CN) | 14 examples |
| Java | JNA + AutoCloseable | π Guide (CN) | 4 examples |
| C# | P/Invoke + .NET 8+ | π Complete Guide (CN) | 7 examples |
| VB.NET | P/Invoke | π Guide (CN) | 5 examples |
| Pascal (Delphi/FPC) | external auto-load |
π Complete Guide (CN) | 3 examples |
| Node.js | Python gateway proxy | π Architecture (CN) | 1 example |
| Web.js (Browser) | Python gateway proxy | π Guide (CN) | 1 example |
Any language that supports the C ABI can be integrated β you can even write bindings for your own language.
Download the appropriate libraries for your platform from Releases:
| Platform | Core Library | IPC Dependency |
|---|---|---|
| Windows 64-bit | z_api_hub64.dll |
z_ipc_64.dll |
| Linux | libz_api_hub.so |
libz_ipc.so |
| macOS | libz_api_hub.dylib |
libz_ipc.dylib |
Place them in your executable directory or system library path.
# service.py
from api_hub import Server
app = Server("Calculator")
@app.expose("add")
def add(a: int, b: int) -> int:
return a + b
if __name__ == "__main__":
app.start("ipc:calc_service")
input("Press Enter to stop...")
app.stop()package main
import (
"fmt"
"github.com/PassByYou888/zAPI/api_hub"
)
func main() {
client, _ := api_hub.NewClient()
client.PrepareClient("ipc:calc_service")
client.PrepareDone()
param, _ := client.CreateDataHnd("add")
client.WriteInt32(param, 10)
client.WriteInt32(param, 20)
result, _ := client.Call("Calculator", param, 3000)
sum, _ := client.ReadInt32(result)
fmt.Printf("10 + 20 = %d\n", sum) // Output: 10 + 20 = 30
}Run:
# Terminal 1: Start Python service
python service.py
# Terminal 2: Run Go client
go run client.go
# Output: 10 + 20 = 30Python service called by Go β no extra configuration needed.
Test Environment: Intel Xeon Gold 6248 / 32GB RAM / Ubuntu 22.04
| Communication Mode | Avg Latency (p50) | Max Throughput | Use Case |
|---|---|---|---|
| Same-machine IPC (named pipe) | < 0.8 ms | ~12,000 req/s | Single-node microservices, edge computing |
| Local TCP loopback | ~2.5 ms | ~6,500 req/s | Development/testing environments |
| Cross-machine LAN TCP | ~5-15 ms | Bandwidth-limited | Production distributed deployment |
Comparison Reference:
| Solution | Typical Latency | Overhead |
|---|---|---|
| zAPI (IPC) | < 1 ms | Baseline |
| zAPI (TCP) | ~2-3 ms | +2-3 ms |
| gRPC (TCP) | ~5-8 ms | +4-6 ms |
| HTTP REST (JSON) | ~10-20 ms | +9-18 ms |
Why so fast?
- Zero-copy data transfer:
API_GetBuffer()returns internal pointers directly - Binary protocol: No JSON/Protobuf encoding/decoding overhead
- C-level concurrency scheduling: Callbacks execute in C thread pools, unaffected by Python/Node GILs
Any language client can call any language server:
| Server β / Client β | C++ | Python | Go | Rust | Java | C# | Pascal | Node | Web |
|---|---|---|---|---|---|---|---|---|---|
| C++ | β | β | β | β | β | β | β | β | β |
| Python | β | β | β | β | β | β | β | β | β |
| Go | β | β | β | β | β | β | β | β | β |
| Rust | β | β | β | β | β | β | β | β | β |
| Java | β | β | β | β | β | β | β | β | β |
| C# | β | β | β | β | β | β | β | β | β |
| Pascal | β | β | β | β | β | β | β | β | β |
All zAPI functions (except
API_Get_Status) are fully thread-safe. You can callAPI_Callfrom thousands of threads concurrently β the library handles it all.
But pay attention to callback execution context:
Callbacks (TAPI_Call / TAPI_Notify) execute in background thread pools. This means:
- β NEVER call
API_CallorAPI_Notifyfrom within a callback β may deadlock - β NEVER perform long-running blocking operations in callbacks
- β NEVER directly access UI components from callbacks
- β Recommended: Offload expensive tasks to your own worker threads asynchronously
// β WRONG: Calling API_Call inside a callback
static void __cdecl BadCallback(void* trigger, void* input, void* output) {
// DEADLOCK RISK!
TDataHnd result = API_Call("OtherApp", input, 5000);
}
// β
CORRECT: Offload task asynchronously
static void __cdecl GoodCallback(void* trigger, void* input, void* output) {
// Push request to a queue; worker thread handles it
WorkQueue.push(input);
// Return immediately
}βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Application Layer (10+ Languages) β
ββββββββββββ¬βββββββββββ¬βββββββββββ¬βββββββββββ¬ββββββββββββββββββββ€
β C++ β Python β Go β Rust β Java / C# β
β Pascal β Node.js β Web.js β C β VB.NET β
ββββββββββββ΄βββββββββββ΄βββββββββββ΄βββββββββββ΄ββββββββββββββββββββ€
β Unified C ABI Dynamic Library Layer β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β C4 Distributed Service Mesh β
β (Auto-Discovery / Load Balancing) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β TCP β IPC β Auto Service β
β (Cross-node) β (Same-node) β Discovery β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
zAPI/
βββ Binary/ # Dynamic libraries & executables
β βββ z_api_hub64.dll # Core dynamic library
β βββ z_ipc_64.dll # IPC support library
βββ C++/ # C/C++ bindings + examples
βββ Py/ # Python bindings + 20+ examples
β βββ api_hub/ # Python core bindings
β βββ node/ # Node.js gateway
β βββ web/ # Web.js browser gateway
βββ Go/ # Go bindings + 14 examples
βββ java/ # Java bindings + JNA
βββ rust/ # Rust bindings + 14 examples
βββ C#/ # C# bindings + 7 examples
βββ VB.NET/ # VB.NET bindings + 5 examples
βββ pascal/ # Pascal complete documentation
βββ node/ # Node.js client examples
- zAPI: Make All Languages Talk (CN) β Project overview
- zAPI Empire Treasure Map (CN) β Project structure overview
| Language | Documentation |
|---|---|
| C++ | API Hub Tool C++ Guide |
| C | API Hub Tool C Guide |
| Python | Master Multi-Language Interop from Zero |
| Go | API Hub for Go β Complete Guide |
| Rust | zAPI Rust Guide |
| Java | API Hub Java Guide |
| C# | API Hub Tool for C# β Complete Guide |
| VB.NET | VB.NET Full-Stack Domination |
| Pascal | API Hub Tool for Pascal β Complete Guide |
| Node.js | Node.js Cross-Language Call Architecture |
| Web.js | js_api.py Guide |
- Go Microservices: Replacing gRPC with zAPI β 60% Lower Latency
- Python Microservices: Why We Chose zAPI Over Flask
- Browser Calling C++: Three Solutions Compared
We welcome all forms of contribution:
- π Report bugs
- π‘ Suggest new features
- π Improve documentation
- π§ Submit Pull Requests
- π Write bindings for more languages
MIT License β Free to use, modify, and distribute, even for commercial projects.
If this project helps you, please give us a Star! Your support keeps us motivated.
Make all languages talk to each other.