Skip to content

Add documentation for Spaces as API endpoints#2185

Open
gary149 wants to merge 1 commit intomainfrom
add-spaces-api-endpoints-docs
Open

Add documentation for Spaces as API endpoints#2185
gary149 wants to merge 1 commit intomainfrom
add-spaces-api-endpoints-docs

Conversation

@gary149
Copy link
Contributor

@gary149 gary149 commented Jan 26, 2026

With agents everywhere it's probably cool to document this at hub level. cc @abidlabs

Summary

  • Add new documentation page explaining that every Gradio Space is automatically available as an API endpoint
  • Complements the existing "Spaces as MCP servers" documentation

Content covered

  • Quick start example with Python client
  • Viewing available API endpoints (including OpenAPI spec at /gradio_api/openapi.json)
  • Python client (gradio_client): installation, connecting, predictions, file handling, job status, streaming
  • JavaScript client (@gradio/client): installation, connecting, predictions, file handling, streaming
  • REST API via curl (queue-based two-step process)
  • Avoiding rate limits with Client.duplicate()
  • ZeroGPU quota table
  • Common patterns: FastAPI integration, error handling with retries, Space-to-Space calls

Note

Low Risk
Documentation-only changes (new page plus navigation link) with no runtime or API behavior modifications.

Overview
Adds new Hub documentation page spaces-api-endpoints.md explaining how Gradio Spaces can be called programmatically (Python gradio_client, JavaScript @gradio/client, and raw HTTP/curl), including endpoint discovery via the “Use via API” UI and the /gradio_api/openapi.json spec.

Updates the Hub Spaces sidebar (_toctree.yml) to include the new “Spaces as API Endpoints” entry alongside existing Spaces docs.

Written by Cursor Bugbot for commit 390554a. This will update automatically on new commits. Configure here.

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@gary149 gary149 force-pushed the add-spaces-api-endpoints-docs branch 2 times, most recently from 6f9f28c to 17f8da3 Compare January 26, 2026 19:47
@gary149 gary149 assigned aliabid94 and unassigned aliabid94 Jan 26, 2026
@gary149 gary149 requested a review from aliabid94 January 26, 2026 19:48
Copy link
Member

@abidlabs abidlabs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice agreed @gary149!

@gary149 gary149 force-pushed the add-spaces-api-endpoints-docs branch 10 times, most recently from bac3be4 to 0dfe21e Compare January 29, 2026 09:50
Document that every Gradio Space is automatically available as an API endpoint, covering:
- Python client (gradio_client)
- JavaScript client (@gradio/client)
- REST API via curl
- OpenAPI specification
- ZeroGPU quotas
- Common patterns (FastAPI integration, retries, Space-to-Space calls)
@gary149 gary149 force-pushed the add-spaces-api-endpoints-docs branch from 0dfe21e to 390554a Compare January 29, 2026 09:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants