| name | autobot-provider |
| description | Add new LLM providers to Autobot with proper integration |
| tags | ["provider","llm","integration"] |
| metadata | {"scope":"feature-development"} |
Adding a New LLM Provider
Files to Create/Modify
-
Create provider implementation:
src/autobot/providers/<name>_provider.cr
- Inherit from
HttpProvider or implement Provider interface
-
Register provider:
- Add a new
ProviderSpec to the PROVIDERS list in src/autobot/providers/registry.cr.
- Ensure keywords and API URL are correctly specified.
-
Add configuration schema:
- Update
src/autobot/config/schema.cr with provider config if needed.
- Most HTTP providers work automatically if they follow OpenAI compatibility.
-
Create tests:
spec/autobot/providers/<name>_provider_spec.cr
- Test provider registration in
registry_spec.cr.
- Test API integration (mocked).
-
Add documentation:
docs/<name>.md - Provider setup guide.
- Update
docs/providers.md - Add to provider comparison.
Provider Implementation Template
# src/autobot/providers/<name>_provider.cr
module Autobot
module Providers
class <Name>Provider < HttpProvider
def initialize(
api_key : String,
api_base : String? = nil,
@model : String = "default-model",
@extra_headers = {} of String => String,
provider_name : String? = nil,
)
super(api_key, api_base)
@gateway = Providers.find_gateway(provider_name, api_key, api_base)
end
def chat(
messages : Array(Hash(String, JSON::Any)),
tools : Array(Hash(String, JSON::Any))? = nil,
model : String? = nil,
max_tokens : Int32 = DEFAULT_MAX_TOKENS,
temperature : Float64 = DEFAULT_TEMPERATURE,
) : Response
# Implement API-specific logic here
# Or call super for OpenAI-compatible APIs
super
end
def default_model : String
@model
end
end
end
end
Alternative: Non-HTTP Provider
For providers with non-standard APIs (like AWS Bedrock), inherit directly from Provider:
class BedrockProvider < Provider
# Implement abstract methods directly
# See src/autobot/providers/bedrock_provider.cr for full example
end
ProviderSpec Registration
Add to PROVIDERS in src/autobot/providers/registry.cr:
ProviderSpec.new(
name: "<name>",
keywords: ["<keyword1>", "<keyword2>"],
display_name: "<Display Name>",
api_url: "https://api.<provider>.com/v1/chat/completions",
)
Testing Checklist
Documentation Requirements
Each provider doc must include:
- API key acquisition instructions
- Supported models list
- Rate limits and pricing notes
- Special features (if any)
- Example configuration
When to Use
Use this skill when:
- Adding support for a new LLM service
- Integrating a new AI provider API
- Testing provider implementations
- Updating provider documentation
Related Skills: autobot-test