# curl

> 가장 단순한 확인 방법.

> 원문: https://oneport.kr/docs/guides/curl

**논스트리밍**

```bash
curl https://oneport.kr/v1/chat/completions \
  -H "Authorization: Bearer $ONEPORT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-sonnet-5",
    "messages": [{"role": "user", "content": "안녕하세요"}]
  }'
```

**스트리밍**

```bash
curl -N https://oneport.kr/v1/chat/completions \
  -H "Authorization: Bearer $ONEPORT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-5.6-terra",
    "messages": [{"role": "user", "content": "안녕하세요"}],
    "stream": true
  }'
```

**Anthropic 네이티브**

```bash
curl https://oneport.kr/v1/messages \
  -H "x-api-key: $ONEPORT_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-opus-5",
    "max_tokens": 1024,
    "messages": [{"role": "user", "content": "안녕하세요"}]
  }'
```

## 도구 호출

**tools 를 실어 보내기**

```bash
curl https://oneport.kr/v1/chat/completions \
  -H "Authorization: Bearer $ONEPORT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-sonnet-5",
    "messages": [{"role": "user", "content": "서울 날씨 알려줘"}],
    "tools": [{
      "type": "function",
      "function": {
        "name": "get_weather",
        "description": "도시의 지금 날씨",
        "parameters": {
          "type": "object",
          "properties": { "city": { "type": "string" } },
          "required": ["city"]
        }
      }
    }]
  }'
```

## 그 밖의 문

**임베딩 · 검열 · 읽어주기**

```bash
# 임베딩
curl https://oneport.kr/v1/embeddings \
  -H "Authorization: Bearer $ONEPORT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "model": "text-embedding-3-small", "input": "3학년 분수 단원" }'

# 검열 (무료)
curl https://oneport.kr/v1/moderations \
  -H "Authorization: Bearer $ONEPORT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "input": "검사할 문장" }'

# 읽어주기 (오디오가 그대로 와요)
curl https://oneport.kr/v1/audio/speech \
  -H "Authorization: Bearer $ONEPORT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "model": "tts-1", "input": "오늘 급식은 김치찌개입니다.", "voice": "alloy" }' \
  --output speech.mp3
```

## 확인용 두 줄

**요금 없이 되는지 보기**

```bash
# 지금 부를 수 있는 모델 (종류와 부를 주소까지)
curl https://oneport.kr/v1/models -H "Authorization: Bearer $ONEPORT_API_KEY"

# 잔액
curl https://oneport.kr/v1/credits -H "Authorization: Bearer $ONEPORT_API_KEY"
```

> **몇 번째에 성공했는지 보고 싶으시면**
>
> -i 를 붙여 헤더를 같이 받으세요. x-gateway-fallback-depth 가 0 이면 첫 번에 됐다는 뜻이고, 1 이상이면 벤더가 한 번 막았지만 저희가 다른 경로로 돌려 성공했다는 뜻이에요.

