AI Features

AI Providers

Shiro ships three built-in provider implementations: OpenAI-compatible (cloud or self-hosted), Ollama (local models), and Gemini (Google AI Studio and Vertex AI). All implement the same Provider interface so they are interchangeable in workflow steps.

openai

cloud / self-hosted

Any API that speaks the OpenAI /v1/chat/completions protocol — OpenAI, Azure OpenAI, vLLM, LM Studio, Groq, Together AI, etc.

  • • Requires api_key
  • • Default base URL: https://api.openai.com/v1
  • • Supports custom headers
  • • Optional skip_tls_verify for self-signed certs
  • • Streaming supported

ollama

local

Local model server via Ollama. No API key required — ideal for air-gapped or private environments.

  • • No api_key needed
  • • Default base URL: http://localhost:11434
  • • Uses /api/chat endpoint
  • • Streaming supported
  • • Pull models with ollama pull <model>

gemini

Google AI

Google's Gemini models via Google AI Studio or Vertex AI. Supports Gemini 1.5 Pro and other Gemini models.

  • • Requires api_key
  • • Two modes: Google AI Studio (API key) or Vertex AI (OAuth)
  • • Supports streaming
  • • Multi-modal support (text, images, code)
  • • Configurable project ID and location for Vertex AI

OpenAI Provider Config

.shiro/config.yaml
models:
  gpt-4o:
    provider: openai
    model: gpt-4o
    base_url: https://api.openai.com/v1
    api_key: "{{env.OPENAI_API_KEY}}"
    timeout: 60

  # Azure OpenAI
  azure-gpt4:
    provider: openai
    model: gpt-4
    base_url: https://YOUR_RESOURCE.openai.azure.com/openai/deployments/YOUR_DEPLOYMENT
    api_key: "{{env.AZURE_OPENAI_KEY}}"

  # vLLM / LM Studio / Groq etc.
  groq-llama:
    provider: openai
    model: llama3-8b-8192
    base_url: https://api.groq.com/openai/v1
    api_key: "{{env.GROQ_API_KEY}}"
FieldDescription
modelModel name as accepted by the API (e.g. gpt-4o, gpt-4-turbo)
base_urlOverride endpoint. Default: https://api.openai.com/v1
api_keyBearer token sent as Authorization header
timeoutRequest timeout in seconds (default: 30)
skip_tls_verifyDisable TLS cert check — useful for internal servers with self-signed certs
headersMap of extra HTTP headers to include in requests

Ollama Provider Config

.shiro/config.yaml
models:
  codellama:
    provider: ollama
    model: codellama:34b
    base_url: http://localhost:11434
    timeout: 120          # longer timeout for local inference

  llama3:
    provider: ollama
    model: llama3:8b      # faster, less capable

  mistral:
    provider: ollama
    model: mistral:7b

Pull a model before running workflows:

bash
ollama pull codellama:34b
ollama pull llama3:8b

Gemini Provider Config

.shiro/config.yaml
models:
  # Gemini (Google AI Studio)
  gemini:
    provider: gemini
    model: gemini-1.5-pro
    api_key: "{{env.GEMINI_API_KEY}}"
    api_type: "google-ai-studio"

  # Gemini (Vertex AI)
  gemini-vertex:
    provider: gemini
    model: gemini-1.5-pro
    api_key: "{{env.GOOGLE_ACCESS_TOKEN}}"
    api_type: "vertex-ai"
    project_id: "{{env.GOOGLE_PROJECT_ID}}"
    location: "us-central1"
FieldDescription
modelModel name (e.g. gemini-1.5-pro, gemini-1.5-flash)
api_keyAPI key for Google AI Studio or access token for Vertex AI
api_typeEither 'google-ai-studio' (API key) or 'vertex-ai' (OAuth)
project_idGoogle Cloud project ID (required for Vertex AI)
locationVertex AI location (e.g. us-central1, required for Vertex AI)

Provider Interface

All providers implement the same Go interface — they are fully interchangeable. See the API Contract for details.

go
type Provider interface {
    Generate(ctx context.Context, req *GenerateRequest) (*GenerateResponse, error)
    Stream(ctx context.Context, req *GenerateRequest) (<-chan StreamChunk, error)
    Close() error
}

type GenerateRequest struct {
    Model       string    // Model name
    Messages    []Message // Chat messages
    System      string    // System prompt
    Temperature float64
    MaxTokens   int
    TopP        float64
}