roboflow-api-reference
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseFor agents: This skill is authored in. If your client already has it loaded as a skill (for example from a Roboflow plugin), use that copy. Theroboflow/computer-vision-skillsMCP resources serve the same skills for clients that don't have them loaded.skill://roboflow/<name>/SKILL.md
Tip: If you're connected to the Roboflow MCP server, prefer its tools (,projects_*,versions_*,models_*,workflows_*, …) 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.images_*
对于 Agent: 此 skill 编写于。如果你的客户端已经将其作为 skill 加载(例如通过 Roboflow 插件加载),请使用该副本。对于尚未加载这些 skill 的客户端,roboflow/computer-vision-skillsMCP resources 提供相同的 skills。skill://roboflow/<name>/SKILL.md
提示: 如果你已连接到 Roboflow MCP server,请优先使用其 tools(、projects_*、versions_*、models_*、workflows_*等),而不是原始 REST calls——它们会为你处理身份验证、分页和类型化响应。如果未使用 MCP,以下 REST 模式仍然适用。images_*
Roboflow API Reference — Overview
Roboflow API 参考——概述
API Hosts
API 主机
| Host | Base URL | Purpose |
|---|---|---|
| Platform API | | CRUD for projects, images, versions, training, upload |
| Serverless Inference | | Model inference + Workflow execution |
| Dedicated Deployment | | Private GPU inference (same API as serverless) |
| Self-hosted Inference | | Local inference server via |
Use the Python package as the preferred client for all inference hosts. It handles auth, retries, and response parsing.
inference-sdk| 主机 | 基础 URL | 用途 |
|---|---|---|
| Platform API | | 项目、图像、版本、训练和上传的 CRUD |
| Serverless Inference | | 模型推理 + Workflow 执行 |
| Dedicated Deployment | | 私有 GPU 推理(与 serverless 使用相同的 API) |
| Self-hosted Inference | | 通过 |
对于所有 inference 主机,首选使用 Python package 作为客户端。它负责处理身份验证、重试和响应解析。
inference-sdkAuthentication
身份验证
| Method | Where | Format |
|---|---|---|
| Query parameter | All hosts | |
| Request body | Platform API + Workflow inference | |
| Header | MCP server ( | |
API keys are workspace-scoped. Get yours from Workspace Settings > API Keys in the Roboflow dashboard (). Personal API keys are at → API Keys tab.
app.roboflow.com/{workspace}/settings/api/settings/account| 方法 | 位置 | 格式 |
|---|---|---|
| 查询参数 | 所有主机 | |
| 请求正文 | Platform API + Workflow 推理 | JSON 正文中的 |
| 请求头 | MCP server( | |
API key 的作用域为 workspace。可在 Roboflow dashboard()的 Workspace Settings > API Keys 中获取你的 key。个人 API keys 位于 → API Keys 标签页。
app.roboflow.com/{workspace}/settings/api/settings/accountSDKs
SDK
| SDK | Install | Primary Use |
|---|---|---|
Python ( | | Inference via |
Python ( | | Upload, training, project management |
JavaScript ( | Browser script tag | Real-time on-device web inference |
| iOS (Swift) | CocoaPods/SPM | On-device mobile inference |
| SDK | 安装方式 | 主要用途 |
|---|---|---|
Python( | | 通过 |
Python( | | 上传、训练和项目管理 |
JavaScript( | 浏览器 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()
undefinedmodel = project.version(1).model
result = model.predict("image.jpg", confidence=40).json()
undefinedHost Selection Guide
主机选择指南
| Task | Host to Use |
|---|---|
| Run model inference | |
| Run Workflows | |
| Upload images | |
| Manage projects/versions | |
| Start training | |
| High-throughput / SLA inference | Dedicated deployment URL |
| Air-gapped / on-prem inference | Self-hosted |
| Real-time video / webcam / RTSP | WebRTC via |
| 任务 | 应使用的主机 |
|---|---|
| 运行模型推理 | |
| 运行 Workflows | |
| 上传图像 | |
| 管理项目/版本 | |
| 启动训练 | |
| 高吞吐量 / SLA 推理 | Dedicated deployment URL |
| Air-gapped / 本地部署推理 | Self-hosted |
| 实时视频 / 摄像头 / RTSP | 通过 |
Rate Limits
速率限制
- Serverless API: rate limits vary by plan
- File upload max: 20 MB
- Serverless API:速率限制因套餐而异
- 文件上传最大 20 MB
Related Pages
相关页面
- — inference URL patterns, request/response formats
skill://roboflow/roboflow-api-reference/inference.md - — platform REST API endpoints (CRUD, upload, training)
skill://roboflow/roboflow-api-reference/rest-api.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/api-key-management.md
- ——推理 URL 模式和请求/响应格式
skill://roboflow/roboflow-api-reference/inference.md - ——Platform REST API endpoints(CRUD、上传、训练)
skill://roboflow/roboflow-api-reference/rest-api.md - ——通过 REST、MCP tools 和 Python CLI 创建及管理 API keys。创建 key 时,如果 workspace 具备 Advanced API Keys,应将其 scope 设为最小权限;如果不具备,则需告知用户 scoped keys 是 Enterprise 功能。
skill://roboflow/roboflow-api-reference/api-key-management.md