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

# 빠른 시작

> 2분 안에 ARouter를 시작하세요. 코드 변경이 필요 없습니다——base_url과 api_key만 교체하면 됩니다.

ARouter는 주요 LLM 공급자를 위한 단일 API key와 단일 엔드포인트를 제공합니다. 이미 OpenAI 호환 클라이언트를 사용하고 있다면, 마이그레이션은 보통 `base_url`, `api_key`, 그리고 선택적으로 앱 귀속 헤더만 변경하면 됩니다.

## 1. API Key 받기

[ARouter 대시보드](https://api.arouter.ai)에서 가입하고 API key를 생성합니다.
key는 `lr_live_xxxxxxxxxxxx` 형식입니다.

## 2. ARouter SDK 설치

공식 `@arouter/sdk`는 모든 Node.js 또는 TypeScript 프로젝트에서 작동하며 npm, yarn, pnpm을 지원합니다.

<Tabs>
  <Tab title="npm">
    ```bash theme={null}
    npm install @arouter/sdk
    ```
  </Tab>

  <Tab title="yarn">
    ```bash theme={null}
    yarn add @arouter/sdk
    ```
  </Tab>

  <Tab title="pnpm">
    ```bash theme={null}
    pnpm add @arouter/sdk
    ```
  </Tab>
</Tabs>

```typescript theme={null}
import { ARouter } from "@arouter/sdk";

const client = new ARouter({
  apiKey: "lr_live_xxxx",
  baseURL: "https://api.arouter.ai",
});

const response = await client.chatCompletion({
  model: "openai/gpt-5.4",
  messages: [{ role: "user", content: "안녕하세요!" }],
});
console.log(response.choices[0].message.content);
```

스트리밍, key 관리, x402 결제 예시는 [Node.js / TypeScript SDK 가이드](/ko/sdks/node)를 참고하세요.

## 3. 기존 SDK 사용하기

이미 OpenAI, Anthropic, 또는 Go를 사용하고 있나요? `base_url`과 `api_key`만 변경하면 됩니다.

<Tabs>
  <Tab title="Python (OpenAI)">
    ```python theme={null}
    from openai import OpenAI

    client = OpenAI(
        base_url="https://api.arouter.ai/v1",
        api_key="lr_live_xxxx",
        default_headers={
            "HTTP-Referer": "https://myapp.com",  # 선택사항
            "X-Title": "My AI App",               # 선택사항
        },
    )

    response = client.chat.completions.create(
        model="openai/gpt-5.4",
        messages=[{"role": "user", "content": "안녕하세요!"}],
    )
    print(response.choices[0].message.content)
    ```
  </Tab>

  <Tab title="Node.js (OpenAI)">
    ```typescript theme={null}
    import OpenAI from "openai";

    const client = new OpenAI({
      baseURL: "https://api.arouter.ai/v1",
      apiKey: "lr_live_xxxx",
      defaultHeaders: {
        "HTTP-Referer": "https://myapp.com", // 선택사항
        "X-Title": "My AI App",              // 선택사항
      },
    });

    const response = await client.chat.completions.create({
      model: "openai/gpt-5.4",
      messages: [{ role: "user", content: "안녕하세요!" }],
    });
    console.log(response.choices[0].message.content);
    ```
  </Tab>

  <Tab title="Python (Anthropic)">
    ```python theme={null}
    import anthropic

    client = anthropic.Anthropic(
        base_url="https://api.arouter.ai",
        api_key="lr_live_xxxx",
    )

    message = client.messages.create(
        model="claude-sonnet-4.6",
        max_tokens=1024,
        messages=[{"role": "user", "content": "안녕하세요!"}],
    )
    print(message.content[0].text)
    ```
  </Tab>

  <Tab title="Go">
    ```go theme={null}
    package main

    import (
        "context"
        "fmt"
        "log"

        "github.com/arouter-ai/arouter-go"
    )

    func main() {
        client := arouter.NewClient("lr_live_xxxx",
            arouter.WithBaseURL("https://api.arouter.ai/v1"),
            arouter.WithHeader("HTTP-Referer", "https://myapp.com"),
            arouter.WithHeader("X-Title", "My AI App"),
        )

        resp, err := client.CreateChatCompletion(context.Background(), arouter.ChatCompletionRequest{
            Model: "openai/gpt-5.4",
            Messages: []arouter.Message{
                {Role: "user", Content: "안녕하세요!"},
            },
        })
        if err != nil {
            log.Fatal(err)
        }

        fmt.Println(resp.Choices[0].Message.Content)
    }
    ```
  </Tab>

  <Tab title="cURL">
    ```bash theme={null}
    curl https://api.arouter.ai/v1/chat/completions \
      -H "Authorization: Bearer lr_live_xxxx" \
      -H "HTTP-Referer: https://myapp.com" \
      -H "X-Title: My AI App" \
      -H "Content-Type: application/json" \
      -d '{
        "model": "openai/gpt-5.4",
        "messages": [{"role": "user", "content": "안녕하세요!"}]
      }'
    ```
  </Tab>

  <Tab title="fetch">
    ```typescript theme={null}
    const response = await fetch('https://api.arouter.ai/v1/chat/completions', {
      method: 'POST',
      headers: {
        'Authorization': 'Bearer lr_live_xxxx',
        'Content-Type': 'application/json',
        'HTTP-Referer': 'https://myapp.com', // 선택사항: 소스 추적
        'X-Title': 'My AI App',              // 선택사항: 표시 이름
      },
      body: JSON.stringify({
        model: 'openai/gpt-5.4',
        messages: [{ role: 'user', content: '안녕하세요!' }],
      }),
    });

    const data = await response.json();
    console.log(data.choices[0].message.content);
    ```
  </Tab>
</Tabs>

<Note>
  `HTTP-Referer`와 `X-Title`은 선택사항입니다. ARouter 대시보드 분석에서 요청을 특정 앱이나 워크플로우에 귀속시키려면 이 헤더들을 포함하세요.
</Note>

## 4. API 직접 호출하기

SDK를 설치하고 싶지 않다면 어떤 HTTP 클라이언트로든 ARouter를 호출할 수 있습니다:

```python theme={null}
import json
import requests

response = requests.post(
    "https://api.arouter.ai/v1/chat/completions",
    headers={
        "Authorization": "Bearer lr_live_xxxx",
        "HTTP-Referer": "https://myapp.com",  # 선택사항
        "X-Title": "My AI App",               # 선택사항
        "Content-Type": "application/json",
    },
    data=json.dumps({
        "model": "openai/gpt-5.4",
        "messages": [{"role": "user", "content": "안녕하세요!"}],
    }),
)

print(response.json()["choices"][0]["message"]["content"])
```

## 5. 다양한 공급자 사용해보기

ARouter에서는 `model` 문자열만 변경하면 공급자를 전환할 수 있습니다:

```python theme={null}
# OpenAI
response = client.chat.completions.create(model="openai/gpt-5.4", ...)

# Anthropic (OpenAI SDK를 통해!)
response = client.chat.completions.create(model="anthropic/claude-sonnet-4.6", ...)

# Google Gemini
response = client.chat.completions.create(model="google/gemini-2.5-flash", ...)

# DeepSeek
response = client.chat.completions.create(model="deepseek/deepseek-v3.2", ...)
```

<Tip>
  공급자 접두사를 생략하면 (예: `"gpt-5.4"`만 사용), ARouter는 기본적으로 OpenAI를 사용합니다.
</Tip>

## 다음 단계

<CardGroup cols={2}>
  <Card title="인증" icon="lock" href="/ko/authentication">
    세 가지 인증 방법 알아보기
  </Card>

  <Card title="모델 라우팅" icon="shuffle" href="/ko/model-routing">
    provider/model 형식과 멀티모델 라우팅 이해하기
  </Card>

  <Card title="결제 및 크레딧" icon="credit-card" href="/ko/guides/billing-and-credits">
    가격, 잔액, 크레딧 규칙 확인하기
  </Card>

  <Card title="요청 귀속" icon="globe" href="/ko/guides/request-attribution">
    대시보드 분석에서 트래픽을 앱에 귀속시키기
  </Card>

  <Card title="스트리밍" icon="wave-sine" href="/ko/guides/streaming">
    실시간 스트리밍 응답 활성화하기
  </Card>

  <Card title="도구 호출" icon="wrench" href="/ko/guides/features/tool-calling">
    모델에 함수 접근 권한 부여하기
  </Card>

  <Card title="구조화된 출력" icon="brackets-curly" href="/ko/guides/features/structured-outputs">
    모델이 유효한 JSON 스키마를 반환하도록 강제하기
  </Card>

  <Card title="프롬프트 캐싱" icon="bolt" href="/ko/guides/features/prompt-caching">
    반복 프롬프트의 비용과 지연 시간 줄이기
  </Card>

  <Card title="Key 관리" icon="key" href="/ko/guides/key-management">
    팀을 위한 범위 지정 key 생성하기
  </Card>

  <Card title="FAQ" icon="circle-question" href="/ko/faq">
    자주 묻는 질문 답변
  </Card>
</CardGroup>
