What is the Go SDK?
The CLI Proxy API Go SDK allows you to embed the complete proxy server functionality directly into your Go applications. Instead of running the proxy as a standalone service, you can integrate it as a library component with full programmatic control.Key Features
- Complete Embedding: Run the full proxy server inside your application
- Programmatic Control: Configure and manage the service through Go code
- Custom Providers: Add your own AI service providers with custom executors
- Request Translators: Transform requests between different API formats
- Access Control: Implement custom authentication and authorization
- Lifecycle Hooks: Hook into service startup and shutdown events
- File Watching: Automatic configuration and authentication reload
- Usage Tracking: Monitor API usage and token consumption
Use Cases
Desktop Applications
Embed the proxy in desktop apps to provide AI capabilities without requiring users to run a separate server:Custom AI Gateways
Build specialized AI routing services with custom logic:- Add custom authentication providers
- Implement request rate limiting
- Route requests based on custom business logic
- Add monitoring and observability
Integration Services
Create services that bridge multiple AI providers:- Combine multiple AI services under one API
- Add custom retry logic and failover
- Implement request caching
- Add request/response transformation
Testing and Development
Embed the proxy in test suites for integration testing:Architecture Overview
The SDK is organized into several key packages:Core Packages
sdk/cliproxy: Main service and builder for embedding the proxysdk/config: Configuration loading and managementsdk/cliproxy/auth: Authentication and credential managementsdk/cliproxy/executor: Provider executors for AI servicessdk/translator: Request/response format translatorssdk/access: Request authentication and access control
Component Flow
Quick Example
Here’s a minimal example of embedding the proxy:Installation
Add the SDK to your Go project:Next Steps
Getting Started
Install the SDK and create your first embedded proxy
Embedding Guide
Learn about the builder pattern, options, and lifecycle hooks
Advanced Features
Implement custom executors and translators
Access Control
Add custom authentication providers