クイックスタート
数分で Rustellar を使い始めましょう。
前提条件
始める前に、以下を用意してください:
- API キー(platform.rustellar.com でサインアップ)
- REST API の基本知識
- お好みのプログラミング言語環境
インストール
cURL を使用
curl -X POST https://api.rustellar.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"model": "helix-v1",
"messages": [
{
"role": "user",
"content": "こんにちは、お元気ですか?"
}
]
}'
Python を使用
import requests
# APIキーを設定
api_key = "YOUR_API_KEY"
url = "https://api.rustellar.com/v1/chat/completions"
# リクエストヘッダー
headers = {
"Content-Type": "application/json",
"Authorization": f"Bearer {api_key}"
}
# リクエストボディ
data = {
"model": "helix-v1",
"messages": [
{
"role": "user",
"content": "こんにちは、お元気ですか?"
}
]
}
# APIリクエストを送信
response = requests.post(url, json=data, headers=headers)
print(response.json())
JavaScript を使用
// Node.jsでの使用例
const fetch = require('node-fetch');
const apiKey = 'YOUR_API_KEY';
const url = 'https://api.rustellar.com/v1/chat/completions';
// APIリクエストを送信
fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${apiKey}`
},
body: JSON.stringify({
model: 'helix-v1',
messages: [
{
role: 'user',
content: 'こんにちは、お元気ですか?'
}
]
})
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));