> ## 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.

# 명령어 참조

> chat, models, model info, run, balance, account, stats, tokens, logs, tasks, doctor, config, repl을 포함한 CometAPI CLI 명령어 참조입니다.

설치된 버전의 정확한 인자와 옵션을 확인하려면 `cometapi -h` 또는 `cometapi <command> -h`를 사용하세요.

## 명령어 개요

| Command           | Description                                            | Auth                    |
| ----------------- | ------------------------------------------------------ | ----------------------- |
| `chat [MESSAGE]`  | 채팅 메시지를 보내거나 채팅 REPL을 시작합니다                            | API key                 |
| `models`          | model 카탈로그 메타데이터를 나열하고 필터링합니다                          | API key                 |
| `model info <id>` | 단일 model의 공개 메타데이터를 확인합니다                              | API key                 |
| `run [MODEL]`     | chat, responses, anthropic 또는 gemini 형식으로 하나의 요청을 보냅니다 | API key                 |
| `balance`         | 계정 또는 현재 API key 잔액을 표시합니다                             | API key or access token |
| `account`         | 계정 프로필을 표시합니다                                          | Access token            |
| `stats`           | 사용 통계를 표시합니다                                           | Access token            |
| `tokens`          | API key를 나열하고 검색합니다                                    | Access token            |
| `logs`            | 필터와 함께 사용 로그를 탐색합니다                                    | Access token            |
| `tasks`           | 비동기 작업 로그를 표시합니다                                       | Access token            |
| `init`            | 설정 마법사를 실행합니다                                          | None                    |
| `doctor`          | 진단을 실행합니다                                              | API key                 |
| `config`          | 로컬 구성을 관리합니다                                           | None                    |
| `repl`            | 대화형 명령 셸을 시작합니다                                        | 사용한 명령어에 따라 다름          |

**Access token**으로 표시된 명령어는 `COMETAPI_ACCESS_TOKEN` 환경 변수 또는 `access_token` config 키가 필요합니다. 자세한 내용은 [구성 가이드](/ko/libraries/cli/configuration)를 참고하세요.

## 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`  | 사용할 model                  |
| `--system`             | `-s`  | 시스템 프롬프트(Prompt)           |
| `--temperature`        | `-t`  | 샘플링 temperature            |
| `--max-tokens`         |       | 최대 응답 토큰(Token) 수          |
| `--stream/--no-stream` |       | 스트리밍(Streaming) 사용 또는 비활성화 |
| `--format`             | `-f`  | 출력 형식                      |
| `--json`               |       | JSON으로 출력                  |

## Models

기본적으로 공개 카탈로그에서 models를 나열합니다. 카탈로그 출력에는 model ID, provider, model type, features, endpoints, pricing, context length, maximum 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`  | ID, code, name, description 또는 provider로 필터링 |
| `--provider`                |       | provider 이름 또는 code로 필터링                     |
| `--type`, `--modality`      |       | model type 또는 modality로 필터링                  |
| `--feature`, `--capability` |       | feature 또는 capability로 필터링                   |
| `--endpoint`                |       | endpoint 이름, method 또는 path로 필터링             |
| `--limit`                   | `-l`  | 최대 결과 수                                      |
| `--source`                  |       | `catalog` 메타데이터 또는 OpenAI 호환 `openai` 목록 사용  |
| `--refresh`                 |       | 1시간 카탈로그 캐시를 새로고침                            |
| `--no-cache`                |       | 이 명령어에 대해 카탈로그 캐시를 우회                        |
| `--format`                  | `-f`  | 출력 형식                                        |
| `--json`                    |       | JSON으로 출력                                    |

카탈로그 캐시는 `~/.cache/cometapi/models.json`에 저장됩니다.

## 모델 정보

하나의 model에 대한 공개 메타데이터를 확인합니다. 이 명령은 공개 카탈로그를 통해 model을 확인한 다음, 해당 카탈로그 코드의 상세 메타데이터를 불러옵니다.

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

| 옵션           | 단축   | 설명                  |
| ------------ | ---- | ------------------- |
| `--refresh`  |      | 조회 전에 카탈로그 캐시를 새로고침 |
| `--no-cache` |      | 이 명령에서 카탈로그 캐시를 우회  |
| `--format`   | `-f` | 출력 형식               |
| `--json`     |      | 원시 model 상세 JSON 출력 |

표 출력에는 provider, model 유형, 기능, 엔드포인트, 가격, 컨텍스트 길이, 최대 completion 토큰(Token), 문서 URL, 개요가 포함됩니다.

## 실행

선택한 엔드포인트 형식을 통해 하나의 요청을 전송합니다. JSON 본문에는 `--input-file`을 사용하고, 재정의에는 반복되는 `-i key=value` 값을 사용하며, 프롬프트(Prompt) 단축 입력에는 `-p/--prompt`를 사용합니다.

```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
```

| 옵션             | 단축   | 설명                                                      |
| -------------- | ---- | ------------------------------------------------------- |
| `--endpoint`   | `-e` | 엔드포인트 형식: `chat`, `responses`, `anthropic`, 또는 `gemini` |
| `--input-file` |      | JSON 객체 요청 본문                                           |
| `--input`      | `-i` | `key=value` 형식의 요청 입력; 여러 값을 위해 반복 가능                   |
| `--prompt`     | `-p` | 프롬프트(Prompt) 단축 입력                                      |
| `--json`       |      | 원시 JSON 응답 출력                                           |

엔드포인트 매핑:

| 엔드포인트       | 요청 경로                              | 인증                                    |
| ----------- | ---------------------------------- | ------------------------------------- |
| `chat`      | `POST /v1/chat/completions`        | Bearer API key                        |
| `responses` | `POST /v1/responses`               | Bearer API key                        |
| `anthropic` | `POST /v1/messages`                | `x-api-key` API key 및 Anthropic 버전 헤더 |
| `gemini`    | Gemini Generate Content model path | `x-goog-api-key` API key              |

본문 병합 순서는 `--input-file`, 반복되는 `-i key=value`, 프롬프트(Prompt) 단축 입력, 그다음 위치 인수 `MODEL`입니다. 인라인 값은 가능하면 JSON으로 파싱됩니다. 점으로 구분된 키는 중첩 객체를 생성합니다.

## 잔액

CometAPI 계정 잔액 또는 현재 API key 청구 보기를 표시합니다.

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

| 옵션         | 단축   | 설명                         |
| ---------- | ---- | -------------------------- |
| `--source` | `-s` | 데이터 소스: `account` 또는 `key` |
| `--format` | `-f` | 출력 형식                      |
| `--json`   |      | JSON으로 출력                  |

## 계정

계정 프로필을 표시합니다. 액세스 토큰이 필요합니다.

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

## 통계

사용 통계를 표시합니다. 액세스 토큰이 필요합니다.

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

## 토큰(Token)

API key를 나열하고 검색합니다. 액세스 토큰이 필요합니다.

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

| 옵션         | 단축   | 설명        |
| ---------- | ---- | --------- |
| `--search` | `-s` | 검색 키워드    |
| `--page`   | `-p` | 페이지 번호    |
| `--limit`  | `-l` | 페이지당 결과 수 |
| `--format` | `-f` | 출력 형식     |
| `--json`   |      | JSON으로 출력 |

## 로그

필터를 사용해 사용량 로그를 조회합니다. 액세스 토큰이 필요합니다.

```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         | Short | Description                       |
| -------------- | ----- | --------------------------------- |
| `--model`      | `-m`  | model ID로 필터링                     |
| `--token-name` | `-t`  | API 키 이름으로 필터링                    |
| `--type`       |       | 로그 유형                             |
| `--search`     | `-s`  | 키워드 검색                            |
| `--start`      |       | 시작 날짜                             |
| `--end`        |       | 종료 날짜                             |
| `--group`      | `-g`  | API 키 그룹으로 필터링                    |
| `--request-id` |       | `X-Cometapi-Request-Id`로 단일 요청 조회 |
| `--page`       | `-p`  | 페이지 번호                            |
| `--limit`      | `-l`  | 페이지당 결과 수                         |
| `--export`     |       | 서버 측 CSV를 stdout으로 출력             |
| `--format`     | `-f`  | 출력 형식                             |
| `--json`       |       | JSON으로 출력                         |

`logs --request-id`는 운영자 로그 엔드포인트에 대해 인덱싱된 단일 조회를 수행하며
정확히 일치하는 `request_id`만 허용합니다. CLI는 대체 로그 페이지를 스캔하지 않는데,
self-log 엔드포인트는 `request_id` 필터링을 적용하지 않기 때문입니다.

## 작업

비동기 작업 로그를 표시합니다. 액세스 토큰이 필요합니다.

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

| Option       | Short | Description |
| ------------ | ----- | ----------- |
| `--platform` | `-p`  | 플랫폼으로 필터링   |
| `--task-id`  |       | 작업 ID로 필터링  |
| `--status`   | `-s`  | 상태로 필터링     |
| `--action`   | `-a`  | 작업 유형으로 필터링 |
| `--start`    |       | 시작 날짜       |
| `--end`      |       | 종료 날짜       |
| `--page`     |       | 페이지 번호      |
| `--limit`    | `-l`  | 페이지당 결과 수   |
| `--format`   | `-f`  | 출력 형식       |
| `--json`     |       | JSON으로 출력   |

## Doctor

진단을 실행하여 구성과 API 연결성을 확인합니다.

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

## Config

`~/.config/cometapi/config.toml`에 저장된 CLI 구성을 관리합니다.

```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
```

사용 가능한 모든 키는 [구성 가이드](/ko/libraries/cli/configuration)를 참고하세요.

## Init

대화형 설정 마법사를 실행합니다:

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

## Repl

전체 대화형 명령 셸을 시작합니다:

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

## 출력 형식

대부분의 데이터 명령은 `--json` 또는 `--format`을 지원합니다:

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

| Format     | Description  |
| ---------- | ------------ |
| `table`    | 터미널의 리치 테이블  |
| `json`     | JSON 출력      |
| `yaml`     | YAML 출력      |
| `csv`      | 쉼표로 구분된 값    |
| `markdown` | Markdown 테이블 |
