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?

画像生成AIを呼び出せるAPIサービスを作った

Last updated at Posted at 2025-02-18

イナズマAI という、画像生成AIを呼び出せるWeb APIサービスを開発しました。API製品なので、エンジニア向けのサービスです。

イナズマAIのAPIはカンタンに使えるように設計されています。

  1. 会員登録
  2. APIキー発行
  3. クレジット購入
  4. リクエスト送信

これでイナズマAIが提供するモデルを利用して画像生成が利用できます。

1. 会員登録

https://inazuma.ai にアクセスして、会員登録を進めてください。

2. APIキー発行

登録したら、APIキーを発行してください。

3. クレジット購入

API利用に必要なクレジットを購入してください。1クレジット1円で計算できます。

たとえば Stable Diffusion 3.5 モデルは1回の生成につき12クレジット(円)かかります。
FLUX モデルであれば 1円~ モデルを用意しています。

4. リクエスト送信

あとはHTTPリクエストを送信するだけです。
プロンプトはChatGPT等のLLMに英語で書かせると良いです。

サンプルコード:

JS:

const response = await fetch("https://api.inazuma.ai/v1/images/generations",
{
  method: "POST",
  headers: {
    Authorization: "Bearer YOUR_API_KEY",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    model: "stability-ai/stable-diffusion-3.5-large",
    prompt: "Tokyo Tower"
  })
}
);
const data = await response.json();
console.log(data.images[0].url);

cURL:

curl --request POST \
  --url https://api.inazuma.ai/v1/images/generations \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
  "prompt": "stability-ai/stable-diffusion-3.5-large",
  "model": "Tokyo Tower"
}'

(YOUR_API_KEY部分にはあなたが作成したキーを記述してください)

使えるモデル

なお、サンプルコードではStable Diffusionですが、FLUXも使えます。
詳しくは下記ページをご覧ください。

今後も以下のようなモデルを増やしていきたいと思っています。

  • Recraft v3
  • Imagen 3
  • DeepSeek (LLMだが対応したい)
  • Upscale系
  • Remove Background系
  • その他の編集できる系のモデル

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?