You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Production AI needs more than just an LLM. You need embeddings, vector search, detection, RAG, agents, content safety, observability -- and they all need to be fast, concurrent, and deployable as one unit.
The standard approach: 6+ Python services, 6 ports, 6 containers, 8 GB RAM, Python GIL killing concurrency.
infergo: one binary, one port, one container. Same LLM speed as llama.cpp with zero overhead. 252 tests passing across 16 Go packages.
# One command. Everything on one port.
infergo serve \
--model llm:models/llama3-8b-q4.gguf \
--model embed:models/all-MiniLM-L6-v2.onnx \
--model detect:models/yolov8n.torchscript \
--provider cuda
# Works with any OpenAI client. Zero code changes.fromopenaiimportOpenAIclient=OpenAI(base_url="http://localhost:9090/v1", api_key="none")
response=client.chat.completions.create(
model="llm",
messages=[{"role": "user", "content": "Hello"}],
response_format={"type": "json_object"}
)
Performance
All numbers measured on RTX 5070 Ti, CUDA 12.8, Qwen 2.5 Coder 1.5B Q4_K_M, with --batch-timeout-ms 5 --max-batch-size 8. Benchmark scripts included. Performance scales with GPU — A100 achieves ~2x faster latency.
LLM inference -- same speed as raw llama.cpp
Engine
Avg latency
ms/tok
Go overhead
Raw llama.cpp (C++, no server)
204ms
3.46
--
infergo (Go + HTTP + llama.cpp)
205ms
3.48
0.7ms (0.3%)
LM Studio
176ms
3.10
custom CUDA fork
Python (llama-cpp-python)
1,575ms
29.0
GIL + ctypes
infergo runs at 100% of raw llama.cpp speed. The Go HTTP layer adds 0.7ms -- within measurement noise.
Concurrent throughput
Concurrency
infergo
LM Studio
Python
infergo vs Python
c=1
205ms / 231 tok/s
172ms / 248 tok/s
1,607ms / 33 tok/s
7x
c=4
756ms / 289 tok/s
491ms / 444 tok/s
4,936ms / 41 tok/s
7x
c=8
1,356ms / 434 tok/s
873ms / 460 tok/s
8,146ms / 44 tok/s
12x
infergo is 12x faster than Python at c=8. Continuous batching groups concurrent requests into shared GPU decode calls.
Go handles HTTP, routing, metrics, caching, auth, rate limiting, and concurrency. 10,000 concurrent connections cost 80 KB of goroutine stacks. No GIL. Compiled binary.
C++ handles all inference compute. The entire generation loop runs in C++ -- one CGo call per request, not one per token. Result: 0.7ms overhead vs raw C++.
Features
LLM Inference
Feature
Description
Chat completion
OpenAI-compatible /v1/chat/completions with streaming
Text completion
Raw text completion via /v1/completions
Streaming (SSE)
Server-sent events for token-by-token delivery
JSON mode
Guaranteed valid JSON output via constrained generation
GBNF grammar
Arbitrary grammar-constrained output (BNF format)
TOON format
Typed object output notation for structured extraction
Function calling
Tool-use with automatic argument extraction
Speculative decoding
Draft model acceleration (6.7x faster)
Prefix caching
KV cache reuse across requests with shared prefixes
Continuous batching
Dynamic request grouping for throughput maximization
Flash Attention
Memory-efficient attention (CUDA)
ChatML templates
Jinja2-compatible chat template rendering
LoRA adapter hot-swap
Load/unload LoRA adapters at runtime without restart
Embedding
Feature
Description
ONNX models
ONNX Runtime inference for embedding models
TorchScript models
LibTorch inference for TorchScript embedding models
Batch embedding
Multiple inputs in a single request
Mean pooling + L2 norm
Standard pooling and normalization for similarity search
Object Detection
Feature
Description
YOLO models
TorchScript and ONNX YOLO model support
GPU NMS
CUDA kernel for non-maximum suppression
Multi-stream batching
Concurrent detection across multiple video streams
Adaptive backend
Automatic selection of optimal runtime (ONNX/Torch)
nvJPEG decode
Hardware-accelerated JPEG decoding on GPU
Filtering
Configurable confidence, IoU, max detections, class filtering
Search and Retrieval
Feature
Description
HNSW vector search
Approximate nearest neighbor search with CRUD and persistence
BM25 keyword search
Full-text search with 140us latency on 10K documents
curl http://localhost:9090/v1/ner \
-H "Content-Type: application/json" \
-d '{"model": "llm", "text": "John Smith works at Google in Mountain View."}'
Agent with tools:
curl http://localhost:9090/v1/agents/run \
-H "Content-Type: application/json" \
-d '{ "model": "llm", "prompt": "What is 42 * 17 and what time is it?", "tools": ["calculator", "current_time"], "max_steps": 5 }'
# Interactive chat
infergo chat --model models/llama3-8b-q4.gguf --provider cuda
# Benchmark a model
infergo bench --model models/llama3-8b-q4.gguf --provider cuda \
--prompt "Explain quantum computing" --concurrency 1,4,8
# Validate before serving
infergo validate --model models/llama3-8b-q4.gguf
# Convert model format
infergo convert --input model.onnx --output model.torchscript
SDKs
infergo provides two types of SDK:
HTTP SDKs — connect to a running infergo serve instance over the network (any machine)
Native SDKs — link directly to libinfer_api.so for zero-overhead inference (same machine as GPU)
Native SDKs (14 languages, zero HTTP overhead)
Link directly to the C inference engine. No server, no serialization, no network. 0.01ms overhead.
Language
Directory
Binding
Install
C / C++
sdk/c/
Direct link
gcc app.c -linfer_api or CMake find_package(infergo)
Python
sdk/python-native/
ctypes
export INFERGO_LIB_DIR=...
Rust
sdk/rust/
FFI (infergo-sys)
cargo add infergo
Java / Kotlin
sdk/java/
JNI
gradle build
Node.js
sdk/nodejs/
N-API addon
npm install (builds native)
C# / .NET
sdk/dotnet/
P/Invoke
dotnet build
Swift
sdk/swift/
C bridging
Swift Package Manager
Ruby
sdk/ruby/
FFI gem
gem install ffi
PHP
sdk/php/
FFI extension
composer install (PHP 7.4+)
Dart / Flutter
sdk/dart/
dart:ffi
Add to pubspec.yaml
Zig
sdk/zig/
@cImport
zig build
Elixir / Erlang
sdk/elixir/
NIF
mix compile
Lua
sdk/lua/
LuaJIT FFI
require("infergo")
WASM / JS
sdk/wasm/
Emscripten
make (CPU only)
Every native SDK wraps the same C API (libinfer_api.so) and provides: LLM generation, embedding, vector search, BM25 search, LoRA adapters, and RAG pipeline.
# Python — zero HTTP, direct C callfrominfergo_nativeimportLLM, VectorDBwithLLM("model.gguf") asllm:
print(llm.generate("Hello!")) # 0.01ms overhead vs raw C++
See Native SDK Reference for full API docs, install guides, and examples for all 14 languages.
HTTP SDKs (any machine)
Connect to infergo serve over the network. Works from any machine.
Python
pip install infergo
frominfergoimportInfergoClientclient=InfergoClient("http://localhost:9090", api_key="YOUR_KEY")
response=client.chat("What is Go?", model="llm")
vectors=client.embed(["hello"], model="embed")
entities=client.ner("John works at Google.", model="llm")
# Route 10% of traffic to new model version
curl http://localhost:9090/v1/admin/canary \
-H "Authorization: Bearer ADMIN_KEY" \
-d '{"model": "llm", "canary_weight": 0.1, "canary_model": "models/llama3-8b-q4-v2.gguf"}'
Configuration
infergo uses command-line flags and environment variables: