Catwalk Documentation
repository·main·Indexed 20 days ago
https://github.com/charmbracelet/catwalkCatwalk is an AI Provider Database that manages model information and capabilities across various providers via JSON files and specialized CLI tools. Designed as a storage layer for Crush-compatible data structures, it includes CLI tools to generate provider configurations for AIHubMix, Atlas Cloud, Avian, Baseten, Chutes, and GitHub Copilot.
What's inside catwalk
- Catwalk is a database designed specifically for models that are compatible with Crush. It serves as a storage layer for Crush-compatible data structures.
Update the Zai provider manually
mainThe
zaiprovider requires manual data extraction because specific parameters are not available via standard overview pages.To update
zai:- Retrieve the model list and capabilities from
https://docs.z.ai/guides/overview/overview. - For
context_windowanddefault_max_tokens, do not use the overview page. Instead, extract the exact values from./internal/providers/configs/openrouter.json.
- Retrieve the model list and capabilities from
Add a new provider command
mainTo extend Catwalk with a new provider, follow these steps:
- Create a new entry point at
./cmd/{provider-name}/main.go. - Determine the available models. You should attempt to use the provider's API to list models. If no API endpoint exists, look for structured text formats in their documentation.
- Constraint: If you cannot programmatically determine the models, do not create a command. Instead, add the provider to the
MANUAL_UPDATES.mdfile. - Register the new command in the GitHub Actions workflow at
.github/workflows/update.ymlto ensure it is included in automated updates.
- Create a new entry point at
Build and run Catwalk commands
mainYou can use the following Go commands to interact with the Catwalk project:
- Start the HTTP server: Runs the main server on port
:8080. - Run a provider CLI: Builds and runs a specific CLI tool to update a provider's JSON file (e.g.,
go run ./cmd/openai). - Run tests: Executes all tests in the repository.
go run . go run ./cmd/{provider-name} go test ./...- Start the HTTP server: Runs the main server on port
Generate xAI provider configuration via xai CLI
mainThe
xaicommand-line tool fetches the latest available models from the xAI API and generates a structured JSON configuration file for use within the Catwalk ecosystem.To use this tool, you must have the
XAI_API_KEYenvironment variable set. The tool performs the following steps:- Fetches model metadata from
https://api.x.ai/v1/language-models. - Maps xAI model IDs to their shortest available aliases.
- Calculates pricing (converting cents per hundred million to dollars per million).
- Determines capabilities like context window size, reasoning support, and image modality support.
- Writes the resulting configuration to
internal/providers/configs/xai.json.
Note: The tool automatically skips models containing
multi-agentin their ID.# Ensure your API key is set export XAI_API_KEY="your_api_key_here" # Run the tool (assuming it is built and in your PATH) xai # The output will be written to: # internal/providers/configs/xai.json- Fetches model metadata from
Generate Avian provider configuration via avian CLI
mainThe
aviancommand-line tool fetches the latest models from the Avian API (https://api.avian.io/v1/models) and generates a provider configuration file compatible withcatwalk.This tool automates the creation of
internal/providers/configs/avian.json, mapping Avian's specific pricing and reasoning capabilities to thecatwalk.Providerandcatwalk.Modeltypes. It specifically handles:- Mapping reasoning capabilities to
reasoning_levels(low,medium,high). - Sorting models by name and then by ID.
- Setting the provider type to
OpenAICompat. - Configuring default large and small model IDs.
- Mapping reasoning capabilities to
Generate Synthetic provider configuration
mainThe
syntheticcommand-line tool fetches available models from the Synthetic API and generates asynthetic.jsonconfiguration file for use within Catwalk.Filtering Logic applied during generation:
- Models must have a
ContextLengthof at least 20,000. - Models must support both
textinput andtextoutput modalities. - Models must support
tools.
Configuration Details:
- The generated file is saved to
internal/providers/configs/synthetic.json. - The provider uses the
OpenAICompattype. - The API endpoint is
https://api.synthetic.new/openai/v1. - The API key is expected to be provided via the
SYNTHETIC_API_KEYenvironment variable.
- Models must have a
Generate OpenRouter configuration via CLI
mainThe
openroutercommand-line tool fetches the latest model list and endpoint details from the OpenRouter API to generate a structuredopenrouter.jsonconfiguration file. This file is used by Catwalk to provide a pre-configured OpenRouter provider.The tool performs the following logic during generation:
- Fetches all available models from
https://openrouter.ai/api/v1/models. - Filters for models that meet specific criteria: non-batch models, context length $\ge$ 20,000, support for
tools, and text-to-text modality. - For each valid model, it attempts to fetch specific endpoints via
https://openrouter.ai/api/v1/models/{model_id}/endpoints. - Selects the 'best' endpoint based on:
- Tool support (
toolsparameter). - Context length.
- Uptime (last 30 minutes).
- Tool support (
- Calculates pricing per 1 million tokens (input, output, cached input, and cached output).
- Determines reasoning capabilities (
low,medium,highlevels) if thereasoningparameter is supported. - Saves the resulting configuration to
internal/providers/configs/openrouter.json.
- Fetches all available models from
Initialize a Catwalk Client
mainYou can create a new
Clientinstance usingNew()orNewWithURL(url string).New(): Automatically uses theCATWALK_URLenvironment variable. If that variable is not set, it defaults tohttp://localhost:8080.NewWithURL(url): Allows you to specify a custom base URL for the service. The client includes a default HTTP timeout of 30 seconds.
import "github.com/charmbracelet/catwalk" // Using environment variables or default localhost:8080 client := catwalk.New() // Using a specific URL client, err := catwalk.NewWithURL("https://api.example.com")Generate OpenCode Go provider configuration
mainThe
opencode-gocommand fetches the latest model definitions fromhttps://models.dev/api.json, processes the pricing and reasoning capabilities, and generates a provider configuration file.This tool is used to keep the
opencode-go.jsonconfiguration in sync with the upstream model definitions. It automatically handles:- Rounding costs to two decimal places.
- Mapping reasoning levels (e.g.,
low,medium,high) based on the model ID. - Sorting models by name and then by ID.
The resulting configuration is written to
internal/providers/configs/opencode-go.jsonwith0600permissions.Generate io.net provider configuration
mainThe
ionetcommand-line tool fetches available models from the io.net API and generates a provider configuration file (ionet.json) used by Catwalk.It performs the following tasks:
- Fetches models from
https://api.intelligence.io.solutions/api/v1/models. - Filters models based on suitability for coding (e.g., prioritizing
deepseek-r1,llama-3.2,mistral-nemo). - Calculates costs per 1M tokens from per-token prices.
- Detects reasoning capabilities and reasoning levels (e.g., for
gpt-oss). - Writes the resulting configuration to
internal/providers/configs/ionet.json.
Note: The tool expects the
IONET_API_KEYenvironment variable to be available for the provider configuration.- Fetches models from
Generate Baseten provider configuration
mainThe
basetencommand-line tool fetches available models from the Baseten Model APIs and generates a structured JSON configuration file for use within the Catwalk ecosystem.Prerequisites
You must set the
BASETEN_API_KEYenvironment variable before running the tool.Workflow
- The tool queries
https://inference.baseten.co/v1/modelsusing your API key. - It filters models that support both
toolsandtextmodalities. - It calculates pricing per 1M tokens and maps model-specific reasoning capabilities (e.g.,
reasoning_effortlevels). - It writes the resulting configuration to
internal/providers/configs/baseten.json.
Output Format
The generated file is a JSON object representing a
catwalk.Providerwith the following fixed properties:- Name:
Baseten - ID:
catwalk.InferenceProviderBaseten - APIKey:
$BASETEN_API_KEY(as a literal string for environment variable substitution) - APIEndpoint:
https://inference.baseten.co/v1 - Type:
catwalk.TypeOpenAICompat
export BASETEN_API_KEY="your_api_key_here" go run cmd/baseten/main.go- The tool queries