Skip to content

Integrate Stainless SDK for type-safe API client generation#94

Closed
Claude wants to merge 3 commits intomainfrom
claude/integrate-stainless-sdk
Closed

Integrate Stainless SDK for type-safe API client generation#94
Claude wants to merge 3 commits intomainfrom
claude/integrate-stainless-sdk

Conversation

@Claude
Copy link
Contributor

@Claude Claude AI commented Mar 20, 2026

Implements automated SDK generation infrastructure to productize EventRelay's API, enabling external developers to consume the Video-to-Anything pipeline via type-safe Python and TypeScript clients.

OpenAPI Specification

  • Auto-generated spec from FastAPI backend (2,799 lines, OpenAPI 3.1.0)
  • 40 endpoints with 28 Pydantic component schemas
  • Script: scripts/generate_openapi.py regenerates from route definitions

Stainless Configuration

.stainless.yaml defines SDK generation for:

  • Python: eventrelay-sdk → PyPI
  • TypeScript: @groupthinking/eventrelay → npm
  • Enabled: retries, pagination, streaming, error handling

CI/CD Pipeline

.github/workflows/stainless-sdk.yml automates:

  1. OpenAPI spec validation on changes
  2. SDK generation via Stainless API
  3. Test execution on generated code
  4. Publishing to PyPI (OIDC) and npm (token auth) on release tags
  5. PR creation when spec changes

Usage Examples

Python:

from eventrelay import EventRelay

client = EventRelay(api_key="...")
job = client.videos.process(video_url="https://youtube.com/...", language="en")
status = client.videos.wait_for_completion(job.job_id)
events = client.events.extract(transcript=status.transcript)

TypeScript:

import { EventRelay } from '@groupthinking/eventrelay';

const client = new EventRelay({ apiKey: "..." });
const job = await client.videos.process({ video_url: "https://youtube.com/..." });
const status = await client.videos.waitForCompletion(job.job_id);

Documentation

  • docs/SDK_INTEGRATION.md: Usage patterns, error handling, pagination, streaming
  • docs/STAINLESS_SETUP.md: Setup guide for Stainless account, PyPI/npm publishing
  • docs/STAINLESS_IMPLEMENTATION_SUMMARY.md: Architecture and strategic impact

Import Path Fixes

Fixed module resolution errors blocking OpenAPI generation:

  • src/shared/youtube/__init__.py: Changed src.youtube_extensionyoutube_extension
  • src/youtube_extension/services/workflows/transcript_action_workflow.py: Changed src.shared.youtubeshared.youtube

Next Steps

Requires manual setup to activate SDK publishing:

  1. Add STAINLESS_API_KEY secret (from stainless.com)
  2. Configure PyPI trusted publisher for eventrelay-sdk
  3. Add NPM_TOKEN secret for @groupthinking/eventrelay
  4. Create v1.0.0 release to trigger first publish

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/graphql
    • Triggering command: /usr/bin/gh gh issue view 94 --repo groupthinking/EventRelay --json number,title,body,state,url /home/REDACTED/.nvm/nvm.sh /home/REDACTED/.nvm/package.json /home/REDACTED/.nvm/rename_test.sh /home/REDACTED/.nvm/test (http block)

If you need me to access, download, or install something from one of these locations, you can either:

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 @claude[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:02am

Co-authored-by: groupthinking <154503486+groupthinking@users.noreply.github.com>
- Generate OpenAPI 3.1.0 spec from FastAPI backend (2,799 lines, 40 endpoints)
- Add Stainless configuration for Python and TypeScript SDK generation
- Create GitHub Actions workflow for automated SDK publishing
- Add comprehensive SDK documentation and usage examples
- Fix import paths in shared.youtube module
- Add SDK build artifacts to .gitignore
- Create SDK placeholder READMEs for Python and TypeScript

Strategic Impact:
- Converts EventRelay from tool to platform with consumable SDKs
- Enables external developers to integrate Video-to-Anything pipeline
- Supports Phase 2 monetization through productized API
- Provides zero-friction developer experience with type-safe clients

Next Steps:
1. Set up Stainless account and add STAINLESS_API_KEY secret
2. Configure PyPI trusted publisher for eventrelay-sdk
3. Add NPM_TOKEN secret for @groupthinking/eventrelay
4. Generate and test SDKs locally before first publish
5. Create v1.0.0 release to trigger automated SDK publishing

Co-authored-by: groupthinking <154503486+groupthinking@users.noreply.github.com>
@Claude Claude AI changed the title [WIP] Integrate Stainless SDK for type-safe API client generation Integrate Stainless SDK for type-safe API client generation Mar 20, 2026
@Claude Claude AI requested a review from groupthinking March 20, 2026 11:03
Copy link
Contributor

@vercel vercel bot left a comment

Choose a reason for hiding this comment

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

Additional Suggestion:

Auto-generated .egg-info package metadata files are tracked in git despite being in .gitignore, creating merge conflict risk and build reproducibility issues

Fix on Vercel

uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}

Copy link
Contributor

Choose a reason for hiding this comment

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

TypeScript SDK generation job missing the 'Upload OpenAPI spec to Stainless' step that is present in the Python SDK job, creating an inconsistency that could cause generation failures.

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