Skip to content

shpitdev/foundry-ai

Repository files navigation

@nyrra/foundry-ai

Thin Palantir Foundry provider adapters and model catalog for the Vercel AI SDK.

CI Semgrep npm next Ask DeepWiki

TypeScript AI%20SDK Nx pnpm

Biome Vitest AI%20SDK%20DevTools TanStack%20Intent License

What It Does

  • Routes AI SDK language-model calls and OpenAI embeddings through Foundry's provider-compatible proxy endpoints.
  • Maps friendly model names such as gpt-5-mini, claude-sonnet-4.6, and gemini-3.1-flash-lite to Foundry RIDs.
  • Keeps installs lean through provider-specific subpaths for OpenAI, Anthropic, and Google.
  • Ships a TanStack Intent skill plus a small set of provider-specific reference examples.
  • Verifies the public alias catalog with a live Foundry capability harness instead of hand-waving support claims.

How It Works

  • loadFoundryConfig() resolves the proxy base URL, token, and optional attribution header from environment variables.
  • Provider factories such as createFoundryOpenAI() adapt AI SDK provider clients to Foundry-compatible endpoints and request constraints.
  • The package exposes a normalized model catalog for current aliases, but still lets you pass a raw Foundry RID when your stack has a newer enrollment.
  • Multi-provider routing stays in application code with AI SDK createProviderRegistry; the package deliberately does not ship its own registry wrapper.

Quick Start

Install the package, ai, and only the provider peer dependency you need:

pnpm add @nyrra/foundry-ai ai @ai-sdk/openai
FOUNDRY_URL=https://your-stack.palantirfoundry.com
FOUNDRY_TOKEN=your-token
FOUNDRY_ATTRIBUTION_RID=
FOUNDRY_TRACE_PARENT=
FOUNDRY_TRACE_STATE=
import { loadFoundryConfig } from '@nyrra/foundry-ai';
import { createFoundryOpenAI } from '@nyrra/foundry-ai/openai';
import { generateText } from 'ai';

const openai = createFoundryOpenAI(loadFoundryConfig());

const { text } = await generateText({
  model: openai('gpt-5-mini'),
  prompt: 'Reply in one sentence.',
});

console.log(text);

See the published package README for the npm-facing surface: packages/foundry-ai/README.md.

Package Identity

The repository lives at shpitdev/foundry-ai, while releases continue under the existing @nyrra/foundry-ai npm package. Consumers keep the same dependency, imports, root exports, provider subpaths, FOUNDRY_* variables, model aliases, and raw-RID behavior.

Agent Skill

Install the published agent skill with:

npx skills add https://github.com/shpitdev/foundry-ai --skill foundry-ai-provider

That flow lets the skills CLI prompt for scope and agent links interactively. The install event is what skills.sh uses for leaderboard/indexing.

Testing And CI

Layer Present Tooling Runs in CI
unit yes Vitest yes
integration no none no
e2e api yes live Vitest harness + manual Bun example scripts against Foundry no
e2e web no none no

e2e api coverage exists, but it is intentionally not in CI because it requires live Foundry credentials and proxy access.

CI runs lint, unit tests, typecheck, build, TanStack Intent validation, and a package-content audit. The checked-in results in packages/foundry-ai/docs/harness-capability-results.md are harness output, not a blanket support promise.

Developer Tooling

  • AI SDK DevTools is wired into the live harness and the advanced DevTools instrumentation examples. The middleware captures every streamText call — tool invocations, results, token usage, and full request/response payloads — into .devtools/generations.json. Start the viewer in a separate terminal with npx @ai-sdk/devtools and open http://localhost:4983. For the live harness: pnpm run test:live:devtools -- --no-update-docs --model openai:gpt-5-nano or just live-model openai:gpt-5-nano. For the advanced examples: pnpm run example:devtools or pnpm run example:devtools:parallel.
  • TanStack Intent validates the published skill surface with pnpm exec intent validate packages/foundry-ai/skills.
  • In consumer repos, TanStack Intent discovers the installed package from node_modules. After adding @nyrra/foundry-ai to the app, run npx @tanstack/intent@latest list and map node_modules/@nyrra/foundry-ai/skills/foundry-ai-provider/SKILL.md in your agent config.
  • The safe example runner builds first and then executes with Bun when available. Start with pnpm run example tool-calling openai, bun run example:devtools, or bun run example:devtools:parallel.

Docs And Examples

Base examples live under examples/base, which is a symlink to the published skill reference examples. Advanced repo-only examples live under examples/advanced.

Release Workflow

Stable releases and prereleases run through Nx and the shared GitHub Actions workflow using npm trusted publishing and provenance. Publishing remains disabled until the existing package trusts shpitdev/foundry-ai. See docs/RELEASING.md.

External Services

  • Required: a Palantir Foundry stack with access to the LLM proxy endpoints.
  • Optional: Exa for the advanced tool-calling examples.

Copyright And License

Copyright 2026 SHPIT LLC

Licensed under Apache-2.0. See LICENSE and NOTICE.

About

Thin Palantir Foundry provider adapters and model catalog for the Vercel AI SDK.

Topics

Resources

License

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors