-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerate-integrations.js
More file actions
2021 lines (1776 loc) · 85.9 KB
/
generate-integrations.js
File metadata and controls
2021 lines (1776 loc) · 85.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/env node
/**
* Generate platform integration configs for all 126 Stockyard integrations.
* Skips directories that already exist.
*
* Run: node generate-integrations.js
*/
const fs = require("fs");
const path = require("path");
const DIR = path.join(__dirname, "integrations");
let created = 0, skipped = 0;
function write(dir, file, content) {
const d = path.join(DIR, dir);
if (!fs.existsSync(d)) fs.mkdirSync(d, { recursive: true });
fs.writeFileSync(path.join(d, file), content.trimStart() + "\n");
}
function readme(dir, name, category, type, desc, setupSteps, files) {
const fileList = files.map(f => `- \`${f}\``).join("\n");
write(dir, "README.md", `
# ${name} + Stockyard
> **Category:** ${category} | **Type:** ${type}
${desc}
## Quick Setup
${setupSteps}
## Files
${fileList}
## How It Works
All LLM requests from ${name} are routed through Stockyard's proxy at \`http://localhost:4000/v1\`. Stockyard handles cost tracking, caching, rate limiting, failover, and all other middleware — transparently.
Your ${name} setup doesn't need to change beyond pointing the base URL at Stockyard.
## Using Individual Products
Instead of the full suite (port 4000), you can point at individual products:
| Product | Port | What It Does |
|---------|------|-------------|
| CostCap | 4100 | Spending caps only |
| CacheLayer | 4200 | Response caching only |
| RateShield | 4500 | Rate limiting only |
| FallbackRouter | 4400 | Failover routing only |
## Learn More
- [Stockyard Docs](https://stockyard.dev/docs/)
- [All 125 Products](https://stockyard.dev/products/)
- [GitHub](https://github.com/stockyard-dev/stockyard)
`);
}
function gen(dir, name, cat, type, desc, fn) {
if (fs.existsSync(path.join(DIR, dir, "README.md"))) {
skipped++;
return;
}
fn();
created++;
}
// ═══════════════════════════════════════════════════════════════
// 3.1 AI CODING TOOLS & IDEs (10)
// ═══════════════════════════════════════════════════════════════
gen("cursor", "Cursor", "AI Coding Tools", "MCP + config", "Route all Cursor AI requests through Stockyard.", () => {
write("cursor", "mcp.json", `
{
"mcpServers": {
"stockyard": {
"command": "npx",
"args": ["@stockyard/mcp-stockyard"],
"env": {
"OPENAI_API_KEY": "your-openai-key"
}
}
}
}`);
write("cursor", "setup.sh", `
#!/bin/bash
# Cursor + Stockyard one-line setup
mkdir -p ~/.cursor
cp mcp.json ~/.cursor/mcp.json
echo "Restart Cursor. Stockyard is now active."
echo "Dashboard: http://localhost:4000/ui"
`);
readme("cursor", "Cursor", "AI Coding Tools", "MCP + config",
"Route all Cursor AI requests through Stockyard for cost tracking, caching, and rate limiting. Every AI completion, edit, and chat goes through the proxy.",
"1. Copy `mcp.json` to `~/.cursor/mcp.json`\n2. Set your `OPENAI_API_KEY`\n3. Restart Cursor\n4. Open dashboard at http://localhost:4000/ui",
["mcp.json", "setup.sh"]);
});
gen("continue-dev", "Continue.dev", "AI Coding Tools", "Config template", "Add Stockyard to Continue.dev for cost control.", () => {
write("continue-dev", "config.json", `
{
"models": [
{
"title": "GPT-4o via Stockyard",
"provider": "openai",
"model": "gpt-4o",
"apiBase": "http://localhost:4000/v1",
"apiKey": "any-string"
},
{
"title": "Claude via Stockyard",
"provider": "openai",
"model": "claude-sonnet-4-20250514",
"apiBase": "http://localhost:4000/v1",
"apiKey": "any-string"
}
],
"tabAutocompleteModel": {
"title": "Fast Autocomplete via Stockyard",
"provider": "openai",
"model": "gpt-4o-mini",
"apiBase": "http://localhost:4000/v1",
"apiKey": "any-string"
}
}`);
readme("continue-dev", "Continue.dev", "AI Coding Tools", "Config template",
"Route Continue.dev completions and chat through Stockyard.",
"1. Copy `config.json` to `~/.continue/config.json`\n2. Start Stockyard: `npx @stockyard/mcp-stockyard`\n3. Restart VS Code",
["config.json"]);
});
gen("aider", "Aider", "AI Coding Tools", "Env wrapper", "Run Aider through Stockyard.", () => {
write("aider", "aider-stockyard.sh", `
#!/bin/bash
# Run Aider through Stockyard proxy
export OPENAI_API_BASE=http://localhost:4000/v1
export OPENAI_API_KEY=\${OPENAI_API_KEY:-any-string}
exec aider "$@"
`);
write("aider", ".env", `
# Add to your shell profile or .env
OPENAI_API_BASE=http://localhost:4000/v1
OPENAI_API_KEY=your-key
`);
readme("aider", "Aider", "AI Coding Tools", "Env wrapper",
"Route Aider AI pair programming through Stockyard for cost tracking and model failover.",
"1. Start Stockyard: `npx @stockyard/mcp-stockyard`\n2. `source .env`\n3. Run `aider` normally — all requests go through Stockyard",
["aider-stockyard.sh", ".env"]);
});
gen("cline", "Cline / Roo Code", "AI Coding Tools", "Settings + MCP", "Connect Cline to Stockyard.", () => {
write("cline", "mcp.json", `
{
"mcpServers": {
"stockyard": {
"command": "npx",
"args": ["@stockyard/mcp-stockyard"],
"env": { "OPENAI_API_KEY": "your-key" }
}
}
}`);
write("cline", "settings.json", `
{
"cline.apiProvider": "openai-compatible",
"cline.openaiBaseUrl": "http://localhost:4000/v1",
"cline.openaiApiKey": "any-string",
"cline.openaiModelId": "gpt-4o"
}`);
readme("cline", "Cline / Roo Code", "AI Coding Tools", "Settings + MCP",
"Connect Cline (VS Code AI agent) to Stockyard for cost caps and request logging.",
"1. Add `settings.json` values to VS Code settings\n2. Copy `mcp.json` to your project root\n3. Restart VS Code",
["mcp.json", "settings.json"]);
});
gen("windsurf", "Windsurf / Codeium", "AI Coding Tools", "Config template", "Route Windsurf through Stockyard.", () => {
write("windsurf", "config.md", `
# Windsurf + Stockyard
In Windsurf settings:
- AI Provider: **OpenAI Compatible**
- Base URL: **http://localhost:4000/v1**
- API Key: **any-string**
- Model: **gpt-4o**
`);
readme("windsurf", "Windsurf / Codeium", "AI Coding Tools", "Config template",
"Route Windsurf AI requests through Stockyard for spend tracking and caching.",
"1. Start Stockyard: `npx @stockyard/mcp-stockyard`\n2. Open Windsurf Settings > AI Provider\n3. Set Base URL to `http://localhost:4000/v1`",
["config.md"]);
});
gen("github-copilot", "GitHub Copilot", "AI Coding Tools", "Network proxy", "Analytics for GitHub Copilot via network proxy.", () => {
write("github-copilot", "vscode-settings.json", `
{
"http.proxy": "http://localhost:4000",
"http.proxyStrictSSL": false
}`);
readme("github-copilot", "GitHub Copilot", "AI Coding Tools", "Network proxy",
"Route GitHub Copilot through Stockyard via HTTP proxy for analytics and logging. Note: Copilot manages its own auth — Stockyard provides visibility only.",
"1. Start Stockyard: `npx @stockyard/mcp-stockyard`\n2. Add proxy settings to VS Code\n3. Copilot traffic now logged in Stockyard dashboard",
["vscode-settings.json"]);
});
gen("zed", "Zed", "AI Coding Tools", "Settings template", "Configure Zed AI to route through Stockyard.", () => {
write("zed", "settings.json", `
{
"language_models": {
"openai": {
"api_url": "http://localhost:4000/v1",
"available_models": [
{ "name": "gpt-4o", "display_name": "GPT-4o via Stockyard" },
{ "name": "gpt-4o-mini", "display_name": "GPT-4o Mini via Stockyard" }
]
}
}
}`);
readme("zed", "Zed", "AI Coding Tools", "Settings template",
"Configure Zed editor's built-in AI to route through Stockyard.",
"1. Start Stockyard\n2. Copy `settings.json` to `~/.config/zed/settings.json`\n3. Restart Zed",
["settings.json"]);
});
gen("jetbrains", "JetBrains AI", "AI Coding Tools", "Proxy config", "Route JetBrains AI through Stockyard.", () => {
write("jetbrains", "setup.md", `
# JetBrains + Stockyard
For JetBrains with OpenAI-compatible plugins:
1. Settings > Tools > AI Assistant > Custom provider
2. Base URL: http://localhost:4000/v1
3. API Key: any-string
For HTTP proxy approach:
1. Settings > Appearance & Behavior > System Settings > HTTP Proxy
2. Manual proxy: localhost:4000
`);
readme("jetbrains", "JetBrains AI", "AI Coding Tools", "Proxy config",
"Route JetBrains AI Assistant through Stockyard for cost control.",
"1. Start Stockyard\n2. Configure proxy in JetBrains settings\n3. See `setup.md` for detailed steps",
["setup.md"]);
});
gen("neovim", "Neovim / avante.nvim", "AI Coding Tools", "Config snippets", "Configure Neovim AI plugins with Stockyard.", () => {
write("neovim", "avante.lua", `
-- ~/.config/nvim/lua/plugins/avante.lua
return {
"yetone/avante.nvim",
opts = {
provider = "openai",
openai = {
endpoint = "http://localhost:4000/v1",
model = "gpt-4o",
api_key_name = "OPENAI_API_KEY",
},
},
}`);
write("neovim", "codecompanion.lua", `
-- For codecompanion.nvim
require("codecompanion").setup({
adapters = {
openai = function()
return require("codecompanion.adapters").extend("openai", {
url = "http://localhost:4000/v1/chat/completions",
})
end,
},
})`);
readme("neovim", "Neovim / avante.nvim", "AI Coding Tools", "Config snippets",
"Configure avante.nvim and codecompanion.nvim to use Stockyard.",
"1. Start Stockyard\n2. Copy the relevant Lua config to your Neovim setup\n3. Restart Neovim",
["avante.lua", "codecompanion.lua"]);
});
gen("opencode", "OpenCode", "AI Coding Tools", "Config + env", "Configure OpenCode terminal AI with Stockyard.", () => {
write("opencode", ".env", `
OPENAI_API_BASE=http://localhost:4000/v1
OPENAI_API_KEY=your-key
`);
readme("opencode", "OpenCode", "AI Coding Tools", "Config + env",
"Route OpenCode terminal AI through Stockyard.",
"1. Start Stockyard\n2. Set env vars: `export OPENAI_API_BASE=http://localhost:4000/v1`\n3. Run OpenCode normally",
[".env"]);
});
// ═══════════════════════════════════════════════════════════════
// 3.2 AI APPLICATION FRAMEWORKS (10)
// ═══════════════════════════════════════════════════════════════
gen("vercel-ai", "Vercel AI SDK", "AI Frameworks", "npm provider", "Drop-in Stockyard provider for Vercel AI SDK.", () => {
write("vercel-ai", "route.ts", `
// app/api/chat/route.ts
import { createOpenAI } from "@ai-sdk/openai";
import { streamText } from "ai";
const stockyard = createOpenAI({
baseURL: "http://localhost:4000/v1",
apiKey: "any-string",
});
export async function POST(req: Request) {
const { messages } = await req.json();
const result = streamText({ model: stockyard("gpt-4o"), messages });
return result.toDataStreamResponse();
}`);
readme("vercel-ai", "Vercel AI SDK", "AI Frameworks", "npm provider",
"Drop-in Stockyard provider for the Vercel AI SDK. Works with Next.js, SvelteKit, Nuxt.",
"1. `npm install @ai-sdk/openai ai`\n2. Copy `route.ts` to your API route\n3. Start Stockyard on port 4000",
["route.ts"]);
});
gen("llamaindex", "LlamaIndex", "AI Frameworks", "PyPI package", "Route LlamaIndex through Stockyard.", () => {
write("llamaindex", "example.py", `
# pip install llama-index-llms-openai llama-index-embeddings-openai
from llama_index.llms.openai import OpenAI
from llama_index.embeddings.openai import OpenAIEmbedding
llm = OpenAI(
model="gpt-4o",
api_base="http://localhost:4000/v1",
api_key="any-string",
)
embed = OpenAIEmbedding(
model="text-embedding-3-small",
api_base="http://localhost:4000/v1",
api_key="any-string",
)`);
readme("llamaindex", "LlamaIndex", "AI Frameworks", "PyPI package",
"Route LlamaIndex completions and embeddings through Stockyard. Embeddings are automatically cached.",
"1. Start Stockyard\n2. Set `api_base` to `http://localhost:4000/v1`\n3. Embeddings cached automatically via CacheLayer",
["example.py"]);
});
gen("haystack", "Haystack", "AI Frameworks", "PyPI package", "Configure Haystack RAG pipelines with Stockyard.", () => {
write("haystack", "example.py", `
from haystack.components.generators.chat import OpenAIChatGenerator
from haystack.utils import Secret
generator = OpenAIChatGenerator(
api_key=Secret.from_token("any-string"),
api_base_url="http://localhost:4000/v1",
model="gpt-4o",
)`);
readme("haystack", "Haystack", "AI Frameworks", "PyPI package",
"Configure Haystack RAG pipelines to route through Stockyard.",
"1. `pip install haystack-ai`\n2. Set `api_base_url` to Stockyard\n3. All Haystack LLM calls now go through the proxy",
["example.py"]);
});
gen("semantic-kernel", "Semantic Kernel", "AI Frameworks", "NuGet + PyPI", "Use Stockyard with Microsoft Semantic Kernel.", () => {
write("semantic-kernel", "example.cs", `
using Microsoft.SemanticKernel;
var builder = Kernel.CreateBuilder();
builder.AddOpenAIChatCompletion(
modelId: "gpt-4o",
endpoint: new Uri("http://localhost:4000/v1"),
apiKey: "any-string"
);
var kernel = builder.Build();`);
write("semantic-kernel", "example.py", `
import semantic_kernel as sk
from semantic_kernel.connectors.ai.open_ai import OpenAIChatCompletion
kernel = sk.Kernel()
kernel.add_service(OpenAIChatCompletion(
ai_model_id="gpt-4o",
async_client=None,
api_key="any-string",
org_id=None,
default_headers=None,
# Set base URL via environment: OPENAI_BASE_URL=http://localhost:4000/v1
))`);
readme("semantic-kernel", "Semantic Kernel", "AI Frameworks", "NuGet + PyPI",
"Use Stockyard with Microsoft's Semantic Kernel for .NET and Python.",
"1. Start Stockyard\n2. Set endpoint to `http://localhost:4000/v1`\n3. See examples for C# and Python",
["example.cs", "example.py"]);
});
gen("spring-ai", "Spring AI", "AI Frameworks", "Maven starter", "Configure Spring AI with Stockyard.", () => {
write("spring-ai", "application.yml", `
spring:
ai:
openai:
base-url: http://localhost:4000/v1
api-key: any-string
chat:
options:
model: gpt-4o`);
write("spring-ai", "pom-snippet.xml", `
<!-- Add to pom.xml dependencies -->
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-openai-spring-boot-starter</artifactId>
</dependency>`);
readme("spring-ai", "Spring AI", "AI Frameworks", "Maven starter",
"Configure Spring AI to route through Stockyard. Java enterprise with LLM cost control.",
"1. Add Spring AI OpenAI starter to `pom.xml`\n2. Set `spring.ai.openai.base-url` in `application.yml`\n3. Start Stockyard on port 4000",
["application.yml", "pom-snippet.xml"]);
});
gen("litellm-compat", "LiteLLM", "AI Frameworks", "Drop-in replacement", "Migrate from LiteLLM to Stockyard.", () => {
write("litellm-compat", "migration-guide.md", `
# Migrating from LiteLLM to Stockyard
## Why Migrate?
- LiteLLM: Python, needs Redis/Postgres, 35K+ stars but heavy
- Stockyard: Go single binary, SQLite only, no dependencies
## Step 1: Replace LiteLLM proxy with Stockyard
\`\`\`bash
# Before: litellm --port 4000
# After:
npx @stockyard/mcp-stockyard
\`\`\`
## Step 2: Same base URL, same API
Your code doesn't change. Stockyard speaks OpenAI-compatible API.
\`\`\`python
# This works with both LiteLLM and Stockyard:
from openai import OpenAI
client = OpenAI(base_url="http://localhost:4000/v1", api_key="any")
\`\`\`
## Step 3: Migrate config
\`\`\`yaml
# stockyard.yml
providers:
openai:
api_key: \${OPENAI_API_KEY}
anthropic:
api_key: \${ANTHROPIC_API_KEY}
\`\`\`
## What You Gain
- 125 middleware products vs LiteLLM's proxy-only approach
- No Python runtime, no Redis, no Postgres
- 6MB static binary vs Python environment
- Embedded dashboard (no separate UI service)
`);
readme("litellm-compat", "LiteLLM", "AI Frameworks", "Drop-in replacement",
"Migrate from LiteLLM to Stockyard. Same OpenAI-compatible API, single Go binary, no dependencies.",
"1. Stop LiteLLM proxy\n2. Start Stockyard: `npx @stockyard/mcp-stockyard`\n3. Same base URL — your code doesn't change",
["migration-guide.md"]);
});
gen("instructor", "Instructor / Pydantic AI", "AI Frameworks", "Config guide", "Use Instructor structured extraction with Stockyard.", () => {
write("instructor", "example.py", `
import instructor
from openai import OpenAI
client = instructor.from_openai(
OpenAI(
base_url="http://localhost:4000/v1",
api_key="any-string",
)
)
# Stockyard's StructuredShield validates JSON automatically
user = client.chat.completions.create(
model="gpt-4o",
response_model=User,
messages=[{"role": "user", "content": "Extract: John is 25"}],
)`);
readme("instructor", "Instructor / Pydantic AI", "AI Frameworks", "Config guide",
"Use Instructor structured extraction through Stockyard. Pairs naturally with StructuredShield.",
"1. `pip install instructor openai`\n2. Point OpenAI client at Stockyard\n3. StructuredShield adds automatic JSON validation on top",
["example.py"]);
});
gen("dspy", "DSPy", "AI Frameworks", "PyPI module", "Route DSPy optimization calls through Stockyard.", () => {
write("dspy", "example.py", `
import dspy
# DSPy makes thousands of LLM calls during optimization.
# Stockyard caching + cost caps are essential.
lm = dspy.LM(
model="openai/gpt-4o-mini",
api_base="http://localhost:4000/v1",
api_key="any-string",
)
dspy.configure(lm=lm)`);
readme("dspy", "DSPy", "AI Frameworks", "PyPI module",
"Route DSPy optimization calls through Stockyard. DSPy makes thousands of LLM calls per optimization run — caching and cost caps are essential.",
"1. Start Stockyard with CostCap enabled\n2. Set `api_base` in DSPy LM config\n3. CacheLayer dramatically reduces optimization cost",
["example.py"]);
});
gen("guidance", "Guidance", "AI Frameworks", "Config guide", "Use Microsoft Guidance with Stockyard.", () => {
write("guidance", "example.py", `
import guidance
# Set OpenAI base URL to Stockyard
import os
os.environ["OPENAI_API_BASE"] = "http://localhost:4000/v1"
os.environ["OPENAI_API_KEY"] = "any-string"
model = guidance.models.OpenAI("gpt-4o")`);
readme("guidance", "Guidance", "AI Frameworks", "Config guide",
"Use Microsoft Guidance constrained generation through Stockyard.",
"1. Set `OPENAI_API_BASE=http://localhost:4000/v1`\n2. Use Guidance normally\n3. StructuredShield adds validation on top",
["example.py"]);
});
gen("mirascope", "Mirascope", "AI Frameworks", "Config guide", "Route Mirascope calls through Stockyard.", () => {
write("mirascope", "example.py", `
from mirascope.core import openai
# Point at Stockyard
import os
os.environ["OPENAI_API_BASE"] = "http://localhost:4000/v1"
@openai.call("gpt-4o")
def recommend_book(genre: str) -> str:
return f"Recommend a {genre} book"`);
readme("mirascope", "Mirascope", "AI Frameworks", "Config guide",
"Route Mirascope Python LLM calls through Stockyard.",
"1. Set `OPENAI_API_BASE` environment variable\n2. Use Mirascope normally",
["example.py"]);
});
// ═══════════════════════════════════════════════════════════════
// 3.3 WORKFLOW & AUTOMATION (10)
// ═══════════════════════════════════════════════════════════════
gen("zapier", "Zapier", "Workflow", "Zapier app", "Trigger Stockyard actions from Zapier workflows.", () => {
write("zapier", "setup.md", `
# Zapier + Stockyard
## Option 1: Webhooks by Zapier
1. Use "Webhooks by Zapier" action
2. Method: POST
3. URL: http://your-stockyard-host:4000/v1/chat/completions
4. Headers: Content-Type: application/json
5. Body: {"model":"gpt-4o","messages":[{"role":"user","content":"{{input}}"}]}
## Option 2: OpenAI Integration with Custom URL
Some Zapier OpenAI actions support custom base URLs.
Set to your Stockyard instance URL.
`);
readme("zapier", "Zapier", "Workflow", "Zapier app",
"Trigger LLM calls through Stockyard from Zapier workflows. Cost-capped AI automation.",
"1. Deploy Stockyard to a public URL (Railway/Render/Fly.io)\n2. Use Webhooks by Zapier to call the API\n3. See `setup.md` for details",
["setup.md"]);
});
gen("make", "Make.com", "Workflow", "Custom module", "Connect Make.com scenarios to Stockyard.", () => {
write("make", "setup.md", `
# Make.com + Stockyard
1. Add an HTTP module to your scenario
2. URL: http://your-stockyard-host:4000/v1/chat/completions
3. Method: POST
4. Headers: Content-Type: application/json
5. Body: {"model":"gpt-4o","messages":[{"role":"user","content":"{{input}}"}]}
6. Parse response: choices[0].message.content
`);
readme("make", "Make.com", "Workflow", "Custom module",
"Connect Make.com automation scenarios to Stockyard.",
"1. Deploy Stockyard publicly\n2. Add HTTP module pointing at Stockyard\n3. All Make.com LLM calls are now tracked",
["setup.md"]);
});
gen("pipedream", "Pipedream", "Workflow", "Node.js component", "Use Stockyard in Pipedream workflows.", () => {
write("pipedream", "stockyard-step.mjs", `
// Pipedream Node.js step
import { OpenAI } from "openai";
export default defineComponent({
async run({ steps, $ }) {
const client = new OpenAI({
baseURL: "http://your-stockyard-host:4000/v1",
apiKey: "any-string",
});
const response = await client.chat.completions.create({
model: "gpt-4o",
messages: [{ role: "user", content: steps.trigger.event.body.prompt }],
});
return response.choices[0].message.content;
},
});`);
readme("pipedream", "Pipedream", "Workflow", "Node.js component",
"Use Stockyard in Pipedream developer workflows.",
"1. Deploy Stockyard\n2. Add Node.js step with OpenAI SDK pointed at Stockyard\n3. See `stockyard-step.mjs` for template",
["stockyard-step.mjs"]);
});
gen("activepieces", "Activepieces", "Workflow", "TypeScript connector", "Open-source Zapier alternative with Stockyard.", () => {
write("activepieces", "setup.md", `
# Activepieces + Stockyard
Use the HTTP piece to call Stockyard:
1. Method: POST
2. URL: http://localhost:4000/v1/chat/completions
3. Headers: {"Content-Type": "application/json"}
4. Body: {"model":"gpt-4o","messages":[{"role":"user","content":"{{trigger.body}}"}]}
`);
readme("activepieces", "Activepieces", "Workflow", "TypeScript connector",
"Connect Activepieces (open-source Zapier) to Stockyard.",
"1. Start Stockyard\n2. Use HTTP piece to call the API\n3. All requests tracked in dashboard",
["setup.md"]);
});
gen("temporal", "Temporal / Inngest", "Workflow", "Activity definitions", "Durable LLM workflows with Stockyard.", () => {
write("temporal", "activities.go", `
package stockyard
import (
"context"
"github.com/sashabaranov/go-openai"
)
// StockyardActivity wraps LLM calls through Stockyard proxy
func StockyardActivity(ctx context.Context, prompt string) (string, error) {
client := openai.NewClientWithConfig(openai.ClientConfig{
BaseURL: "http://localhost:4000/v1",
})
resp, err := client.CreateChatCompletion(ctx, openai.ChatCompletionRequest{
Model: "gpt-4o",
Messages: []openai.ChatCompletionMessage{{Role: "user", Content: prompt}},
})
if err != nil {
return "", err
}
return resp.Choices[0].Message.Content, nil
}`);
write("temporal", "inngest-example.ts", `
import { inngest } from "./client";
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "http://localhost:4000/v1", apiKey: "any" });
export const summarize = inngest.createFunction(
{ id: "summarize" },
{ event: "doc/uploaded" },
async ({ event, step }) => {
const result = await step.run("llm-call", async () => {
const r = await client.chat.completions.create({
model: "gpt-4o",
messages: [{ role: "user", content: \`Summarize: \${event.data.text}\` }],
});
return r.choices[0].message.content;
});
return { summary: result };
}
);`);
readme("temporal", "Temporal / Inngest", "Workflow", "Activity definitions",
"Build durable LLM workflows with Temporal or Inngest, routed through Stockyard.",
"1. Start Stockyard\n2. Use the Go activity or Inngest step examples\n3. Retries, cost caps, and caching handled by Stockyard",
["activities.go", "inngest-example.ts"]);
});
gen("windmill", "Windmill", "Workflow", "Resource + templates", "Use Stockyard in Windmill scripts.", () => {
write("windmill", "example.py", `
# Windmill Python script with Stockyard
import openai
def main(prompt: str):
client = openai.OpenAI(
base_url="http://stockyard:4000/v1",
api_key="any-string",
)
r = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": prompt}],
)
return r.choices[0].message.content`);
readme("windmill", "Windmill", "Workflow", "Resource + templates",
"Use Stockyard in Windmill (open-source Retool for scripts).",
"1. Deploy Stockyard alongside Windmill\n2. Create OpenAI resource pointing at Stockyard\n3. All scripts use cost-capped LLM calls",
["example.py"]);
});
gen("node-red", "Node-RED", "Workflow", "npm nodes", "Visual LLM workflows through Stockyard.", () => {
write("node-red", "flow.json", `
[
{
"id": "stockyard-llm",
"type": "http request",
"name": "Stockyard LLM",
"method": "POST",
"url": "http://localhost:4000/v1/chat/completions",
"headers": { "Content-Type": "application/json" },
"payload": "{\"model\":\"gpt-4o\",\"messages\":[{\"role\":\"user\",\"content\":\"{{payload}}\"}]}"
}
]`);
readme("node-red", "Node-RED", "Workflow", "npm nodes",
"Build visual LLM flows in Node-RED through Stockyard.",
"1. Import `flow.json` into Node-RED\n2. Start Stockyard on localhost:4000\n3. Connect input/output nodes",
["flow.json"]);
});
gen("airflow", "Apache Airflow", "Workflow", "PyPI provider", "Batch LLM pipelines with Airflow + Stockyard.", () => {
write("airflow", "stockyard_operator.py", `
from airflow.models import BaseOperator
from openai import OpenAI
class StockyardOperator(BaseOperator):
def __init__(self, prompt, model="gpt-4o", **kwargs):
super().__init__(**kwargs)
self.prompt = prompt
self.model = model
def execute(self, context):
client = OpenAI(
base_url="http://stockyard:4000/v1",
api_key="any-string",
)
r = client.chat.completions.create(
model=self.model,
messages=[{"role": "user", "content": self.prompt}],
)
return r.choices[0].message.content`);
readme("airflow", "Apache Airflow", "Workflow", "PyPI provider",
"Run batch LLM data pipelines with Airflow, routed through Stockyard for cost control.",
"1. Deploy Stockyard in your Airflow network\n2. Use `StockyardOperator` in DAGs\n3. BatchQueue handles concurrency",
["stockyard_operator.py"]);
});
gen("prefect", "Prefect", "Workflow", "PyPI package", "Prefect flows with Stockyard LLM calls.", () => {
write("prefect", "example.py", `
from prefect import flow, task
from openai import OpenAI
client = OpenAI(base_url="http://localhost:4000/v1", api_key="any")
@task
def summarize(text: str) -> str:
r = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": f"Summarize: {text}"}],
)
return r.choices[0].message.content
@flow
def process_docs(docs: list[str]):
return [summarize(d) for d in docs]`);
readme("prefect", "Prefect", "Workflow", "PyPI package",
"Use Stockyard in Prefect data pipeline flows.",
"1. Start Stockyard\n2. Point OpenAI client at `http://localhost:4000/v1`\n3. All Prefect LLM tasks get caching + cost caps",
["example.py"]);
});
gen("dagster", "Dagster", "Workflow", "PyPI package", "Dagster asset pipelines with Stockyard.", () => {
write("dagster", "example.py", `
from dagster import asset
from openai import OpenAI
client = OpenAI(base_url="http://localhost:4000/v1", api_key="any")
@asset
def summarized_docs(raw_docs):
results = []
for doc in raw_docs:
r = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": f"Summarize: {doc}"}],
)
results.append(r.choices[0].message.content)
return results`);
readme("dagster", "Dagster", "Workflow", "PyPI package",
"Build Dagster asset pipelines with Stockyard-routed LLM calls.",
"1. Start Stockyard\n2. Use OpenAI SDK pointed at Stockyard in your assets\n3. BatchQueue recommended for large datasets",
["example.py"]);
});
// ═══════════════════════════════════════════════════════════════
// 3.4 CHAT & CONVERSATIONAL AI (7)
// ═══════════════════════════════════════════════════════════════
gen("botpress", "Botpress", "Chat Platforms", "Integration module", "Route Botpress LLM calls through Stockyard.", () => {
write("botpress", "setup.md", `
# Botpress + Stockyard
In Botpress Studio:
1. Settings > AI > Custom LLM
2. Endpoint: http://your-stockyard-host:4000/v1/chat/completions
3. API Key: any-string
4. Model: gpt-4o
All Botpress AI features (intents, entities, generation) route through Stockyard.
`);
readme("botpress", "Botpress", "Chat Platforms", "Integration module",
"Route Botpress chatbot LLM calls through Stockyard for cost control.",
"1. Deploy Stockyard\n2. Set custom LLM endpoint in Botpress Studio\n3. All bot AI calls are now tracked",
["setup.md"]);
});
gen("rasa", "Rasa", "Chat Platforms", "LLM connector", "Use Stockyard with Rasa conversational AI.", () => {
write("rasa", "endpoints.yml", `
# endpoints.yml
llm:
type: openai
api_base: http://stockyard:4000/v1
api_key: any-string
model: gpt-4o`);
readme("rasa", "Rasa", "Chat Platforms", "LLM connector",
"Route Rasa enterprise conversational AI through Stockyard.",
"1. Set `api_base` in `endpoints.yml`\n2. Start Stockyard alongside Rasa\n3. All LLM calls get cost tracking and caching",
["endpoints.yml"]);
});
gen("voiceflow", "Voiceflow", "Chat Platforms", "API integration", "Connect Voiceflow to Stockyard.", () => {
write("voiceflow", "setup.md", `
# Voiceflow + Stockyard
1. In Voiceflow, use API Block or Custom Integration
2. Endpoint: http://your-stockyard-host:4000/v1/chat/completions
3. Method: POST
4. Pass conversation context as messages array
`);
readme("voiceflow", "Voiceflow", "Chat Platforms", "API integration",
"Connect Voiceflow visual conversation design to Stockyard.",
"1. Deploy Stockyard publicly\n2. Use API Block in Voiceflow pointing at Stockyard\n3. Conversations get cost tracking",
["setup.md"]);
});
gen("chainlit", "Chainlit", "Chat Platforms", "Config guide", "Build Chainlit chat UIs with Stockyard backend.", () => {
write("chainlit", "app.py", `
import chainlit as cl
from openai import AsyncOpenAI
client = AsyncOpenAI(base_url="http://localhost:4000/v1", api_key="any")
@cl.on_message
async def main(message: cl.Message):
response = await client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": message.content}],
stream=True,
)
msg = cl.Message(content="")
async for chunk in response:
if chunk.choices[0].delta.content:
await msg.stream_token(chunk.choices[0].delta.content)
await msg.send()`);
readme("chainlit", "Chainlit", "Chat Platforms", "Config guide",
"Build Chainlit Python chat UIs with Stockyard as the LLM backend.",
"1. `pip install chainlit openai`\n2. Copy `app.py`\n3. `chainlit run app.py` — all calls route through Stockyard",
["app.py"]);
});
gen("gradio", "Gradio / HuggingFace", "Chat Platforms", "Component", "Use Stockyard with Gradio chat interfaces.", () => {
write("gradio", "app.py", `
import gradio as gr
from openai import OpenAI
client = OpenAI(base_url="http://localhost:4000/v1", api_key="any")
def chat(message, history):
messages = [{"role": "user" if i%2==0 else "assistant", "content": m}
for i, m in enumerate([m for pair in history for m in pair] + [message])]
r = client.chat.completions.create(model="gpt-4o", messages=messages)
return r.choices[0].message.content
demo = gr.ChatInterface(chat, title="Chat via Stockyard")
demo.launch()`);
readme("gradio", "Gradio / HuggingFace", "Chat Platforms", "Component",
"Build Gradio chat demos with Stockyard backend.",
"1. `pip install gradio openai`\n2. Copy `app.py`\n3. `python app.py` — Stockyard handles all LLM calls",
["app.py"]);
});
gen("streamlit", "Streamlit", "Chat Platforms", "PyPI component", "Streamlit AI apps with Stockyard backend.", () => {
write("streamlit", "app.py", `
import streamlit as st
from openai import OpenAI
client = OpenAI(base_url="http://localhost:4000/v1", api_key="any")
st.title("Chat via Stockyard")
if prompt := st.chat_input("Ask anything"):
st.chat_message("user").write(prompt)
r = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": prompt}],
)
st.chat_message("assistant").write(r.choices[0].message.content)`);
readme("streamlit", "Streamlit", "Chat Platforms", "PyPI component",
"Build Streamlit AI apps with Stockyard backend for cost control.",
"1. `pip install streamlit openai`\n2. Copy `app.py`\n3. `streamlit run app.py`",
["app.py"]);
});
gen("mesop", "Mesop", "Chat Platforms", "Config + example", "Google's Mesop UI framework with Stockyard.", () => {
write("mesop", "app.py", `
import mesop as me
from openai import OpenAI
client = OpenAI(base_url="http://localhost:4000/v1", api_key="any")
@me.page(path="/")
def page():
me.text("Chat via Stockyard")
# Build Mesop chat UI with Stockyard-routed LLM calls`);
readme("mesop", "Mesop", "Chat Platforms", "Config + example",
"Use Google's Mesop Python UI framework with Stockyard.",
"1. `pip install mesop openai`\n2. Point OpenAI client at Stockyard\n3. Build Mesop UI normally",
["app.py"]);
});
// ═══════════════════════════════════════════════════════════════
// 3.5 CLOUD & INFRASTRUCTURE (14)
// ═══════════════════════════════════════════════════════════════
gen("aws-lambda", "AWS Lambda", "Cloud", "Lambda layer + SAM", "Run Stockyard as a Lambda layer.", () => {
write("aws-lambda", "template.yaml", `
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Resources:
StockyardFunction:
Type: AWS::Serverless::Function
Properties:
Handler: bootstrap
Runtime: provided.al2023
CodeUri: ./stockyard-binary/
MemorySize: 256
Timeout: 30
Environment:
Variables:
OPENAI_API_KEY: !Ref OpenAIKey
STOCKYARD_PORT: "4000"
Events:
Api:
Type: Api
Properties:
Path: /{proxy+}
Method: ANY`);
readme("aws-lambda", "AWS Lambda", "Cloud", "Lambda layer + SAM",
"Deploy Stockyard as an AWS Lambda function for serverless LLM proxy.",
"1. Download Stockyard Linux binary\n2. Deploy with SAM template\n3. Point your app at the Lambda URL",
["template.yaml"]);
});
gen("aws-cdk", "AWS CDK", "Cloud", "npm package", "Deploy Stockyard with AWS CDK.", () => {
write("aws-cdk", "stockyard-stack.ts", `
import * as cdk from "aws-cdk-lib";
import * as ecs from "aws-cdk-lib/aws-ecs";
import * as ecsPatterns from "aws-cdk-lib/aws-ecs-patterns";
export class StockyardStack extends cdk.Stack {
constructor(scope: cdk.App, id: string) {
super(scope, id);
new ecsPatterns.ApplicationLoadBalancedFargateService(this, "Stockyard", {
taskImageOptions: {
image: ecs.ContainerImage.fromRegistry("stockyard/stockyard:latest"),
containerPort: 4000,
environment: {
OPENAI_API_KEY: process.env.OPENAI_API_KEY!,
},
},
publicLoadBalancer: true,
});
}
}`);
readme("aws-cdk", "AWS CDK", "Cloud", "npm package",
"Deploy Stockyard on AWS ECS Fargate with CDK. One construct, production-ready.",
"1. `npm install aws-cdk-lib`\n2. Add `StockyardStack` to your CDK app\n3. `cdk deploy`",
["stockyard-stack.ts"]);
});
gen("terraform", "Terraform", "Cloud", "Terraform Registry", "Deploy Stockyard with Terraform.", () => {
write("terraform", "main.tf", `
# Stockyard on Docker / any cloud
resource "docker_container" "stockyard" {
name = "stockyard"
image = "stockyard/stockyard:latest"
ports {
internal = 4000
external = 4000
}
env = [
"OPENAI_API_KEY=\${var.openai_key}",
]
volumes {
host_path = "/opt/stockyard/data"
container_path = "/data"
}
}
variable "openai_key" {
type = string
sensitive = true
}`);
readme("terraform", "Terraform", "Cloud", "Terraform Registry",
"Deploy Stockyard with Terraform on any cloud provider.",
"1. Copy `main.tf`\n2. `terraform init && terraform apply`\n3. Stockyard running on port 4000",
["main.tf"]);
});
gen("helm", "Kubernetes Helm", "Cloud", "Helm chart", "Deploy Stockyard on Kubernetes.", () => {