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

# CometAPI CLI

> 모델과 채팅하고, 모델 메타데이터를 탐색하고, 멀티프로토콜 요청을 실행하고, 잔액을 확인하고, 터미널에서 사용량을 확인할 수 있도록 CometAPI 명령줄 인터페이스를 설치하고 사용하는 방법입니다.

[CometAPI CLI](https://pypi.org/project/cometapi-cli/)는 CometAPI의 공식 명령줄 도구입니다. 이 도구를 사용하면 모델과 채팅하고, 모델 카탈로그를 확인하고, 일회성 요청을 보내고, 잔액을 확인하고, 터미널에서 계정 사용량을 탐색할 수 있습니다.

설치 및 패키지 메타데이터를 위한 공개 홈페이지로 [PyPI 패키지 페이지](https://pypi.org/project/cometapi-cli/)를 사용하세요. 이 문서는 비공개 소스 저장소에 접근하지 않고도 동일한 명령을 자세히 설명합니다.

<Note>
  CometAPI CLI는 베타 버전입니다. 인터페이스가 안정화되는 동안 명령 이름과 옵션이 변경될 수 있습니다.
</Note>

## Features

* 스트리밍 출력 또는 대화형 REPL을 사용해 모델과 채팅
* provider, modality, endpoint, capability, context, pricing 필드를 포함한 모델 카탈로그 메타데이터 탐색
* `cometapi model info <id>`로 하나의 모델 확인
* `cometapi run`으로 Chat Completions, Responses, Anthropic Messages, 또는 Gemini Generate Content 형식을 통해 하나의 요청 전송
* 잔액, 계정 프로필, 사용 통계, API 키, 로그, 비동기 작업 기록 확인
* table, JSON, YAML, CSV, Markdown 데이터 출력
* `~/.config/cometapi/config.toml`에 로컬 설정 저장

## Prerequisites

* Python 3.10 이상
* [CometAPI API key](https://www.cometapi.com/console/token)

## CLI 설치

PyPI에서 패키지를 설치합니다:

<CodeGroup>
  ```bash pip theme={null}
  pip install cometapi-cli
  ```

  ```bash pipx theme={null}
  pipx install cometapi-cli
  ```

  ```bash uv theme={null}
  uv tool install cometapi-cli
  ```
</CodeGroup>

설치된 명령을 확인합니다:

```bash theme={null}
cometapi --version
cometapi -h
```

## CLI 시작하기

<Steps>
  <Step title="자격 증명 구성">
    설정 마법사를 실행합니다:

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

    환경 변수를 사용해 API key를 구성할 수도 있습니다:

    ```bash theme={null}
    export COMETAPI_KEY="your-api-key"
    ```

    선택 사항인 `COMETAPI_ACCESS_TOKEN` 값은 account, stats, tokens, logs, tasks 명령에만 필요합니다.
  </Step>

  <Step title="모델과 채팅하기">
    하나의 채팅 메시지를 보냅니다:

    ```bash theme={null}
    cometapi chat "Explain CometAPI in one sentence."
    ```

    메시지 없이 `cometapi chat`을 실행하면 채팅 REPL이 시작됩니다.
  </Step>

  <Step title="모델 탐색하기">
    공개 모델 카탈로그를 검색합니다:

    ```bash theme={null}
    cometapi models --search gpt --limit 10
    ```

    카탈로그 메타데이터로 필터링합니다:

    ```bash theme={null}
    cometapi models --provider openai --type chat --limit 10
    cometapi models --feature image --endpoint responses --json
    ```
  </Step>

  <Step title="하나의 모델 확인하기">
    하나의 모델에 대한 상세 메타데이터를 표시합니다:

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

    원시 상세 payload를 출력합니다:

    ```bash theme={null}
    cometapi model info your-model-id --json
    ```
  </Step>

  <Step title="멀티프로토콜 요청 실행하기">
    기본 chat endpoint를 통해 일회성 요청을 보냅니다:

    ```bash theme={null}
    cometapi run your-model-id -p "Reply with OK only."
    ```

    요청 본문이 다른 provider schema를 따를 때는 다른 endpoint format을 선택합니다:

    ```bash theme={null}
    cometapi run your-model-id --endpoint responses -p "Reply with OK only." --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
    ```
  </Step>
</Steps>

## 명령 도움말 보기

설치된 버전의 옵션을 확인하려면 루트 명령이나 하위 명령에 `-h`를 사용합니다:

```bash theme={null}
cometapi -h
cometapi models -h
cometapi model info -h
cometapi run -h
```

## 주요 명령

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

## 링크

* [PyPI package](https://pypi.org/project/cometapi-cli/)
* [Command reference](/ko/libraries/cli/commands)
* [Configuration guide](/ko/libraries/cli/configuration)
