> ## 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와 함께 Claude Code 사용하기

> 이 가이드를 사용해 Anthropic 호환 자격 증명, base URL 설정, Claude model ID를 통해 Claude Code를 CometAPI에 구성하세요.

이 가이드를 사용해 [Claude Code](https://code.claude.com/docs/en/overview)를 CometAPI에 연결하세요.

공식 참고 문서:

* [Claude Code Overview](https://code.claude.com/docs/en/overview)
* [Claude Code Getting Started](https://code.claude.com/docs/en/getting-started)

<Note>
  모델 제공 여부는 시간에 따라 변경됩니다. 현재 Claude model ID는
  [CometAPI Models page](/ko/overview/models)에서 확인하세요.
</Note>

## 사전 준비

* [dashboard](https://www.cometapi.com)에서 발급한 CometAPI 키 (`sk-`로 시작)
* Git 설치
* 지원 운영체제: macOS, Linux 또는 Windows

## Claude Code 설치

<Steps>
  <Step title="공식 설치 프로그램 실행">
    <Tabs>
      <Tab title="macOS / Linux">
        ```bash theme={null}
        curl -fsSL https://claude.ai/install.sh | bash
        ```
      </Tab>

      <Tab title="Homebrew">
        ```bash theme={null}
        brew install --cask claude-code
        ```
      </Tab>

      <Tab title="Windows">
        PowerShell:

        ```powershell theme={null}
        irm https://claude.ai/install.ps1 | iex
        ```

        CMD:

        ```batch theme={null}
        curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd
        ```

        <Info>Windows에서는 먼저 [Git for Windows](https://git-scm.com/downloads/win)를 설치해야 합니다.</Info>
      </Tab>
    </Tabs>
  </Step>

  <Step title="설치 확인">
    ```bash theme={null}
    claude --version
    ```
  </Step>
</Steps>

## CometAPI 엔드포인트 구성

설정 파일을 생성하거나 수정하세요:

* macOS / Linux: `~/.claude/settings.json`
* Windows: `%USERPROFILE%\.claude\settings.json`

```json theme={null}
{
  "env": {
    "ANTHROPIC_AUTH_TOKEN": "sk-your-cometapi-key",
    "ANTHROPIC_BASE_URL": "https://api.cometapi.com"
  }
}
```

`sk-your-cometapi-key`를 실제 CometAPI 키로 바꾼 다음, Claude Code를 시작하세요:

```bash theme={null}
cd your-project
claude
```

## 문제 해결

<AccordionGroup>
  <Accordion title="settings.json이 적용되지 않음">
    1. 모든 창을 닫고 다시 열어 터미널을 완전히 재시작합니다.
    2. 그래도 작동하지 않으면 `~/.claude.json`을 생성하고 다음을 추가합니다:

    ```json theme={null}
    {
      "hasCompletedOnboarding": true
    }
    ```

    3. 대안으로 환경 변수를 직접 export합니다:

    ```bash theme={null}
    # Add to ~/.zshrc (macOS) or ~/.bashrc (Linux)
    export ANTHROPIC_AUTH_TOKEN="sk-your-cometapi-key"
    export ANTHROPIC_BASE_URL="https://api.cometapi.com"
    ```
  </Accordion>

  <Accordion title="유효하지 않은 API Key 또는 Please run /login">
    `~/.claude/settings.json`이 존재하는지, 그리고 JSON 형식이 올바른지 확인하세요. 후행 쉼표가 없어야 하고 따옴표도 정확해야 합니다. [jsonlint.com](https://jsonlint.com)에서 검증할 수 있습니다.
  </Accordion>

  <Accordion title="캐시된 공식 자격 증명이 사용됨">
    Claude Code는 캐시된 공식 자격 증명을 우선 사용합니다. Claude Code 내부에서 `/logout`을 실행하고 종료한 다음 다시 시작하세요.

    그래도 실패하면 캐시된 auth 파일을 삭제하세요:

    ```bash theme={null}
    rm -rf ~/.config/claude-code/auth.json
    ```
  </Accordion>

  <Accordion title="상태가 offline으로 표시됨">
    Claude Code는 Google을 통해 연결 상태를 확인합니다. `offline`은 Google에 도달할 수 없다는 의미입니다. 이는 CometAPI 사용에는 영향을 주지 않습니다.
  </Accordion>

  <Accordion title="Fetch 또는 웹 브라우징이 실패함">
    Claude Code의 Fetch 기능은 먼저 Anthropic의 네이티브 서비스를 호출하며, 이 과정에는 직접적인 인터넷 접속이 필요합니다. 시스템 전체 프록시가 필요할 수 있습니다.
  </Accordion>
</AccordionGroup>

<script type="application/ld+json">
  {`
    {
    "@context": "https://schema.org",
    "@graph": [
      {
        "@type": "HowTo",
        "@id": "https://apidoc.cometapi.com/integrations/claude-code#howto",
        "name": "CometAPI와 함께 Claude Code 사용하기",
        "description": "이 가이드를 사용해 Anthropic 호환 자격 증명, base URL 설정, Claude model IDs를 통해 Claude Code를 CometAPI와 함께 구성하세요.",
        "step": [
          {
            "@type": "HowToStep",
            "@id": "https://apidoc.cometapi.com/integrations/claude-code#step-1",
            "position": 1,
            "name": "사전 요구 사항 검토",
            "text": "CometAPI와 함께 Claude Code 사용하기 가이드의 사전 요구 사항 검토 단계를 완료하세요."
          },
          {
            "@type": "HowToStep",
            "@id": "https://apidoc.cometapi.com/integrations/claude-code#step-2",
            "position": 2,
            "name": "Claude Code 설치",
            "text": "CometAPI와 함께 Claude Code 사용하기 가이드의 Claude Code 설치 단계를 완료하세요."
          },
          {
            "@type": "HowToStep",
            "@id": "https://apidoc.cometapi.com/integrations/claude-code#step-3",
            "position": 3,
            "name": "CometAPI 엔드포인트 구성",
            "text": "CometAPI와 함께 Claude Code 사용하기 가이드의 CometAPI 엔드포인트 구성 단계를 완료하세요."
          }
        ]
      },
      {
        "@type": "BreadcrumbList",
        "itemListElement": [
          {
            "@type": "ListItem",
            "position": 1,
            "name": "CometAPI 문서",
            "item": "https://apidoc.cometapi.com/"
          },
          {
            "@type": "ListItem",
            "position": 2,
            "name": "연동",
            "item": "https://apidoc.cometapi.com/integrations"
          },
          {
            "@type": "ListItem",
            "position": 3,
            "name": "CometAPI와 함께 Claude Code 사용하기",
            "item": "https://apidoc.cometapi.com/integrations/claude-code"
          }
        ]
      }
    ]
    }
    `}
</script>
