# Serverless Hosted API

Roboflow にデプロイされたモデルには REST API が用意されており、これを通じて画像に対する推論を実行できます。このデプロイ方法は、デプロイ先デバイスで常時インターネット接続が利用できる環境に最適です。

Serverless Hosted API は以下で使用できます：

* [Workflows で](/roboflow/roboflow-jp/deploy/serverless-hosted-api-v2/use-in-a-workflow.md)
* [REST API で](/roboflow/roboflow-jp/deploy/serverless-hosted-api-v2/use-with-the-rest-api.md)
* の [Inference Python SDK](/roboflow/roboflow-jp/deploy/serverless-hosted-api-v2/use-with-python-sdk.md)

### Inference server

当社の Serverless Hosted API は、 [Inference Server](https://inference.roboflow.com/api/)によって提供されています。つまり、以下に示すように、Serverless Hosted API と self-hosting オプションを簡単に切り替えたり、その逆も可能です：

```python
from inference_sdk import InferenceHTTPClient

CLIENT = InferenceHTTPClient(
    # api_url="http://localhost:9001" # Self-hosted Inference server
    api_url="https://serverless.roboflow.com", # 当社の Serverless hosted API
    api_key="API_KEY" #  private models と data にアクセスするための任意項目
)

result = CLIENT.infer("image.jpg", model_id="model-id/1")
print(result)
```

### 制限

当社の Serverless Hosted API は、最大 20MB までのファイルアップロードをサポートしています。解像度の高い画像では制限に達する場合があります。問題が発生した場合は、enterprise support の担当者にご連絡いただくか、メッセージを投稿してください。 [forum](https://discuss.roboflow.com).

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

***

これは当社の Serverless Hosted API の V2 です。以下を参照してください： [Serverless Hosted API v1](/roboflow/roboflow-jp/deploy/serverless.md) v1（legacy）API ドキュメントについては


---

# 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-hosted-api-v2.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.
