Skip to content

feat(sdk/cs): add Responses API client for OpenAI/OpenResponses compat#505

Open
MaanavD wants to merge 1 commit intomainfrom
feature/cs-sdk-responses-api
Open

feat(sdk/cs): add Responses API client for OpenAI/OpenResponses compat#505
MaanavD wants to merge 1 commit intomainfrom
feature/cs-sdk-responses-api

Conversation

@MaanavD
Copy link
Collaborator

@MaanavD MaanavD commented Mar 10, 2026

Add OpenAIResponsesClient to the C# SDK v2 with full CRUD support for the Responses API served by Foundry Local's embedded web service.

New files:

  • src/OpenAI/ResponsesClient.cs: HTTP-based client with SSE streaming
  • src/OpenAI/ResponsesTypes.cs: Request/response DTOs, items, streaming events
  • src/OpenAI/ResponsesJsonContext.cs: AOT-compatible source-generated JSON context

Modified files:

  • src/IModel.cs: GetResponsesClientAsync() on IModel interface
  • src/ModelVariant.cs: Implementation with web service URL validation
  • src/Model.cs: Delegation to SelectedVariant
  • src/FoundryLocalManager.cs: GetResponsesClient() factory method

Key design decisions:

  • HTTP-based (HttpClient + SSE), not FFI, since no CoreInterop command exists
  • AOT-compatible: all serialization uses source-generated JsonSerializerContext
  • IDisposable: HttpClient properly disposed
  • Follows existing patterns: Utils.CallWithExceptionHandling, ConfigureAwait(false)
  • Factory on FoundryLocalManager + convenience on IModel
  • ResponseObject.OutputText convenience property (matches OpenAI Python SDK)
  • Full CRUD: Create, CreateStreaming, Get, Delete, Cancel, GetInputItems

…tibility

Add OpenAIResponsesClient to the C# SDK v2 with full CRUD support for the
Responses API served by Foundry Local's embedded web service.

New files:
- src/OpenAI/ResponsesClient.cs: HTTP-based client with SSE streaming
- src/OpenAI/ResponsesTypes.cs: Request/response DTOs, items, streaming events
- src/OpenAI/ResponsesJsonContext.cs: AOT-compatible source-generated JSON context

Modified files:
- src/IModel.cs: GetResponsesClientAsync() on IModel interface
- src/ModelVariant.cs: Implementation with web service URL validation
- src/Model.cs: Delegation to SelectedVariant
- src/FoundryLocalManager.cs: GetResponsesClient() factory method

Key design decisions:
- HTTP-based (HttpClient + SSE), not FFI, since no CoreInterop command exists
- AOT-compatible: all serialization uses source-generated JsonSerializerContext
- IDisposable: HttpClient properly disposed
- Follows existing patterns: Utils.CallWithExceptionHandling, ConfigureAwait(false)
- Factory on FoundryLocalManager + convenience on IModel
- ResponseObject.OutputText convenience property (matches OpenAI Python SDK)
- Full CRUD: Create, CreateStreaming, Get, Delete, Cancel, GetInputItems
@vercel
Copy link

vercel bot commented Mar 10, 2026

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

Project Deployment Actions Updated (UTC)
foundry-local Ready Ready Preview, Comment Mar 10, 2026 5:42pm

Request Review

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.

1 participant