0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【副業におすすめ】VPSを使ってAIライティングツールを自作し、収益化する方法

Posted at

近年、ChatGPTなどのAIライティングツールを使った副業が注目を集めています。
本記事では、VPSサーバー上に自分専用のAIライティングツールを構築し、簡単に副業収入を得る方法を詳しく解説します。
PythonとOpenAI APIを活用した実装手順を紹介するので、エンジニア初心者でも再現可能です。

なぜVPS×AIライティングが副業に向いているのか?

  • 低コスト・高利益率:VPS月額5〜10ドル程度、API利用料は記事1本あたり数円レベル
  • 自動化できる:24時間稼働でき、複数ユーザーにサービス提供が可能
  • 需要が高い:ブログ記事代筆、SEOコンテンツ生成、SNS投稿作成など、個人事業主やWebライターのニーズが大きい
  • 海外サービスの制限回避:VPSを使えば、日本から直接使えないAI APIも利用可能

🛠 必要な準備

  • VPSサーバー
    • 例:LightNode(グローバル40+データセンター、時間課金対応)的国産VPS
    • Ubuntu 22.04、2CPU/4GB RAM推奨
  • OpenAI APIキー
  • Python 3.9以上
  • SSHクライアント
    • macOS/Linux:標準ターミナル
    • Windows:MobaXtermやTeraTermなど

🚀 ステップ1:VPSへ接続

ssh root@サーバーIPアドレス
apt update && apt upgrade -y

ステップ2:Python環境のセットアップ

apt install python3 python3-pip -y
pip3 install flask openai

ステップ3:Flaskアプリの作成

app.py を作成します。

from flask import Flask, request, render_template
import openai

app = Flask(__name__)
openai.api_key = "あなたのAPIキー"

@app.route("/", methods=["GET", "POST"])
def index():
    response_text = ""
    if request.method == "POST":
        prompt = request.form["prompt"]
        response = openai.ChatCompletion.create(
            model="gpt-3.5-turbo",
            messages=[
                {"role": "system", "content": "あなたはプロのWebライターです。SEOを意識した自然な日本語記事を執筆してください。"},
                {"role": "user", "content": prompt}
            ],
            max_tokens=600
        )
        response_text = response.choices[0].message["content"]
    return render_template("index.html", response=response_text)

if __name__ == "__main__":
    app.run(host="0.0.0.0", port=5000)

ステップ4:シンプルなHTMLテンプレート

templates/index.html を作成します。

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>AIライティングツール</title>
</head>
<body>
    <h2>AIライティングツール</h2>
    <form method="POST">
        <textarea name="prompt" rows="5" cols="50" placeholder="記事テーマを入力してください..."></textarea><br><br>
        <button type="submit">生成</button>
    </form>
    <h3>出力結果:</h3>
    <div style="border:1px solid #ccc; padding:10px;">
        {{ response }}
    </div>
</body>
</html>

ステップ5:アプリの起動

python3 app.py

ブラウザで以下にアクセス:

http://<サーバーIP>:5000

記事テーマを入力すると、自動でSEO対応した文章が生成されます。

バックグラウンドで常時稼働

nohup python3 app.py &

または pm2 を使用:

npm install -g pm2
pm2 start app.py --interpreter=python3

収益化アイデア

  • 記事生成サービスの提供

1記事500〜1000円程度で販売

  • 月額プラン

Webライター、ブロガー向けに使い放題プラン

  • SEOコンテンツ大量生成ツールとして貸し出し

アフィリエイター向けの自動記事生成ツールとして提供

注意点

  • OpenAIの利用規約を必ず確認

  • 無料枠を超えるとAPI課金が発生するため、料金設計が重要

  • VPSのセキュリティ設定(ファイアウォール、強力なパスワード)は必須

まとめ

  • VPS × OpenAI APIを使えば、自作AIライティングツールを低コストで構築可能

  • 自分専用の環境で安定稼働し、記事代行・SEO記事生成などの副業に活用できる

  • 技術的ハードルは低く、PythonとFlaskの基礎知識があればすぐに実装可能

  • 副業の第一歩として、まずはVPS上にこのツールを構築し、少額案件から始めてみましょう。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?