Skip to content

Add Stainless-ready OpenAPI export and dual-language SDK scaffolding#96

Closed
Codex wants to merge 3 commits intomainfrom
codex/integrate-stainless-sdk-api-client
Closed

Add Stainless-ready OpenAPI export and dual-language SDK scaffolding#96
Codex wants to merge 3 commits intomainfrom
codex/integrate-stainless-sdk-api-client

Conversation

@Codex
Copy link
Contributor

@Codex Codex AI commented Mar 20, 2026

EventRelay needs a Stainless-based path to generate type-safe Python/TS clients from its FastAPI OpenAPI spec to productize the video-to-software pipeline.

  • OpenAPI export: new scripts/export_openapi.py emits openapi/eventrelay.openapi.json; added coverage-safe test to ensure the schema is written and includes core paths.
  • Stainless wiring: added stainless.config.ts plus npm run sdk:openapi / sdk:generate helpers; documented flow in README.md and sdks/README.md.
  • SDK scaffolds: seeded typed clients for core endpoints (health, transcript-action, process-video, video-to-software) in sdks/typescript and sdks/python, with publish-ready metadata and TypeScript build config.
  • Cleanup: removed stray src/youtube_extension.egg-info artifacts; ignored SDK build output.

Example client usage (TS):

import { EventRelayClient } from "eventrelay-sdk";

const client = new EventRelayClient({ baseUrl: "https://api.eventrelay.io", apiKey: process.env.EVENTRELAY_API_KEY });
const result = await client.transcriptAction({ video_url: "https://youtu.be/auJzb1D-fag" });
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 @codex[agent] in this section)

@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:01am

@Codex Codex AI changed the title [WIP] Integrate Stainless SDK for type-safe API client generation Add Stainless-ready OpenAPI export and dual-language SDK scaffolding Mar 20, 2026
@Codex Codex AI requested a review from groupthinking March 20, 2026 11:02

def _request(self, method: str, path: str, json: Optional[dict] = None) -> dict:
response = self._client.request(method, path, json=json)
response.raise_for_status()
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
response.raise_for_status()
if not response.is_success:
detail = response.text
raise httpx.HTTPStatusError(
f"Request to {path} failed with {response.status_code}: {detail}",
request=response.request,
response=response,
)

Python SDK client's _request method loses API error details by using raise_for_status() which doesn't include response body in the exception

Fix on Vercel

private async request<T>(path: string, init: RequestInit): Promise<T> {
const controller = new AbortController();
const timeout = setTimeout(() => controller.abort(), this.timeoutMs);
try {
Copy link
Contributor

Choose a reason for hiding this comment

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

The request method in TypeScript client throws a raw AbortError on timeout instead of a descriptive timeout error message

Fix on Vercel

@groupthinking
Copy link
Owner

Closing: duplicate of #95 which is the most comprehensive Stainless SDK implementation (10.8K additions, dual Python+TypeScript SDKs, tests). Keeping #95 as the candidate.

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