文件预览

SKILL.md

查看 Model Center 技能包中的文件内容。

文件内容

SKILL.md

---
name: model-center
description: Unified interface to 42+ NVIDIA NIM API models — LLM chat, vision, embeddings, image generation, with price comparison and model recommendation.
version: 1.0.0
tags:
  - nvidia
  - ai
  - llm
  - api
  - models
  - nim
category: "Data & APIs"
metadata:
  openclaw:
    requires:
      env:
        - NVIDIA_API_KEY
      bins:
        - python
    primaryEnv: NVIDIA_API_KEY
    envVars:
      - name: NVIDIA_API_KEY
        required: true
        description: NVIDIA NIM API key from https://build.nvidia.com
    emoji: 🤖
    homepage: https://build.nvidia.com
---

# NVIDIA AI Model Center

A Python skill that provides a unified interface to **42+ NVIDIA NIM API models** — LLM chat, vision analysis, text embeddings, image generation, and more.

## Quick Start

```python
from model_center import ModelCenter

center = ModelCenter()

# List all models
models = center.list_models()
print("Available categories:", list(models.keys()))

# Get model info
info = center.get_model_info('nemotron-3-super-8b')
print(f"Model: {info['name']}, Provider: {info['provider']}")

# Compare pricing
comparisons = center.compare_pricing(['nemotron-3-super-8b', 'llama-3.1-70b-instruct'])
for c in comparisons:
    print(f"{c['name']}: ${c['input_price']}/M in, ${c['output_price']}/M out")

# Get recommendations
rec = center.recommend_model('code generation', 'low', False)
print(f"Recommended: {rec}")

# Estimate cost
cost = center.estimate_cost('nemotron-3-super-8b', 1000, 500)
print(f"Estimated cost: ${cost['total_cost']}")

# Chat with a model (requires NVIDIA_API_KEY env var)
# response = center.chat_completion(
#     model='nemotron-3-super-8b',
#     messages=[{'role': 'user', 'content': 'Hello'}],
#     temperature=0.7,
#     max_tokens=100
# )
```

## Setup

1. Get an API key from [build.nvidia.com](https://build.nvidia.com)
2. Set the `NVIDIA_API_KEY` environment variable:
   ```powershell
   $env:NVIDIA_API_KEY = "nvapi-..."
   ```
3. Install dependency: `pip install requests`
4. Import and use `ModelCenter` or `NVIDIAAPIClient` from `model_center.py`

## API

### ModelCenter

| Method | Description |
|--------|-------------|
| `list_models(category)` | List all models or by category |
| `get_model_info(model_id)` | Get detailed model information |
| `compare_pricing(model_ids)` | Compare pricing across models |
| `recommend_model(use_case, budget, need_vision)` | AI-powered model recommendation |
| `estimate_cost(model, input_tokens, output_tokens)` | Estimate API call cost |
| `chat_completion(model, messages, ...)` | Chat completion API call |
| `generate_image(model, prompt, ...)` | Image generation API call |
| `get_embedding(model, input_text)` | Embedding API call |
| `chat(model, message, system_prompt)` | Simple chat interface |

### Categories

- **llm**: Chat completion models (Nemotron, Llama, Mixtral, etc.)
- **vision**: Image understanding models
- **embedding**: Text embedding models
- **image**: Image generation models
- **moderation**: Content moderation models

## Source

The implementation lives in `model_center.py` (548 lines) in this skill directory.