Cookbook 소개

Cookbook은 Clova Studio Gov 를 실제 프로젝트에 적용하는 방법을 단계별로 안내합니다. 각 예제는 실제 사용 사례를 기반으로 작성되었습니다.

웹 활용 예제

API 활용 예제

빠른 예제

모든 예제는 실제 작동하는 코드입니다. API 키만 교체하면 바로 사용할 수 있습니다.

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": "clova-x",
    "messages": [
        {"role": "user", "content": "안녕하세요!"}
    ]
}

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: 'clova-x',
  messages: [
    { role: 'user', content: '안녕하세요!' }
  ]
};

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