utils-modelinfo

command
v0.3.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 24, 2025 License: MIT Imports: 8 Imported by: 0

README

Utils Model Info Example

This example demonstrates the model discovery utility in the go-llms library, showcasing how to fetch and display information about models available from various LLM providers.

Features

  • Fetches model information from OpenAI, Anthropic, and Google
  • Caches results to reduce redundant API calls
  • Displays model details in structured JSON format
  • Supports filtering by provider, capability, and model name

Usage

# Fetch and display all models
go run main.go

# Fetch and display models from a specific provider
go run main.go --provider openai

# Fetch and display models with specific capabilities
go run main.go --capability image-input

# Available capability filters:
# - text-input
# - text-output  
# - image-input
# - image-output
# - audio-input
# - audio-output
# - video-input
# - video-output
# - function-calling
# - streaming
# - json-mode

# Filter by model name pattern
go run main.go --name "gpt-4"

# Force fresh data (ignore cache)
go run main.go --fresh

# Specify custom cache file location
go run main.go --cache-path ./my-cache.json

Environment Variables

The example requires API keys for providers you want to fetch data from:

  • OPENAI_API_KEY - OpenAI API key
  • ANTHROPIC_API_KEY - Anthropic API key (optional - will use hardcoded data)
  • GEMINI_API_KEY - Google/Gemini API key

Without these keys, the example will fall back to hardcoded model information where available.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL