Axion is a high-performance LLM serving platform built with Rust that provides OpenAI-compatible APIs for chat completions, embeddings, and reranking. Designed for production environments, Axion delivers exceptional throughput and low latency through advanced optimization techniques.
Rust
1
6 commits
updated Dec 20, 2025
Axion is a high-performance LLM serving platform built with Rust that provides OpenAI-compatible APIs for chat completions, embeddings, and reranking. Designed for production environments, Axion delivers exceptional throughput and low latency through advanced optimization techniques.
POST /v1/chat/completionscurl -X POST http://localhost:3000/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "meta-llama/Llama-3.2-3B-Instruct",
"messages": [
{"role": "user", "content": "Hello!"}
],
"temperature": 0.7,
"max_tokens": 150,
"stream": false
}'
POST /v1/embeddingscurl -X POST http://localhost:3000/v1/embeddings \
-H "Content-Type: application/json" \
-d '{
"input": "Hello, World!",
"model": "BAAI/bge-small-en-v1.5"
}'
POST /v1/rerankcurl -X POST http://localhost:3000/v1/rerank \
-H "Content-Type: application/json" \
-d '{
"query": "what is a panda?",
"documents": ["A bear species", "A software library", "An animal"],
"model": "BAAI/bge-reranker-base",
"top_n": 3
}'
GET /health┌─────────────┐
│ Client │
└─────┬───────┘
│ HTTPS
▼
┌─────────────────────────┐
│ Axion Server │
│ (Axum + Tower HTTP) │
└─────┬───────────────────┘
│
├──► Cache Layer (LRU)
│
├──► Continuous Batcher
│
▼
┌─────────────────────────┐
│ Inference Engine │
│ (Smart Routing) │
└─────┬───────────────────┘
│
├──► MAX Client ──────► max serve (OpenAI API)
│ │
│ ▼
│ Model Process
│
└──► Candle Backend ──► Native Inference
│ (Llama, Qwen, etc.)
│
└──► GPU/CPU Execution
git clone <repository-url>
cd axion
git lfs install
git lfs pull
cargo build --release
# Use default model
cargo run --release
# Specify a model
MODEL_NAME="meta-llama/Llama-3.2-3B-Instruct" cargo run --release
# With custom configuration
MODEL_NAME="microsoft/Phi-3-mini-4k-instruct" \
SERVER_PORT=8080 \
RUST_LOG=axion=info \
cargo run --release
MODEL_NAME: Primary model to serve (default: meta-llama/Llama-3.2-3B-Instruct)MAX_SEQ_LEN: Maximum sequence length (default: 4096)SERVER_HOST: Server host address (default: 0.0.0.0)SERVER_PORT: Server port (default: 3000)MAX_CONNECTIONS: Maximum concurrent connections (default: 100)CACHE_CAPACITY: Number of cached responses (default: 1000)BATCH_TIMEOUT_MS: Batching timeout in milliseconds (default: 50)MAX_BATCH_SIZE: Maximum batch size (default: 8)CONCURRENT_REQUESTS: Maximum concurrent requests (default: 10)RUST_LOG: Logging level (default: axion=info,tower_http=info)When a model is supported by MAX, Axion automatically:
max serve --model {model_name}MAX supports:
If MAX is unavailable or unsupported, Axion uses Candle:
Candle supports:
src/
├── main.rs # Server entry point and HTTP handlers
├── api_types.rs # OpenAI-compatible API type definitions
├── inference_engine.rs # Main inference coordinator and backend routing
├── max_client.rs # MAX serve integration and process management
├── candle_inference.rs # Native Candle backend implementation
├── embedding_service.rs # Embedding generation service
├── rerank_service.rs # Document reranking service
├── cache.rs # LRU cache implementation
├── batching.rs # Continuous batching system
├── embed.rs # Example embedding code
├── rerank.rs # Example reranking code
└── models/ # Model-specific Candle implementations
├── llama.rs # Llama architecture implementation
├── qwen3.rs # Qwen3 architecture implementation
├── gemma.rs # Gemma architecture implementation
├── mistral.rs # Mistral architecture implementation
├── glm4.rs # GLM4 architecture implementation
├── granite.rs # Granite architecture implementation
├── olmo.rs # OLMo architecture implementation
└── quant_qwen3.rs # Quantized Qwen3 implementation
MAX automatically supports new models when MAX adds support. Simply use the model identifier.
To add support for a new transformer architecture:
src/models/{architecture_name}.rsModelBackend enum in src/candle_inference.rs# Run all tests
cargo test
# Run tests with detailed output
cargo test -- --nocapture
# Format code
cargo fmt
# Run linter
cargo clippy
# Run performance tests
cargo test --release -- --ignored performance
Complete documentation is available in the Docs/ directory, covering all aspects of the system:
Typical performance characteristics:
# Example Dockerfile
FROM rust:latest as builder
WORKDIR /app
COPY . .
RUN cargo build --release
FROM debian:bullseye-slim
RUN apt-get update && apt-get install -y ca-certificates && rm -rf /var/lib/apt/lists/*
COPY --from=builder /app/target/release/axion /usr/local/bin/axion
EXPOSE 3000
CMD ["axion"]
This project is licensed under the terms specified in the LICENSE file.
We welcome contributions! Please see our contribution guidelines for details:
6 commits
Rust
97.7%
Shell
2.3%
Axion is a high-performance LLM serving platform built with Rust that provides OpenAI-compatible APIs for chat completions, embeddings, and reranking. Designed for production environments, Axion delivers exceptional throughput and low latency through advanced optimization techniques.
Rust
1
6 commits
updated Dec 20, 2025
Axion is a high-performance LLM serving platform built with Rust that provides OpenAI-compatible APIs for chat completions, embeddings, and reranking. Designed for production environments, Axion delivers exceptional throughput and low latency through advanced optimization techniques.
POST /v1/chat/completionscurl -X POST http://localhost:3000/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "meta-llama/Llama-3.2-3B-Instruct",
"messages": [
{"role": "user", "content": "Hello!"}
],
"temperature": 0.7,
"max_tokens": 150,
"stream": false
}'
POST /v1/embeddingscurl -X POST http://localhost:3000/v1/embeddings \
-H "Content-Type: application/json" \
-d '{
"input": "Hello, World!",
"model": "BAAI/bge-small-en-v1.5"
}'
POST /v1/rerankcurl -X POST http://localhost:3000/v1/rerank \
-H "Content-Type: application/json" \
-d '{
"query": "what is a panda?",
"documents": ["A bear species", "A software library", "An animal"],
"model": "BAAI/bge-reranker-base",
"top_n": 3
}'
GET /health┌─────────────┐
│ Client │
└─────┬───────┘
│ HTTPS
▼
┌─────────────────────────┐
│ Axion Server │
│ (Axum + Tower HTTP) │
└─────┬───────────────────┘
│
├──► Cache Layer (LRU)
│
├──► Continuous Batcher
│
▼
┌─────────────────────────┐
│ Inference Engine │
│ (Smart Routing) │
└─────┬───────────────────┘
│
├──► MAX Client ──────► max serve (OpenAI API)
│ │
│ ▼
│ Model Process
│
└──► Candle Backend ──► Native Inference
│ (Llama, Qwen, etc.)
│
└──► GPU/CPU Execution
git clone <repository-url>
cd axion
git lfs install
git lfs pull
cargo build --release
# Use default model
cargo run --release
# Specify a model
MODEL_NAME="meta-llama/Llama-3.2-3B-Instruct" cargo run --release
# With custom configuration
MODEL_NAME="microsoft/Phi-3-mini-4k-instruct" \
SERVER_PORT=8080 \
RUST_LOG=axion=info \
cargo run --release
MODEL_NAME: Primary model to serve (default: meta-llama/Llama-3.2-3B-Instruct)MAX_SEQ_LEN: Maximum sequence length (default: 4096)SERVER_HOST: Server host address (default: 0.0.0.0)SERVER_PORT: Server port (default: 3000)MAX_CONNECTIONS: Maximum concurrent connections (default: 100)CACHE_CAPACITY: Number of cached responses (default: 1000)BATCH_TIMEOUT_MS: Batching timeout in milliseconds (default: 50)MAX_BATCH_SIZE: Maximum batch size (default: 8)CONCURRENT_REQUESTS: Maximum concurrent requests (default: 10)RUST_LOG: Logging level (default: axion=info,tower_http=info)When a model is supported by MAX, Axion automatically:
max serve --model {model_name}MAX supports:
If MAX is unavailable or unsupported, Axion uses Candle:
Candle supports:
src/
├── main.rs # Server entry point and HTTP handlers
├── api_types.rs # OpenAI-compatible API type definitions
├── inference_engine.rs # Main inference coordinator and backend routing
├── max_client.rs # MAX serve integration and process management
├── candle_inference.rs # Native Candle backend implementation
├── embedding_service.rs # Embedding generation service
├── rerank_service.rs # Document reranking service
├── cache.rs # LRU cache implementation
├── batching.rs # Continuous batching system
├── embed.rs # Example embedding code
├── rerank.rs # Example reranking code
└── models/ # Model-specific Candle implementations
├── llama.rs # Llama architecture implementation
├── qwen3.rs # Qwen3 architecture implementation
├── gemma.rs # Gemma architecture implementation
├── mistral.rs # Mistral architecture implementation
├── glm4.rs # GLM4 architecture implementation
├── granite.rs # Granite architecture implementation
├── olmo.rs # OLMo architecture implementation
└── quant_qwen3.rs # Quantized Qwen3 implementation
MAX automatically supports new models when MAX adds support. Simply use the model identifier.
To add support for a new transformer architecture:
src/models/{architecture_name}.rsModelBackend enum in src/candle_inference.rs# Run all tests
cargo test
# Run tests with detailed output
cargo test -- --nocapture
# Format code
cargo fmt
# Run linter
cargo clippy
# Run performance tests
cargo test --release -- --ignored performance
Complete documentation is available in the Docs/ directory, covering all aspects of the system:
Typical performance characteristics:
# Example Dockerfile
FROM rust:latest as builder
WORKDIR /app
COPY . .
RUN cargo build --release
FROM debian:bullseye-slim
RUN apt-get update && apt-get install -y ca-certificates && rm -rf /var/lib/apt/lists/*
COPY --from=builder /app/target/release/axion /usr/local/bin/axion
EXPOSE 3000
CMD ["axion"]
This project is licensed under the terms specified in the LICENSE file.
We welcome contributions! Please see our contribution guidelines for details:
6 commits
Rust
97.7%
Shell
2.3%