# (Legacy) Serverless Hosted API

{% hint style="info" %}
私たちは **推奨します** Serverless Hosted API の V2 を使用することを。V2 API はより高速です。\
\
[新しい API を使い始めるには、Serverless Hosted API V2 のドキュメントを参照してください。](/roboflow/roboflow-jp/deploy/serverless-hosted-api-v2.md)
{% endhint %}

## モデルのサポート

以下のモデルタイプは Serverless Hosted API (v1) でサポートされています:

| タスクタイプ                                                                                                     | Hosted API (v1) でサポートされています |
| ---------------------------------------------------------------------------------------------------------- | --------------------------- |
| [オブジェクト検出](/roboflow/roboflow-jp/deploy/serverless/object-detection.md)                                    | ✅                           |
| [分類](/roboflow/roboflow-jp/deploy/serverless/classification.md)                                            | ✅                           |
| [インスタンスセグメンテーション](/roboflow/roboflow-jp/deploy/serverless/instance-segmentation.md)                        | ✅                           |
| [セマンティックセグメンテーション](/roboflow/roboflow-jp/deploy/serverless/instance-segmentation/semantic-segmentation.md) | ✅                           |
| [Keypoint Detection](/roboflow/roboflow-jp/deploy/serverless/keypoint-detection.md)                        | ✅                           |

## レイテンシ比較 (v1 vs v2)

Serverless Hosted API に送信されたリクエストのエンドツーエンドのレイテンシは、いくつかの要因に依存します:

1. モデルアーキテクチャ。これは実行時間に影響します
2. 画像のサイズと解像度。これはアップロード時間と実行中のモデル推論時間に影響します
3. ネットワークのレイテンシと帯域幅。これはリクエストのアップロード時間とレスポンスのダウンロード時間に影響します。
4. サービスのサブスクリプション状況や特定の時点での他ユーザーによる利用状況。これによりキューイングのレイテンシが発生する場合があります

<figure><img src="/files/a511a8f4156e5a364f5cc295a0031c1c08dc1363" alt=""><figcaption></figcaption></figure>

下の表では、v1 と v2 の Serverless Hosted API の代表的なベンチマークを示しています。エンドツーエンドのレイテンシ (E2E) と実行時間 (Exec) の両方を示しています。これらの数値は参考値です。ユーザーご自身で以下を使用してベンチマークを実施することをお勧めします [弊社の inference benchmark tools](https://inference.roboflow.com/inference_helpers/cli_commands/benchmark/) または独自のカスタムベンチマーク。

<table><thead><tr><th width="176.14410400390625">モデル</th><th>V2 (E2E)</th><th>V2 (Exec)</th><th>V1 (E2E)</th><th>V1 (Exec)</th></tr></thead><tbody><tr><td>yolov8x-640</td><td>401 ms</td><td>29 ms</td><td>4084 ms</td><td>821 ms</td></tr><tr><td>yolov8m-640</td><td>757 ms</td><td>21 ms</td><td>572 ms</td><td>265 ms</td></tr><tr><td>yolov8n-640</td><td>384 ms</td><td>17 ms</td><td>312 ms</td><td>63 ms</td></tr><tr><td>yolov8x-1280</td><td>483 ms</td><td>97 ms</td><td>6431 ms</td><td>3032 ms</td></tr><tr><td>yolov8m-1280</td><td>416 ms</td><td>52 ms</td><td>1841 ms</td><td>1006 ms</td></tr><tr><td>yolov8n-1280</td><td>428 ms</td><td>35 ms</td><td>464 ms</td><td>157 ms</td></tr></tbody></table>

各自のモデル推論とワークフローについて独自にベンチマークを実施し、各ユースケースにおける実際の指標を把握することを推奨します。

## 制限

Serverless Hosted API (v1) は、具体的なタスク種別にかかわらず、最大 5MB のファイルを受け付けます。この制限には、画像ファイルサイズに加え、添付されたリクエスト情報なども含まれますが、これらに限定されません。

{% hint style="info" %}
リクエストが大きすぎる場合は、添付画像のサイズを縮小することを推奨します。通常、画像はサーバーで受信された後に、モデルアーキテクチャが受け付ける入力サイズまでいずれにせよ縮小されるため、性能が悪化することはありません。\
\
Python SDK など一部の SDK では、API に送信する前に画像をモデルアーキテクチャの入力サイズまで自動的に縮小します。
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.roboflow.com/roboflow/roboflow-jp/deploy/serverless.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
