> ## Documentation Index
> Fetch the complete documentation index at: https://apidoc.cometapi.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Befehlsreferenz

> Referenz für CometAPI-CLI-Befehle, einschließlich chat, models, model info, run, balance, account, stats, tokens, logs, tasks, doctor, config und repl.

Verwenden Sie `cometapi -h` oder `cometapi <command> -h`, um die genauen Argumente und Optionen für die installierte Version zu prüfen.

## Befehlsübersicht

| Command           | Description                                                                 | Auth                            |
| ----------------- | --------------------------------------------------------------------------- | ------------------------------- |
| `chat [MESSAGE]`  | Eine Chat-Nachricht senden oder das Chat-REPL starten                       | API key                         |
| `models`          | Metadaten des Modellkatalogs auflisten und filtern                          | API key                         |
| `model info <id>` | Die öffentlichen Metadaten eines Modells prüfen                             | API key                         |
| `run [MODEL]`     | Eine Anfrage über die Formate chat, responses, anthropic oder gemini senden | API key                         |
| `balance`         | Kontostand oder Guthaben des aktuellen API-Schlüssels anzeigen              | API key or access token         |
| `account`         | Kontoprofil anzeigen                                                        | Access token                    |
| `stats`           | Nutzungsstatistiken anzeigen                                                | Access token                    |
| `tokens`          | API-Schlüssel auflisten und durchsuchen                                     | Access token                    |
| `logs`            | Nutzungsprotokolle mit Filtern durchsuchen                                  | Access token                    |
| `tasks`           | Async-Task-Protokolle anzeigen                                              | Access token                    |
| `init`            | Den Einrichtungsassistenten ausführen                                       | None                            |
| `doctor`          | Diagnosen ausführen                                                         | API key                         |
| `config`          | Lokale Konfiguration verwalten                                              | None                            |
| `repl`            | Eine interaktive Befehls-Shell starten                                      | Hängt vom verwendeten Befehl ab |

Befehle mit der Kennzeichnung **Access token** erfordern die Umgebungsvariable `COMETAPI_ACCESS_TOKEN` oder den Konfigurationsschlüssel `access_token`. Weitere Informationen finden Sie im [Konfigurationsleitfaden](/de/libraries/cli/configuration).

## Chat

Senden Sie eine einzelne Nachricht oder starten Sie das mehrturnige Chat-REPL.

```bash theme={null}
cometapi chat "Explain CometAPI in one sentence."
cometapi chat "Summarize this" --model your-model-id --system "Be concise."
cometapi chat "Hello" --no-stream
cometapi chat "Hello" --json
cometapi chat
```

| Option                 | Short | Description                            |
| ---------------------- | ----- | -------------------------------------- |
| `--model`              | `-m`  | Zu verwendendes Modell                 |
| `--system`             | `-s`  | System-Prompt                          |
| `--temperature`        | `-t`  | Sampling-Temperatur                    |
| `--max-tokens`         |       | Maximale Antwort-Tokens                |
| `--stream/--no-stream` |       | Streaming aktivieren oder deaktivieren |
| `--format`             | `-f`  | Ausgabeformat                          |
| `--json`               |       | Als JSON ausgeben                      |

## Models

Modelle standardmäßig aus dem öffentlichen Katalog auflisten. Die Katalogausgabe enthält model ID, Anbieter, Modelltyp, Features, Endpoints, Preise, Kontextlänge und maximale Completion-Tokens.

```bash theme={null}
cometapi models
cometapi models --search gpt --limit 10
cometapi models --provider openai --type chat --limit 10
cometapi models --feature image --endpoint responses --json
cometapi models --refresh
cometapi models --source openai --search gpt
```

| Option                      | Short | Description                                                              |
| --------------------------- | ----- | ------------------------------------------------------------------------ |
| `--search`                  | `-s`  | Nach ID, code, name, description oder Anbieter filtern                   |
| `--provider`                |       | Nach Anbieternamen oder code filtern                                     |
| `--type`, `--modality`      |       | Nach Modelltyp oder Modalität filtern                                    |
| `--feature`, `--capability` |       | Nach Feature oder Capability filtern                                     |
| `--endpoint`                |       | Nach Endpoint-Name, Methode oder Pfad filtern                            |
| `--limit`                   | `-l`  | Maximale Anzahl von Ergebnissen                                          |
| `--source`                  |       | `catalog`-Metadaten oder OpenAI-kompatible `openai`-Auflistung verwenden |
| `--refresh`                 |       | Den einstündigen Katalog-Cache aktualisieren                             |
| `--no-cache`                |       | Den Katalog-Cache für diesen Befehl umgehen                              |
| `--format`                  | `-f`  | Ausgabeformat                                                            |
| `--json`                    |       | Als JSON ausgeben                                                        |

Der Katalog-Cache wird unter `~/.cache/cometapi/models.json` gespeichert.

## Model info

Prüfen Sie öffentliche Metadaten für ein Modell. Der Befehl löst das Modell über den öffentlichen Katalog auf und lädt dann Detailmetadaten für den Katalogcode.

```bash theme={null}
cometapi model info your-model-id
cometapi model info your-model-id --json
cometapi model info your-model-id --refresh
```

| Option       | Short | Beschreibung                                |
| ------------ | ----- | ------------------------------------------- |
| `--refresh`  |       | Katalog-Cache vor der Abfrage aktualisieren |
| `--no-cache` |       | Den Katalog-Cache für diesen Befehl umgehen |
| `--format`   | `-f`  | Ausgabeformat                               |
| `--json`     |       | Rohes JSON mit Modelldetails ausgeben       |

Die Tabellenausgabe enthält Anbieter, Modelltyp, Features, Endpoints, Preise, Kontextlänge, maximale Completion-Tokens, Dokumentations-URL und Übersicht.

## Run

Senden Sie eine Anfrage über ein ausgewähltes Endpoint-Format. Verwenden Sie `--input-file` für einen JSON-Body, wiederholte `-i key=value`-Werte für Überschreibungen und `-p/--prompt` als Prompt-Kurzform.

```bash theme={null}
cometapi run your-model-id -p "Write one sentence about CometAPI."
cometapi run your-model-id --endpoint responses -p "Reply with OK only." -i max_output_tokens=32 --json
cometapi run your-model-id --endpoint anthropic -p "Reply with OK only." -i max_tokens=32
cometapi run your-model-id --endpoint gemini -p "Reply with OK only." -i generationConfig.maxOutputTokens=32
cometapi run your-model-id --endpoint responses --input-file body.json -i temperature=0.2 --json
```

| Option         | Short | Beschreibung                                                    |
| -------------- | ----- | --------------------------------------------------------------- |
| `--endpoint`   | `-e`  | Endpoint-Format: `chat`, `responses`, `anthropic` oder `gemini` |
| `--input-file` |       | JSON-Objekt-Request-Body                                        |
| `--input`      | `-i`  | Anfrageeingabe als `key=value`; für mehrere Werte wiederholen   |
| `--prompt`     | `-p`  | Prompt-Kurzform                                                 |
| `--json`       |       | Rohes JSON der Antwort ausgeben                                 |

Endpoint-Zuordnung:

| Endpoint    | Request path                       | Auth                                                    |
| ----------- | ---------------------------------- | ------------------------------------------------------- |
| `chat`      | `POST /v1/chat/completions`        | Bearer-API-Schlüssel                                    |
| `responses` | `POST /v1/responses`               | Bearer-API-Schlüssel                                    |
| `anthropic` | `POST /v1/messages`                | `x-api-key`-API-Schlüssel und Anthropic-Versions-Header |
| `gemini`    | Gemini Generate Content-Modellpfad | `x-goog-api-key`-API-Schlüssel                          |

Die Body-Zusammenführungsreihenfolge ist `--input-file`, wiederholte `-i key=value`, Prompt-Kurzform und dann das positionale `MODEL`. Inline-Werte werden, wenn möglich, als JSON geparst. Punktnotation in Schlüsseln erzeugt verschachtelte Objekte.

## Balance

Zeigen Sie Ihr CometAPI-Kontoguthaben oder die aktuelle Abrechnungsansicht des API-Schlüssels an.

```bash theme={null}
cometapi balance
cometapi balance --source account
cometapi balance --source key
cometapi balance --json
```

| Option     | Short | Beschreibung                      |
| ---------- | ----- | --------------------------------- |
| `--source` | `-s`  | Datenquelle: `account` oder `key` |
| `--format` | `-f`  | Ausgabeformat                     |
| `--json`   |       | Als JSON ausgeben                 |

## Account

Zeigen Sie Ihr Kontoprofil an. Erfordert ein Zugriffstoken.

```bash theme={null}
cometapi account
cometapi account --json
```

## Stats

Zeigen Sie Nutzungsstatistiken an. Erfordert ein Zugriffstoken.

```bash theme={null}
cometapi stats
cometapi stats --json
```

## Tokens

API-Schlüssel auflisten und durchsuchen. Erfordert ein Zugriffstoken.

```bash theme={null}
cometapi tokens
cometapi tokens --search project
cometapi tokens --json
```

| Option     | Short | Beschreibung         |
| ---------- | ----- | -------------------- |
| `--search` | `-s`  | Suchbegriff          |
| `--page`   | `-p`  | Seitennummer         |
| `--limit`  | `-l`  | Ergebnisse pro Seite |
| `--format` | `-f`  | Ausgabeformat        |
| `--json`   |       | Als JSON ausgeben    |

## Logs

Nutzungsprotokolle mit Filtern durchsuchen. Erfordert ein Access Token.

```bash theme={null}
cometapi logs
cometapi logs --model your-model-id
cometapi logs --start 2026-04-01 --end 2026-04-14
cometapi logs --type consume
cometapi logs --export > usage.csv
cometapi logs --limit 50 --json
cometapi logs --request-id 20260617165550885561292gJBlzjtp
```

| Option         | Kurzform | Beschreibung                                           |
| -------------- | -------- | ------------------------------------------------------ |
| `--model`      | `-m`     | Nach model ID filtern                                  |
| `--token-name` | `-t`     | Nach API-Schlüsselnamen filtern                        |
| `--type`       |          | Protokolltyp                                           |
| `--search`     | `-s`     | Suchbegriff                                            |
| `--start`      |          | Startdatum                                             |
| `--end`        |          | Enddatum                                               |
| `--group`      | `-g`     | Nach API-Schlüsselgruppe filtern                       |
| `--request-id` |          | Eine Anfrage über `X-Cometapi-Request-Id` nachschlagen |
| `--page`       | `-p`     | Seitennummer                                           |
| `--limit`      | `-l`     | Ergebnisse pro Seite                                   |
| `--export`     |          | Serverseitiges CSV nach stdout ausgeben                |
| `--format`     | `-f`     | Ausgabeformat                                          |
| `--json`       |          | Als JSON ausgeben                                      |

`logs --request-id` führt eine einzelne indexierte Abfrage gegen den Operator-Log-Endpunkt aus und
akzeptiert nur eine exakte Übereinstimmung von `request_id`. Die CLI durchsucht keine Fallback-Log-Seiten,
weil der Self-Log-Endpunkt keine Filterung nach `request_id` anwendet.

## Tasks

Asynchrone Task-Protokolle anzeigen. Erfordert ein Access Token.

```bash theme={null}
cometapi tasks
cometapi tasks --platform kling
cometapi tasks --status SUCCESS
cometapi tasks --json
```

| Option       | Kurzform | Beschreibung            |
| ------------ | -------- | ----------------------- |
| `--platform` | `-p`     | Nach Plattform filtern  |
| `--task-id`  |          | Nach Task-ID filtern    |
| `--status`   | `-s`     | Nach Status filtern     |
| `--action`   | `-a`     | Nach Aktionstyp filtern |
| `--start`    |          | Startdatum              |
| `--end`      |          | Enddatum                |
| `--page`     |          | Seitennummer            |
| `--limit`    | `-l`     | Ergebnisse pro Seite    |
| `--format`   | `-f`     | Ausgabeformat           |
| `--json`     |          | Als JSON ausgeben       |

## Doctor

Diagnosen ausführen, um die Konfiguration und die API-Konnektivität zu überprüfen.

```bash theme={null}
cometapi doctor
cometapi doctor --json
```

## Config

Die in `~/.config/cometapi/config.toml` gespeicherte CLI-Konfiguration verwalten.

```bash theme={null}
cometapi config show
cometapi config set api_key "$COMETAPI_KEY"
cometapi config set default_model your-model-id
cometapi config unset api_key
cometapi config path
```

Siehe den [Konfigurationsleitfaden](/de/libraries/cli/configuration) für alle verfügbaren Schlüssel.

## Init

Den interaktiven Einrichtungsassistenten ausführen:

```bash theme={null}
cometapi init
```

## Repl

Eine vollständige interaktive Kommandozeilen-Shell starten:

```bash theme={null}
cometapi repl
```

## Output formats

Die meisten Datenbefehle unterstützen `--json` oder `--format`:

```bash theme={null}
cometapi models --json
cometapi models --format yaml
cometapi stats --format csv
cometapi account --format markdown
```

| Format     | Beschreibung                    |
| ---------- | ------------------------------- |
| `table`    | Formatierte Tabelle im Terminal |
| `json`     | JSON-Ausgabe                    |
| `yaml`     | YAML-Ausgabe                    |
| `csv`      | Kommagetrennte Werte            |
| `markdown` | Markdown-Tabelle                |
