소개

Clova Studio Gov API를 실제 프로젝트에 적용하는 방법을 단계별로 안내합니다. 각 예제는 실제 사용 사례를 기반으로 작성되었으며, 복사하여 바로 사용할 수 있는 코드를 제공합니다.
웹 인터페이스 사용 방법은 Documentation 섹션을 참고하세요.

활용 예제

빠른 예제

사용 가능한 모델 종류와 특징은 언어 모델 종류를 참고하세요.

Python으로 간단한 Chat 호출

import requests

url = "https://api.clovastudio.go.kr/v1/chat/completions"
headers = {
    "Authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json"
}
data = {
    "model": "HCX-GOV-THINK",
    "messages": [
        {"role": "user", "content": "안녕하세요!"}
    ],
    "stream": True
}

response = requests.post(url, headers=headers, json=data)
print(response.json())

Node.js로 간단한 Chat 호출

const fetch = require('node-fetch');

const url = 'https://api.clovastudio.go.kr/v1/chat/completions';
const headers = {
  'Authorization': 'Bearer YOUR_API_KEY',
  'Content-Type': 'application/json'
};
const data = {
  model: 'HCX-GOV-THINK',
  messages: [
    { role: 'user', content: '안녕하세요!' }
  ],
  stream: true
};

fetch(url, {
  method: 'POST',
  headers: headers,
  body: JSON.stringify(data)
})
  .then(res => res.json())
  .then(json => console.log(json));
더 많은 예제가 계속 추가됩니다. 특정 사용 사례에 대한 예제가 필요하시면 이슈를 통해 요청해주세요.