Skip to content

feat: Stainless SDK layer — type-safe Python + TypeScript clients from OpenAPI spec#95

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/integrate-stainless-sdk
Draft

feat: Stainless SDK layer — type-safe Python + TypeScript clients from OpenAPI spec#95
Copilot wants to merge 2 commits intomainfrom
copilot/integrate-stainless-sdk

Conversation

Copy link
Contributor

Copilot AI commented Mar 20, 2026

EventRelay's pipeline called external APIs via raw aiohttp/requests with no typed contracts and had no OpenAPI spec, blocking productization as a consumable platform API.

Changes

OpenAPI spec export

  • scripts/export_openapi.py — imports the FastAPI app and writes openapi/eventrelay.openapi.json (supports --format yaml)
  • openapi/eventrelay.openapi.json — generated from the live app: 40 paths, 28 component schemas, OpenAPI 3.1.0

Stainless configuration

  • .stainless.yml — declares eventrelay-sdk (PyPI) and @eventrelay/sdk (npm) targets; maps paths to 6 resource classes (videos, events, agents, transcript, chat, health); configures retry, auth scheme, server environments

Python SDK (sdk/python/)

  • EventRelayClient (sync) and AsyncEventRelayClient (async via httpx) with retry on {429,500,502,503,504}, configurable timeout, and context manager support
  • Pydantic v2 models in types.py kept in sync with backend schemas
  • Publishable as eventrelay-sdk via sdk/python/pyproject.toml
from eventrelay_sdk import EventRelayClient

client = EventRelayClient(base_url="http://localhost:8000")
job = client.videos.process("https://www.youtube.com/watch?v=auJzb1D-fag")
events = client.events.extract(job_id=job.job_id)
dispatch = client.agents.dispatch(events=[e.model_dump() for e in events.events])

TypeScript SDK (sdk/typescript/)

  • EventRelayClient — fetch-based, fully async, strict TypeScript interfaces mirroring Pydantic models
  • Publishable as @eventrelay/sdk via sdk/typescript/package.json
const client = new EventRelayClient({ baseUrl: "http://localhost:8000" });
const job = await client.videos.process({ video_url: "https://..." });
const events = await client.events.extract({ job_id: job.job_id });
const dispatch = await client.agents.dispatch({ events: events.events });

Tests

  • tests/test_sdk_python.py — 34 tests (types, sync/async clients, retry behavior, error propagation) using httpx.MockTransport; no live server required
Original prompt

This section details on the original issue you should resolve

<issue_title>🟡 Integrate Stainless SDK for type-safe API client generation</issue_title>
<issue_description>## Context (from Architecture Diagram)
The 'Video-to-Anything' architecture specifies a Stainless SDK layer between the 4-step pipeline and external tools/services. Purpose: 'Auto-generates type-safe API clients from OpenAPI specs to accelerate development velocity.'

Current State

  • The pipeline calls GitHub API, Vercel API, and Gemini API via raw aiohttp/requests
  • No OpenAPI spec exists for the EventRelay backend itself
  • No type-safe clients — all API calls are string-typed dictionaries

Strategic Execution Path (from diagram)

Phase 2 (1-2 weeks): 'Stainless + External API' — Monetization through productizing the pipeline as a consumable API

Tasks

  1. Generate OpenAPI spec for EventRelay's FastAPI backend (FastAPI does this automatically)
  2. Evaluate Stainless for SDK generation from the OpenAPI spec
  3. Create typed Python + TypeScript client SDKs for the video-to-software pipeline
  4. Publish SDK to PyPI/npm so external users can call the pipeline programmatically

Why This Matters

This converts EventRelay from a tool into a platform — other developers can integrate Video-to-Anything into their own apps via a clean SDK.

References

  • Architecture diagram: 'Zero Integration Tax via Stainless SDK' foundation layer
  • Strategic path: Phase 2 — 'Monetization through productizing the pipeline as a consumable API'</issue_description>

Comments on the Issue (you are @copilot in this section)

Custom agent used: Mastering-Any-Task AI
A hybrid agentic framework for research-led planning and execution.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@vercel
Copy link
Contributor

vercel bot commented Mar 20, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
v0-uvai Ready Ready Preview, Comment, Open in v0 Mar 20, 2026 11:35am

Co-authored-by: groupthinking <154503486+groupthinking@users.noreply.github.com>
Copilot AI changed the title [WIP] Integrate Stainless SDK for type-safe API client generation feat: Stainless SDK layer — type-safe Python + TypeScript clients from OpenAPI spec Mar 20, 2026
Copilot AI requested a review from groupthinking March 20, 2026 11:37
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.

🟡 Integrate Stainless SDK for type-safe API client generation

2 participants