A comprehensive reference of working plugin examples in the Tyk AI Studio repository, demonstrating real-world patterns for different plugin capabilities.
Comprehensive reference of working plugin examples in the Tyk AI Studio repository. All examples use the Unified Plugin SDK (pkg/plugin_sdk) and demonstrate real-world patterns for different plugin capabilities.
Capabilities: PostAuth, Response, UIDescription: Intelligent request distribution across multiple LLM backends with health checking and failover.Complexity: Advanced
Path: examples/plugins/studio/llm-rate-limiter-multiphase/Capabilities: PostAuth, Response, UI ProviderDescription: Comprehensive example showing a multi-capability plugin that implements rate limiting across the entire request/response lifecycle with a custom UI dashboard.Key Features:
PostAuth: Check rate limits before proxying to LLM
Response: Update counters after successful response
UI Provider: Custom dashboard showing rate limit status
Path: examples/plugins/studio/service-api-test/Capabilities: PostAuth (for testing purposes)Description: Comprehensive test plugin demonstrating all Studio Service API operations including LLMs, Tools, Apps, Datasources, Filters, Tags, and Plugins management.Key Features:
Path: examples/plugins/studio/custom-auth-ui/Capabilities: UI Provider, AuthDescription: UI plugin with custom authentication extension. Shows how to add custom pages, sidebars, and authentication flows to the AI Studio dashboard.Key Features:
Path: examples/plugins/studio/portal-feedback/Capabilities: UI Provider, Portal UI ProviderDescription: Example plugin demonstrating portal UI with user feedback form. Shows how to build pages visible to end-users in the AI Portal alongside an admin dashboard for managing submissions.Key Features:
Portal sidebar integration with group-based visibility
Portal RPC with authenticated user context (HandlePortalRPC)
Admin RPC for management operations (HandleRPC)
Separate WebComponents for portal and admin UIs
waitForAPIAndLoad() pattern for API injection timing
Shared asset serving between admin and portal contexts
Path: examples/plugins/gateway/custom-echo-endpoint/Capabilities: CustomEndpointHandler, UIProvider, ConfigProviderDescription: Demonstrates custom HTTP endpoints on the gateway combined with a Studio admin UI. Registers a catch-all endpoint at /plugins/custom-echo-endpoint/ that echoes request metadata and user-configured content.Key Features:
CustomEndpointHandler with /* catch-all registration
Full request metadata echo (method, path, headers, query, body, path_segments)
Studio UI (WebComponent) for editing custom content
Config persistence via ai_studio_sdk.UpdatePluginConfig()
Config sync from Studio → Gateway via gRPC ConfigurationSnapshot
Manifest with custom_endpoint + studio_ui hooks
Use Cases:
Learning custom endpoint basics
Understanding the config sync flow (Studio UI → DB → Gateway)
Path: examples/plugins/gateway/request_enricher/Capabilities: PostAuthDescription: Enriches authenticated requests with additional metadata and instructions before proxying to LLM. Most common gateway plugin pattern.Key Features:
Path: examples/plugins/gateway/message_modifier/Capabilities: PostAuthDescription: Similar to request enricher but focuses on modifying the message content specifically for chat/completion requests.Key Features:
Path: examples/plugins/gateway/gateway-service-test/Capabilities: PostAuth (for testing purposes)Description: Demonstrates all Gateway-specific Service API operations including app management, LLM info, budget status, and credential validation.Key Features:
Path: examples/plugins/gateway/custom-echo-endpoint/Capabilities: CustomEndpoint, UI, ConfigDescription: Serves a custom HTTP endpoint on the gateway that echoes back request metadata alongside user-configured custom content. Includes a Studio admin UI for editing the content.Key Features:
file-proxy-collector/ - Exports proxy logs to JSONL files
file-analytics-collector/ - Exports analytics to CSV or JSONL files
file-budget-collector/ - Exports budget data to CSV or JSONL files with optional aggregation
Description: Simple file-based data collectors for testing and local development. Write telemetry data (proxy logs, analytics, budget usage) to files instead of or in addition to the database.Features:
Multiple output formats (CSV, JSONL)
Daily log rotation
Optional aggregate summaries (budget collector)
Configurable output directories
Environment variable support
Replace or supplement database storage
Use Cases:
Local development and debugging
Understanding DataCollector interface
Simple log export without external dependencies
Custom analytics pipelines
Reduced database load in high-throughput scenarios