gaise-api
Axum HTTP server for GAISe — exposes all GenAI providers behind a unified REST API with SSE streaming.
Endpoints
| Method | Path | Description |
|---|---|---|
POST |
/v1/instruct |
Non-streaming instruct request |
POST |
/v1/instruct/stream |
Server-Sent Events streaming |
POST |
/v1/embeddings |
Generate embedding vectors |
GET |
/v1/live |
WebSocket for real-time audio/text sessions (feature = live) |
Quick Start
# Set provider keys
# Run the server
# Listening on 0.0.0.0:3000
# Call any provider via the same endpoint
Change "model" to "anthropic::claude-sonnet-5" or "gemini::gemini-3.6-flash" — same endpoint, same format.
Live / Realtime (feature = "live")
Enable with cargo run -p gaise-api --features live. The /v1/live endpoint upgrades to a WebSocket for bidirectional audio + text streaming.
Protocol:
- Client sends a JSON
GaiseLiveConfigas the first message (model, voice, modalities, tools, etc.) - Server connects to the provider and begins forwarding:
- Client -> Server: JSON text frames (
GaiseLiveInput) or binary frames (raw PCM16 audio at 16kHz) - Server -> Client: JSON text frames (
GaiseLiveEvent) or binary frames (PCM audio with 4-byte LE sample rate header)
- Client -> Server: JSON text frames (
Environment Variables
| Variable | Description |
|---|---|
GAISE_PORT |
Server port (default: 3000) |
OLLAMA_URL |
Ollama API URL |
OPENAI_API_URL / OPENAI_API_KEY |
OpenAI credentials |
ANTHROPIC_API_URL / ANTHROPIC_API_KEY |
Anthropic credentials |
GEMINI_API_URL / GEMINI_API_KEY |
Gemini credentials |
VERTEXAI_API_URL / VERTEXAI_SA_PATH |
Vertex AI credentials |
BEDROCK_REGION |
AWS Bedrock region |
As a Library
use Arc;
use ;
use ;
let config = GaiseClientConfig ;
let state = new;
let app = create_app;
// Mount into your own Axum server
Part of GAISe
License: AGPL-3.0-only