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

# cURL

> cURL로 빠른 테스트와 스크립팅을 하세요.

## OpenAI 호환 엔드포인트

```bash theme={null}
curl https://api.arouter.ai/v1/chat/completions \
  -H "Authorization: Bearer lr_live_xxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai/gpt-5.4",
    "messages": [{"role": "user", "content": "Hello!"}]
  }'
```

### Provider 전환

```bash theme={null}
# OpenAI 호환 엔드포인트를 통한 Anthropic 사용
curl https://api.arouter.ai/v1/chat/completions \
  -H "Authorization: Bearer lr_live_xxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "anthropic/claude-sonnet-4.6",
    "messages": [{"role": "user", "content": "Hello!"}]
  }'
```

### 스트리밍

```bash theme={null}
curl https://api.arouter.ai/v1/chat/completions \
  -H "Authorization: Bearer lr_live_xxxx" \
  -H "Content-Type: application/json" \
  -N \
  -d '{
    "model": "openai/gpt-5.4",
    "messages": [{"role": "user", "content": "시를 써주세요."}],
    "stream": true
  }'
```

<Tip>
  `-N` 플래그는 출력 버퍼링을 비활성화하여 token이 실시간으로 표시됩니다.
</Tip>

## Anthropic 네이티브 엔드포인트

```bash theme={null}
curl https://api.arouter.ai/v1/messages \
  -H "X-Api-Key: lr_live_xxxx" \
  -H "Content-Type: application/json" \
  -H "anthropic-version: 2023-06-01" \
  -d '{
    "model": "claude-sonnet-4.6",
    "max_tokens": 1024,
    "messages": [{"role": "user", "content": "Hello!"}]
  }'
```

## Gemini 네이티브 엔드포인트

```bash theme={null}
curl "https://api.arouter.ai/v1beta/models/gemini-2.5-flash:generateContent?key=lr_live_xxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "contents": [{"parts": [{"text": "Hello!"}]}]
  }'
```

## 모델 목록

```bash theme={null}
curl https://api.arouter.ai/v1/models \
  -H "Authorization: Bearer lr_live_xxxx"
```

## 임베딩

```bash theme={null}
curl https://api.arouter.ai/v1/embeddings \
  -H "Authorization: Bearer lr_live_xxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai/text-embedding-3-small",
    "input": "The quick brown fox"
  }'
```

## Key 관리

관리 키（`lr_mgmt_`）를 사용하여 API key를 관리합니다.

### API Key 생성

```bash theme={null}
curl -X POST https://api.arouter.ai/api/v1/keys \
  -H "Authorization: Bearer lr_mgmt_xxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "backend-service",
    "allowed_providers": ["openai", "anthropic"],
    "limit": 150,
    "limit_reset": "monthly"
  }'
```

### API Key 목록

```bash theme={null}
curl https://api.arouter.ai/api/v1/keys \
  -H "Authorization: Bearer lr_mgmt_xxxx"
```

### API Key 업데이트

```bash theme={null}
curl -X PATCH https://api.arouter.ai/api/v1/keys/KEY_HASH \
  -H "Authorization: Bearer lr_mgmt_xxxx" \
  -H "Content-Type: application/json" \
  -d '{"disabled": true}'
```

### API Key 삭제

```bash theme={null}
curl -X DELETE https://api.arouter.ai/api/v1/keys/KEY_HASH \
  -H "Authorization: Bearer lr_mgmt_xxxx"
```
