gambiarra-sdk) is a TypeScript library that provides seamless integration between Gambiarra’s distributed LLM coordination system and the Vercel AI SDK. It enables you to route AI requests across multiple shared LLM endpoints on your local network.
What is the Gambiarra SDK?
The Gambiarra SDK is a lightweight wrapper that:- Provides an AI SDK-compatible provider for accessing shared LLMs through Gambiarra rooms
- Manages HTTP communication with Gambiarra hubs via a type-safe client
- Supports intelligent routing to specific participants, models, or random online endpoints
- Enables local and remote hub management with comprehensive TypeScript types
Why Use the SDK?
OpenAI-Compatible Interface
The SDK leverages@ai-sdk/openai-compatible to provide a familiar interface that works with any Vercel AI SDK function:
Flexible Routing Strategies
Route requests based on your needs:- Participant routing: Target specific machines by ID
- Model routing: Use the first available participant running a specific model
- Any routing: Load balance across all online participants
Type Safety
Full TypeScript support with exported types from@gambiarra/core:
Key Concepts
Providers
A provider is an AI SDK-compatible wrapper around a Gambiarra room. Create one withcreateGambiarra():
Routing Methods
The provider exposes three routing methods:participant()
Route to a specific participant by ID
model()
Route to the first participant running a specific model
any()
Route to any random online participant
HTTP Client
For direct hub management, use the HTTP client:Namespaces
The SDK re-exports organized namespaces from@gambiarra/core:
rooms- Room and participant managementparticipants- Participant creation and configurationhub- Local hub creation
Architecture
The SDK is a zero-duplication wrapper around@gambiarra/core:
- Minimal bundle size with tree-shaking support
- Single source of truth for types and logic
- Easy updates from core package
When to Use What
Use the AI SDK Provider when...
Use the AI SDK Provider when...
- You’re building AI applications with Vercel AI SDK
- You want to use
generateText(),streamText(), or other AI SDK functions - You need automatic request routing and load balancing
Use the HTTP Client when...
Use the HTTP Client when...
- You’re managing rooms and participants programmatically
- You’re building custom tooling around Gambiarra hubs
- You need direct control over room lifecycle and health checks
Use the Namespaces when...
Use the Namespaces when...
- You’re creating a local hub in your application
- You need low-level access to room and participant management
- You’re building custom integrations or extensions
Next Steps
Installation
Install the SDK and set up your environment
Usage Guide
Learn how to use the SDK with practical examples
API Reference
Explore the complete API documentation
Quickstart
Get started with Gambiarra in 5 minutes