一键导入
add-provider
Add a new AI provider to aico (e.g. a new OpenAI-compatible API service). Scaffolds provider package and registers it in the CLI.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Add a new AI provider to aico (e.g. a new OpenAI-compatible API service). Scaffolds provider package and registers it in the CLI.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | add-provider |
| description | Add a new AI provider to aico (e.g. a new OpenAI-compatible API service). Scaffolds provider package and registers it in the CLI. |
| argument-hint | [provider-name] |
Scaffold a new AI provider package and integrate it into the aico CLI.
$ARGUMENTS is the provider name (e.g. together, fireworks, deepseek).
Before writing any code, gather the following:
AICO_DEEPSEEK_API_KEYIf the user provides a reference URL, fetch it. Otherwise, search the web for the provider's API documentation.
Read at least one complete provider to understand the pattern:
internal/providers/groq/groq.go + one model file (e.g. llama3_3_70b.go)internal/providers/anthropic/anthropic.go + one model fileMost new providers will be OpenAI-compatible (same API shape as Groq/Cerebras).
Create internal/providers/<provider>/ with:
<provider>.go — Provider main fileMust contain:
const Endpoint = "https://..." — API endpointconst ProviderName = "<provider>" — provider identifierfunc AvailableModels() []assistant.ModelDescriptor — returns all model structsfunc DescribeModel(modelName string) (desc string, found bool) — lookup by namefunc selectModel(modelName string) (assistant.GenerativeModel, bool) — internal switchfunc NewGenerativeModel(modelName, apiKey string) (assistant.GenerativeModel, error) — factoryTemplate: internal/providers/groq/groq.go
Follow the same pattern as the add-model skill. For OpenAI-compatible providers:
package <provider>
import (
"context"
"iter"
"micheam.com/aico/internal/assistant"
"micheam.com/aico/internal/providers/openai"
)
type ModelStruct struct {
systemInstruction []*assistant.TextContent
client *openai.APIClient
}
var _ assistant.GenerativeModel = (*ModelStruct)(nil)
func NewModelStruct(apiKey string) *ModelStruct {
return &ModelStruct{client: openai.NewAPIClient(apiKey)}
}
func (m *ModelStruct) Provider() string { return ProviderName }
func (m *ModelStruct) Name() string { return "model-id" }
func (m *ModelStruct) Description() string { return `...` }
func (m *ModelStruct) SetSystemInstruction(contents ...*assistant.TextContent) {
m.systemInstruction = contents
}
func (m *ModelStruct) GenerateContent(ctx context.Context, msgs ...assistant.Message) (*assistant.GenerateContentResponse, error) {
return openai.GenerateContent(ctx, m.client, Endpoint, m.Name(), m.systemInstruction, msgs)
}
func (m *ModelStruct) GenerateContentStream(ctx context.Context, msgs ...assistant.Message) (iter.Seq2[*assistant.GenerateContentResponse, error], error) {
return openai.GenerateContentStream(ctx, m.client, Endpoint, m.Name(), m.systemInstruction, msgs)
}
Edit cmd/aico/models.go:
"micheam.com/aico/internal/providers/<provider>"allAvailableModels(): append <provider>.AvailableModels()...validateProviderModel(): add case <provider>.ProviderName:detectProviderByModelSpec(): add to the providers search order sliceEdit cmd/aico/main.go:
flagAPIKey<Provider> with env source AICO_<PROVIDER>_API_KEYdetectModel(): add case <provider>.ProviderName: to the provider switchIn the add-model skill's argument parsing and in any documentation, note the new provider's model name prefix pattern.
make test
go run ./cmd/aico models
go run ./cmd/aico models describe <new-model-id>
feat(api): add <Provider Name> provider with <Model Name> support