メインコンテンツへスキップ

ステップ 1: APIキーの取得

1

アカウントの作成

lemondata.cc でメールアドレスを使用してサインアップします。
2

クレジットの追加

ダッシュボードに移動し、アカウントにクレジットを追加します。最低利用料金のない従量課金制です。
3

APIキーの作成

Dashboard → API Keys に移動し、新しいキーを作成します。一度しか表示されないため、安全にコピーして保管してください。
APIキーを安全に保管してください。クライアント側のコードや公開リポジトリに公開しないでください。

ステップ 2: SDKのインストール

pip install openai

ステップ 3: 最初のリクエストを送信する

curl https://api.lemondata.cc/v1/chat/completions \
  -H "Authorization: Bearer sk-your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-4o",
    "messages": [
      {"role": "system", "content": "You are a helpful assistant."},
      {"role": "user", "content": "What is the capital of France?"}
    ]
  }'

さまざまなモデルを試す

LemonDataは300以上のモデルをサポートしています。model パラメータを変更するだけです。
# OpenAI GPT-4o
response = client.chat.completions.create(model="gpt-4o", messages=messages)

# Anthropic Claude Sonnet 4.5
response = client.chat.completions.create(model="claude-sonnet-4-5", messages=messages)

# Google Gemini 2.5 Flash
response = client.chat.completions.create(model="gemini-2.5-flash", messages=messages)

# DeepSeek R1
response = client.chat.completions.create(model="deepseek-r1", messages=messages)

ストリーミングを有効にする

リアルタイムのレスポンスを得るには、ストリーミングを有効にします。
stream = client.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": "Tell me a story"}],
    stream=True
)

for chunk in stream:
    if chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="")

次のステップ