Loading...
Loading...
Use when generating SDKs for multiple languages from a single OpenAPI spec, or multiple SDK variants from different sources. Covers workflow.yaml multi-target configuration, per-language gen.yaml, monorepo structure. Triggers on "multiple SDKs", "multi-language SDK", "SDK for each language", "multi-target SDK", "SDK monorepo", "generate SDKs for".
npx skill4agent add speakeasy-api/skills orchestrate-multi-target-sdks.speakeasy# Step 1: Initialize first target (creates .speakeasy/workflow.yaml)
speakeasy quickstart --skip-interactive --output console \
-s openapi.yaml -t typescript -n "MySDK" -p "my-sdk"
# Step 2: Add more language targets using configure
speakeasy configure targets \
--target-type python \
--source my-source \
--output ./sdks/python
speakeasy configure targets \
--target-type go \
--source my-source \
--output ./sdks/go
# Step 3: Generate all SDKs
speakeasy run --output consolespeakeasy configure sourcesspeakeasy configure sources \
--location ./openapi.yaml \
--source-name my-api
# With authentication header
speakeasy configure sources \
--location https://api.example.com/openapi.yaml \
--source-name my-api \
--auth-header "Authorization"| Flag | Short | Description |
|---|---|---|
| | OpenAPI document location (file or URL) |
| | Name for the source |
| Authentication header name (optional) | |
| | Output path for compiled source (optional) |
| Force non-interactive mode |
speakeasy configure targetsspeakeasy configure targets \
--target-type typescript \
--source my-api \
--output ./sdks/typescript
# With all options
speakeasy configure targets \
--target-type go \
--source my-api \
--target-name my-go-sdk \
--sdk-class-name MyAPI \
--package-name github.com/myorg/myapi-go \
--output ./sdks/go| Flag | Short | Description |
|---|---|---|
| | Language: typescript, python, go, java, csharp, php, ruby, terraform |
| | Name of source to generate from |
| Name for the target (defaults to target-type) | |
| SDK class name (optional) | |
| Package name (optional) | |
| Base server URL (optional) | |
| | Output directory (optional) |
| Force non-interactive mode |
# Initialize with first target
speakeasy quickstart --skip-interactive --output console \
-s ./openapi.yaml -t typescript -n "MySDK" -p "my-sdk" -o ./sdks/typescript
# Add Python
speakeasy configure targets \
--target-type python \
--source my-source \
--sdk-class-name MySDK \
--package-name my-sdk \
--output ./sdks/python
# Add Go
speakeasy configure targets \
--target-type go \
--source my-source \
--sdk-class-name MySDK \
--package-name github.com/myorg/my-sdk-go \
--output ./sdks/go
# Generate all
speakeasy run --output console# Initialize with main API
speakeasy quickstart --skip-interactive --output console \
-s ./openapi.yaml -t typescript -n "MySDK" -p "my-sdk"
# Add Azure variant source
speakeasy configure sources \
--location ./openapi-azure.yaml \
--source-name azure-api
# Add Azure target
speakeasy configure targets \
--target-type typescript \
--source azure-api \
--target-name typescript-azure \
--sdk-class-name MySDKAzure \
--package-name "@myorg/my-sdk-azure" \
--output ./packages/azure
# Generate all
speakeasy run --output consolemy-api-sdks/
├── openapi.yaml # Source spec
├── .speakeasy/
│ └── workflow.yaml # Multi-target config (created by CLI)
├── sdks/
│ ├── typescript/
│ │ ├── .speakeasy/
│ │ │ └── gen.yaml # Created by configure
│ │ └── src/
│ ├── python/
│ │ ├── .speakeasy/
│ │ │ └── gen.yaml
│ │ └── src/
│ └── go/
│ ├── .speakeasy/
│ │ └── gen.yaml
│ └── go.mod
└── .github/workflows/
└── sdk_generation.yaml# Generate all targets
speakeasy run --output console
# Generate specific target only
speakeasy run -t typescript --output console
speakeasy run -t python --output console# .github/workflows/sdk_generation.yaml
name: Generate SDKs
on:
push:
branches: [main]
paths: ['openapi.yaml']
workflow_dispatch:
jobs:
generate:
uses: speakeasy-api/sdk-generation-action/.github/workflows/workflow-executor.yaml@v15
with:
mode: pr
secrets:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
speakeasy_api_key: ${{ secrets.SPEAKEASY_API_KEY }}.speakeasy/speakeasy quickstartspeakeasy configureworkflow.yamlgen.yaml.speakeasy/# WRONG: Do not do this
mkdir -p .speakeasy
cat > .speakeasy/workflow.yaml << 'EOF'
...
EOF# RIGHT: Use CLI commands
speakeasy quickstart --skip-interactive --output console \
-s openapi.yaml -t typescript -n "MySDK" -p "my-sdk"
speakeasy configure targets --target-type python --source my-source| Issue | Solution |
|---|---|
| Wrong target generated | Specify |
| Source not found | Run |
| Target not found | Run |
| Config out of sync | Run |
speakeasy run --output consoleConfiguration complete. Would you like to regenerate the SDK(s) now with?speakeasy run
# Generate all targets
speakeasy run --output console
# Or generate a specific target
speakeasy run -t <target-name> --output consolestart-new-sdk-projectconfigure-sdk-optionsmanage-openapi-overlaysorchestrate-multi-repo-sdks