This repository is a mostly generated .NET SDK for ElevenLabs. Most code under src/libs/ElevenLabs/Generated/ comes from the upstream OpenAPI document via AutoSDK, and only a small surface area is hand-maintained.
src/libs/ElevenLabs/- Main NuGet package.
Generated/is generated by AutoSDK fromopenapi.yaml.Extensions/andRealtime/contain the main hand-written code.
src/tests/IntegrationTests/- MSTest project against the real ElevenLabs API.
Examples/contains the curated user-facing examples that drive README and MkDocs generation.
src/helpers/GenerateDocs/- Console app that prepares MkDocs content from the repo.
src/helpers/TrimmingHelper/- Minimal helper used to surface trimming/AOT warnings during build/publish.
docs/- MkDocs assets only (
css/,media/). docs/index.mdanddocs/examples/*.mdare generated byGenerateDocsand should not be treated as authoritative sources.
- MkDocs assets only (
mkdocs.yml- MkDocs config shell. The block between
# EXAMPLES:STARTand# EXAMPLES:ENDis generated.
- MkDocs config shell. The block between
README.md- Packed into the NuGet package.
- The block between
<!-- EXAMPLES:START -->and<!-- EXAMPLES:END -->is generated from integration-test examples.
- Do not manually edit
src/libs/ElevenLabs/Generated/. - Regenerate SDK code from
src/libs/ElevenLabs/generate.sh. src/libs/ElevenLabs/openapi.yamlis a fetched artifact, not a hand-authored contract.- When OpenAPI output changes, review hand-written files in
Extensions/andRealtime/for compatibility instead of patching generated files.
src/libs/ElevenLabs/Extensions/ElevenLabsClient.Realtime.cssrc/libs/ElevenLabs/Extensions/SpeechToTextClient.Realtime.cssrc/libs/ElevenLabs/Extensions/SpeechToTextClient.ExtensionsAI.cssrc/libs/ElevenLabs/Realtime/RealtimeSpeechToTextSession.cssrc/libs/ElevenLabs/Realtime/RealtimeSpeechToTextEvents.cssrc/libs/ElevenLabs/Realtime/RealtimeSpeechToTextOptions.cssrc/libs/ElevenLabs/Realtime/RealtimeAudioFormat.cssrc/libs/ElevenLabs/Realtime/RealtimeCommitStrategy.cssrc/helpers/GenerateDocs/Program.cs
dotnet build ElevenLabs.slnx
dotnet test src/tests/IntegrationTests/ElevenLabs.IntegrationTests.csproj
dotnet run --project src/helpers/GenerateDocs/GenerateDocs.csproj .
python -m venv .venv && source .venv/bin/activate && pip install mkdocs-material && mkdocs build
cd src/libs/ElevenLabs && ./generate.shNotes:
- Integration tests require
ELEVENLABS_API_KEY. - The solution targets
net10.0and uses C# preview features. README.mdis included in the NuGet package throughsrc/libs/Directory.Build.props.
The current documentation flow is:
- Curated example tests live in
src/tests/IntegrationTests/Examples/*.cs. - Each example file starts with a block comment containing docs metadata (
order,title, optionalslug, then markdown description). GenerateDocsparses those example files, strips test-only assertions, and generates:- the README examples block
docs/index.mddocs/examples/*.md
mkdocs.ymlhas the block between# EXAMPLES:STARTand# EXAMPLES:ENDregenerated from the discovered examples.- GitHub Actions runs the docs generator before
mkdocs build.
That means the current authoritative sources are split:
- Top-level narrative docs scaffold:
README.md - Code examples and their per-page descriptions:
src/tests/IntegrationTests/Examples/*.cs - MkDocs site structure/theme:
mkdocs.ymlplusdocs/assets
If you are touching docs, examples, or onboarding content, use these rules:
- Do not hand-edit
docs/index.mdordocs/examples/*.md; they are overwritten. - Do not hand-edit the generated README examples block; edit the source example files and rerun
GenerateDocs. - Do not treat the generated MkDocs example nav as permanent; keep the
# EXAMPLES:START/# EXAMPLES:ENDmarkers in source control. - If an example should compile and stay honest, put the example in integration tests first.
- Keep one user-facing example per file in
src/tests/IntegrationTests/Examples/. - Use the file header comment for page title, sort order, slug, and markdown description.
src/helpers/GenerateDocs/Program.cs now provides the docs sync mechanism:
- It parses explicit example files only, not arbitrary tests.
- It uses Roslyn to extract the single
[TestMethod]body from each example file. - It removes assertion lines from generated snippets and rewrites
GetAuthenticatedClient()usage tonew ElevenLabsClient(apiKey). - It regenerates README,
docs/index.md,docs/examples/*.md, and the MkDocs example nav from the same source. - It deletes stale generated example pages before writing new ones.
If the goal is first-class MkDocs documentation with synchronized examples, prefer this model:
- Make executable tests the source of truth for code examples.
- Make MkDocs the source of truth for long-form product documentation.
- Keep README as a compact package-facing landing page with its example block generated from the same source as MkDocs.
- Generate navigation from discovered examples instead of committing duplicated nav entries.
- Prefer one curated example file per page, with a stable title/slug and a short markdown description in the file header.
- For SDK regeneration changes, inspect generated diffs separately from manual files.
- For docs/example changes, run the docs generator and inspect the resulting MkDocs build locally.
- When changing tests used as docs samples, keep the executable path intact and avoid introducing setup code that makes the extracted snippet misleading.
- Avoid editing generated output just to make docs look right; fix the generator or the actual source instead.