roboflow-api-reference

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese
For agents: This skill is authored in
roboflow/computer-vision-skills
. If your client already has it loaded as a skill (for example from a Roboflow plugin), use that copy. The
skill://roboflow/<name>/SKILL.md
MCP resources serve the same skills for clients that don't have them loaded.
Tip: If you're connected to the Roboflow MCP server, prefer its tools (
projects_*
,
versions_*
,
models_*
,
workflows_*
,
images_*
, …) over raw REST calls — they handle auth, pagination, and typed responses for you. The REST patterns below stay relevant if you're not using MCP.
对于 Agent: 此 skill 编写于
roboflow/computer-vision-skills
。如果你的客户端已经将其作为 skill 加载(例如通过 Roboflow 插件加载),请使用该副本。对于尚未加载这些 skill 的客户端,
skill://roboflow/<name>/SKILL.md
MCP resources 提供相同的 skills。
提示: 如果你已连接到 Roboflow MCP server,请优先使用其 tools(
projects_*
、
versions_*
、
models_*
、
workflows_*
、
images_*
等),而不是原始 REST calls——它们会为你处理身份验证、分页和类型化响应。如果未使用 MCP,以下 REST 模式仍然适用。

Roboflow API Reference — Overview

Roboflow API 参考——概述

API Hosts

API 主机

HostBase URLPurpose
Platform API
https://api.roboflow.com
CRUD for projects, images, versions, training, upload
Serverless Inference
https://serverless.roboflow.com
Model inference + Workflow execution
Dedicated Deployment
https://<name>.roboflow.cloud
Private GPU inference (same API as serverless)
Self-hosted Inference
http://localhost:9001
Local inference server via
inference
package
Use the
inference-sdk
Python package as the preferred client for all inference hosts. It handles auth, retries, and response parsing.
主机基础 URL用途
Platform API
https://api.roboflow.com
项目、图像、版本、训练和上传的 CRUD
Serverless Inference
https://serverless.roboflow.com
模型推理 + Workflow 执行
Dedicated Deployment
https://<name>.roboflow.cloud
私有 GPU 推理(与 serverless 使用相同的 API)
Self-hosted Inference
http://localhost:9001
通过
inference
package 在本地运行推理服务器
对于所有 inference 主机,首选使用
inference-sdk
Python package 作为客户端。它负责处理身份验证、重试和响应解析。

Authentication

身份验证

MethodWhereFormat
Query parameterAll hosts
?api_key=YOUR_KEY
Request bodyPlatform API + Workflow inference
"api_key": "YOUR_KEY"
in JSON body
HeaderMCP server (
mcp.roboflow.com
)
x-api-key: YOUR_KEY
(handled automatically by MCP)
API keys are workspace-scoped. Get yours from Workspace Settings > API Keys in the Roboflow dashboard (
app.roboflow.com/{workspace}/settings/api
). Personal API keys are at
/settings/account
→ API Keys tab.
方法位置格式
查询参数所有主机
?api_key=YOUR_KEY
请求正文Platform API + Workflow 推理JSON 正文中的
"api_key": "YOUR_KEY"
请求头MCP server(
mcp.roboflow.com
)
x-api-key: YOUR_KEY
(由 MCP 自动处理)
API key 的作用域为 workspace。可在 Roboflow dashboard(
app.roboflow.com/{workspace}/settings/api
)的 Workspace Settings > API Keys 中获取你的 key。个人 API keys 位于
/settings/account
→ API Keys 标签页。

SDKs

SDK

SDKInstallPrimary Use
Python (
inference-sdk
)
pip install inference-sdk
Inference via
InferenceHTTPClient
Python (
roboflow
)
pip install roboflow
Upload, training, project management
JavaScript (
roboflow.js
)
Browser script tagReal-time on-device web inference
iOS (Swift)CocoaPods/SPMOn-device mobile inference
SDK安装方式主要用途
Python(
inference-sdk
)
pip install inference-sdk
通过
InferenceHTTPClient
进行推理
Python(
roboflow
)
pip install roboflow
上传、训练和项目管理
JavaScript(
roboflow.js
)
浏览器 script 标签实时设备端 Web 推理
iOS(Swift)CocoaPods/SPM设备端移动推理

Python inference-sdk Quick Start

Python inference-sdk 快速入门

python
from inference_sdk import InferenceHTTPClient

CLIENT = InferenceHTTPClient(
    api_url="https://serverless.roboflow.com",  # or dedicated URL, or localhost
    api_key="YOUR_KEY"
)
result = CLIENT.infer("image.jpg", model_id="your-project/1")
python
from inference_sdk import InferenceHTTPClient

CLIENT = InferenceHTTPClient(
    api_url="https://serverless.roboflow.com",  # or dedicated URL, or localhost
    api_key="YOUR_KEY"
)
result = CLIENT.infer("image.jpg", model_id="your-project/1")

Python roboflow SDK Quick Start

Python roboflow SDK 快速入门

python
import roboflow

rf = roboflow.Roboflow(api_key="YOUR_KEY")
project = rf.workspace("my-workspace").project("my-project")
python
import roboflow

rf = roboflow.Roboflow(api_key="YOUR_KEY")
project = rf.workspace("my-workspace").project("my-project")

Upload

Upload

project.upload(image_path="image.jpg", split="train")
project.upload(image_path="image.jpg", split="train")

Inference

Inference

model = project.version(1).model result = model.predict("image.jpg", confidence=40).json()
undefined
model = project.version(1).model result = model.predict("image.jpg", confidence=40).json()
undefined

Host Selection Guide

主机选择指南

TaskHost to Use
Run model inference
serverless.roboflow.com
Run Workflows
serverless.roboflow.com
Upload images
api.roboflow.com
Manage projects/versions
api.roboflow.com
Start training
api.roboflow.com
High-throughput / SLA inferenceDedicated deployment URL
Air-gapped / on-prem inferenceSelf-hosted
localhost:9001
Real-time video / webcam / RTSPWebRTC via
inference_sdk.webrtc
against serverless or local — see
skill://roboflow/roboflow-inference/workflows.md
("Video Stream" section). Not a plain HTTP call.
任务应使用的主机
运行模型推理
serverless.roboflow.com
运行 Workflows
serverless.roboflow.com
上传图像
api.roboflow.com
管理项目/版本
api.roboflow.com
启动训练
api.roboflow.com
高吞吐量 / SLA 推理Dedicated deployment URL
Air-gapped / 本地部署推理Self-hosted
localhost:9001
实时视频 / 摄像头 / RTSP通过
inference_sdk.webrtc
对 serverless 或 local 使用 WebRTC——请参阅
skill://roboflow/roboflow-inference/workflows.md
(“Video Stream”部分)。这不是普通的 HTTP 调用。

Rate Limits

速率限制

  • Serverless API: rate limits vary by plan
  • File upload max: 20 MB
  • Serverless API:速率限制因套餐而异
  • 文件上传最大 20 MB

Related Pages

相关页面

  • skill://roboflow/roboflow-api-reference/inference.md
    — inference URL patterns, request/response formats
  • skill://roboflow/roboflow-api-reference/rest-api.md
    — platform REST API endpoints (CRUD, upload, training)
  • skill://roboflow/roboflow-api-reference/api-key-management.md
    — creating and managing API keys via REST, MCP tools, and Python CLI. When creating a key, scope it to least privilege if the workspace has Advanced API Keys; if not, tell the user scoped keys are an Enterprise feature.
  • skill://roboflow/roboflow-api-reference/inference.md
    ——推理 URL 模式和请求/响应格式
  • skill://roboflow/roboflow-api-reference/rest-api.md
    ——Platform REST API endpoints(CRUD、上传、训练)
  • skill://roboflow/roboflow-api-reference/api-key-management.md
    ——通过 REST、MCP tools 和 Python CLI 创建及管理 API keys。创建 key 时,如果 workspace 具备 Advanced API Keys,应将其 scope 设为最小权限;如果不具备,则需告知用户 scoped keys 是 Enterprise 功能。