Skip to content

Instantly share code, notes, and snippets.

@anntnzrb
Last active September 10, 2025 23:48
Show Gist options
  • Select an option

  • Save anntnzrb/c31bbbcbf8713f8399e8e4bcd8efcc6e to your computer and use it in GitHub Desktop.

Select an option

Save anntnzrb/c31bbbcbf8713f8399e8e4bcd8efcc6e to your computer and use it in GitHub Desktop.
models

Workflow for Adding New Providers or Models to the Platform

1. Initial Setup and Analysis

  • Review the project documentation (AGENTS.md) to understand:
    • Commands for validation (bun validate)
    • Code style guidelines (Bun with TypeScript ESM modules, Zod schemas, etc.)
    • Architecture (monorepo with packages/ directory, TOML config files in providers/)
  • Examine existing provider configurations in the providers/ directory to understand the structure
  • Study existing model configurations to understand the required fields and format

2. Provider Configuration (for new providers)

  • Create a new directory in providers/ with the provider name
  • Create a provider.toml file with the following required fields:
    name = "Provider Name"
    env = ["API_KEY_ENV_VAR"]
    npm = "@ai-sdk/package-name"
    api = "https://api.provider.com/v1"
    doc = "https://docs.provider.com/api"
    
  • Ensure the provider configuration follows the schema defined in packages/core/src/schema.ts

3. Model Configuration

  • Determine the appropriate subdirectory for the model within the provider's models/ directory (usually based on the model's organization)
  • Create a new TOML file for the model with the following required fields:
    name = "Model Name"
    release_date = "YYYY-MM-DD"
    last_updated = "YYYY-MM-DD"
    attachment = true/false
    reasoning = true/false
    temperature = true/false
    tool_call = true/false
    open_weights = true/false
    
    [limit]
    context = 131072
    output = 131072
    
    [modalities]
    input = ["text"]
    output = ["text"]
    
  • Optional fields include:
    knowledge = "YYYY-MM"
    
    [cost]
    input = 0.00
    output = 0.00
    

4. Validation

  • Run bun validate to check that all configurations are valid according to the schema
  • Address any validation errors that appear
  • Ensure the validation command completes with exit code 0

5. API Verification (for new models)

  • Obtain API credentials for the provider
  • Use curl or another HTTP client to verify that the model is available through the provider's API
  • Check that the model details (pricing, context limits, etc.) match what you've configured

6. Version Control

  • Create a new feature branch for your changes:
    git checkout -b feature/add-provider-model-name
    
  • Add and commit your changes with a conventional commit message:
    git add providers/provider-name/
    git commit -m "feat: add Model Name to Provider Name provider
    
    - Create TOML configuration for model-name model
    - Include proper pricing, context limits, and modality settings
    - Validate configuration with bun validate command
    - Verify model availability through provider API"
    

This workflow ensures that new providers and models are properly configured, validated, and integrated into the platform following all established conventions and best practices.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment