Guide to publishing OpenAPI specs to documentation platforms.
| Publisher | Status | Authentication |
|---|---|---|
| Local File | ✅ Ready | None |
| ReadMe.com | ✅ Ready | API key |
| Apifox | 🚧 Planned | — |
| Postman | 🚧 Planned | — |
The default output is a local file.
# Default output
spec-forge generate ./project
# Custom output path (format auto-detected from extension)
spec-forge generate ./project --output ./docs/api.yaml
spec-forge generate ./project --output ./api.json
# Custom output directory (uses default filename)
spec-forge generate ./project --output-dir ./docsPublish directly to ReadMe.com using the rdme CLI.
Install rdme:
npm install -g rdmeGet your API key from ReadMe.com dashboard.
export README_API_KEY="rdme_xxx"
spec-forge publish ./openapi.json \
--to readme \
--readme-slug my-apiOptions:
--readme-slug— API identifier in ReadMe (required)--readme-branch— Version/branch name (default:stable)--overwrite— Overwrite existing spec (default: false)
Publish as part of generation:
export LLM_API_KEY="sk-xxx"
export README_API_KEY="rdme_xxx"
spec-forge generate ./project \
--language zh \
--publish-target readme \
--readme-slug my-api \
-vThis runs: Detect → Patch → Generate → Validate → Enrich → Publish
By default, Spec Forge refuses to overwrite existing specs in ReadMe:
Error: Spec already exists. Use --overwrite to replace.
Use --overwrite in CI/CD pipelines:
spec-forge publish ./openapi.json \
--to readme \
--readme-slug my-api \
--overwriteSet defaults in .spec-forge.yaml:
readme:
slug: my-service-api
branch: v1.0Then publish with less typing:
README_API_KEY="rdme_xxx" spec-forge publish ./openapi.json --to readmename: Publish API Docs
on:
push:
branches: [main]
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.26'
- name: Install Spec Forge
run: go install github.com/spencercjh/spec-forge@latest
- name: Generate and Publish
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
README_API_KEY: ${{ secrets.README_API_KEY }}
run: |
spec-forge generate ./ \
--language en \
--publish-target readme \
--readme-slug ${{ secrets.README_SLUG }} \
--publish-overwritepublish-api:
image: golang:1.26
stage: deploy
script:
- go install github.com/spencercjh/spec-forge@latest
- spec-forge generate ./ \
--publish-target readme \
--readme-slug $README_SLUG \
--publish-overwrite
only:
- main❌ Bad:
# .spec-forge.yaml
enrich:
apiKey: "sk-xxx" # Never do this!✅ Good:
# .spec-forge.yaml - No API keys here!
enrich:
enabled: true
provider: openai
model: gpt-4oexport OPENAI_API_KEY="sk-xxx"
spec-forge generate ./Keep API keys in environment variables, never in config files:
# .spec-forge.yaml - Safe: no API keys
enrich:
enabled: true
provider: openai
model: gpt-4o# Set environment variable
export OPENAI_API_KEY="sk-xxx"
# Run spec-forge
spec-forge generate ./Note: For OpenAI and Anthropic, API keys are always read from OPENAI_API_KEY and ANTHROPIC_API_KEY respectively. For custom providers, use LLM_API_KEY or set apiKeyEnv in config.
Store in your CI system's secret management:
- GitHub Actions:
Settings → Secrets and variables → Actions - GitLab CI:
Settings → CI/CD → Variables - CircleCI:
Project Settings → Environment Variables
Install the ReadMe CLI:
npm install -g rdmeCheck your API key:
echo $README_API_KEYVerify in ReadMe.com dashboard under API Keys.
Either:
- Use
--publish-overwriteto replace - Change
--readme-slugto a new identifier - Change
--readme-branchto a different version
The slug must match an existing API in your ReadMe project. Create it first in the ReadMe dashboard.
# Coming soon
spec-forge publish ./openapi.json --to apifox# Coming soon
spec-forge publish ./openapi.json --to postman# Coming soon
spec-forge publish ./openapi.json \
--to webhook \
--webhook-url https://api.example.com/specs| Feature | Local File | ReadMe.com |
|---|---|---|
| Versioning | Manual (filenames) | Built-in branches |
| Hosting | Self-managed | Hosted |
| Collaboration | Git-based | Built-in comments |
| Try-it-now | Requires separate tool | Built-in |
| Cost | Free | Paid tiers |
| Custom domain | Your setup | Supported |
Choose based on your team's needs. Many teams use both:
- Local files for development and PR reviews
- ReadMe.com for public API documentation