### Clone Repository and Run Example Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/docs/marketplace/ts-sdks/ai-sdk.mdx Steps to clone the Agentic repository, install dependencies, build the project, set up environment variables, and run the AI SDK example. ```sh git clone git@github.com:transitive-bullshit/agentic.git cd agentic pnpm install pnpm build echo 'OPENAI_API_KEY=your-key' >> .env npx tsx examples/ts-sdks/ai-sdk/bin/weather.ts ``` -------------------------------- ### Install @agentic/ai-sdk Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/stdlib/ai-sdk/readme.md Install the @agentic/ai-sdk package along with zod and ai using npm. This is the initial setup step for using the SDK. ```bash npm i @agentic/ai-sdk zod ai ``` -------------------------------- ### Clone Repository and Run Example Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/docs/marketplace/ts-sdks/mastra.mdx Steps to clone the Agentic repository, install dependencies, build the project, set up environment variables, and run the Mastra weather agent example. ```sh git clone git@github.com:transitive-bullshit/agentic.git cd agentic pnpm install pnpm build echo 'OPENAI_API_KEY=your-key' >> .env npx tsx examples/ts-sdks/mastra/bin/weather.ts ``` -------------------------------- ### Run the OpenAI Example Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/docs/marketplace/ts-sdks/openai-responses.mdx Clone the agentic repository, install dependencies, build the project, set your OpenAI API key in a .env file, and then run the example using tsx. ```sh git clone git@github.com:transitive-bullshit/agentic.git cd agentic pnpm install pnpm build echo 'OPENAI_API_KEY=your-key' >> .env npx tsx examples/ts-sdks/openai/bin/weather-responses.ts ``` -------------------------------- ### Run the example project Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/docs/marketplace/ts-sdks/openai-chat.mdx Commands to clone the repository and execute the weather example script. ```sh git clone git@github.com:transitive-bullshit/agentic.git cd agentic pnpm install pnpm build echo 'OPENAI_API_KEY=your-key' >> .env npx tsx examples/ts-sdks/openai/bin/weather.ts ``` -------------------------------- ### Run the LlamaIndex example Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/docs/marketplace/ts-sdks/llamaindex.mdx Clone the repository and execute the weather example script. ```sh git clone git@github.com:transitive-bullshit/agentic.git cd agentic pnpm install pnpm build echo 'OPENAI_API_KEY=your-key' >> .env npx tsx examples/ts-sdks/llamaindex/bin/weather.ts ``` -------------------------------- ### Clone Agentic Repository and Run LangChain Example Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/docs/marketplace/ts-sdks/langchain.mdx Steps to clone the Agentic repository, install dependencies, build the project, set up environment variables, and run the LangChain example using tsx. ```sh git clone git@github.com:transitive-bullshit/agentic.git cd agentic pnpm install pnpm build echo 'OPENAI_API_KEY=your-key' >> .env npx tsx examples/ts-sdks/langchain/bin/weather.ts ``` -------------------------------- ### Install @agentic/serpapi and zod Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/stdlib/serpapi/readme.md Use npm to install the @agentic/serpapi package along with zod for schema validation. This is the primary setup step for using the SDK. ```bash npm i @agentic/serpapi zod ``` -------------------------------- ### Start All Services in Development Mode Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/CLAUDE.md Use this command to start all services concurrently for local development. ```bash pnpm dev ``` -------------------------------- ### Install @agentic/platform-tool-client Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/packages/tool-client/readme.md Install the package using npm. ```bash npm i @agentic/platform-tool-client ``` -------------------------------- ### Install @agentic/platform-api-client Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/packages/api-client/readme.md Install the package using npm. This is the first step before using the client in your project. ```bash npm i @agentic/platform-api-client ``` -------------------------------- ### Install Agentic CLI with bun Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/docs/publishing/guides/existing-mcp-server.mdx Install the Agentic CLI globally using bun. Ensure Node.js is installed. ```bash bun install -g @agentic/cli ``` -------------------------------- ### Install Agentic Platform with bun Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/docs/publishing/guides/existing-mcp-server.mdx Install the `@agentic/platform` package as a development dependency using bun. ```bash bun add -d @agentic/platform ``` -------------------------------- ### Importing External ESM Module Example Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/CLAUDE.md Illustrates importing an external module that uses ESM, like Zod. Ensure the module is installed. ```javascript import zod from 'zod' ``` -------------------------------- ### Install @agentic/langchain dependencies Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/stdlib/langchain/readme.md Run this command to install the necessary packages for using the adapter. ```bash npm i @agentic/langchain zod @langchain/core ``` -------------------------------- ### Install additional dependencies Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/docs/marketplace/ts-sdks/genkit.mdx Install optional packages for OpenAI support. ```npm npm install genkitx-openai dotenv ``` ```pnpm pnpm add genkitx-openai dotenv ``` ```bun bun add genkitx-openai dotenv ``` ```yarn yarn add genkitx-openai dotenv ``` -------------------------------- ### Install LangChain and Agentic Packages (bun) Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/docs/marketplace/ts-sdks/langchain.mdx Install the necessary LangChain and Agentic packages using bun. ```bash bun add langchain @langchain/core @langchain/agents @agentic/langchain @agentic/platform-tool-client ``` -------------------------------- ### Install Additional Dependencies (bun) Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/docs/marketplace/ts-sdks/mastra.mdx Install the OpenAI provider and dotenv for environment variable management using bun. ```bash bun add @ai-sdk/openai dotenv ``` -------------------------------- ### Install Mastra Core Packages (bun) Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/docs/marketplace/ts-sdks/mastra.mdx Install the necessary Mastra core packages using bun. ```bash bun add @mastra/core @agentic/mastra @agentic/platform-tool-client ``` -------------------------------- ### Install fastmcp package Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/docs/publishing/guides/py-fastmcp.mdx Install the fastmcp package using either uv or pip. Ensure Python is installed beforehand. ```bash uv add fastmcp ``` ```bash pip install fastmcp ``` -------------------------------- ### Install @agentic/cli Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/packages/cli/readme.md Global installation command for the CLI tool. ```bash npm i -g @agentic/cli ``` -------------------------------- ### Create and Execute a LangChain Agent with Tool Calling Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/docs/marketplace/ts-sdks/langchain.mdx This TypeScript example demonstrates how to create a LangChain agent that uses Agentic tools. It requires an OpenAI API key and an Agentic API key for full functionality. Ensure you have the necessary packages installed. ```typescript import 'dotenv/config' import { createLangChainTools } from '@agentic/langchain' import { AgenticToolClient } from '@agentic/platform-tool-client' import { ChatPromptTemplate } from '@langchain/core/prompts' import { ChatOpenAI } from '@langchain/openai' import { AgentExecutor, createToolCallingAgent } from 'langchain/agents' async function main() { const searchTool = await AgenticToolClient.fromIdentifier('@agentic/search') const tools = createLangChainTools(searchTool) const agent = createToolCallingAgent({ llm: new ChatOpenAI({ model: 'gpt-4o-mini', temperature: 0 }), tools, prompt: ChatPromptTemplate.fromMessages([ ['system', 'You are a helpful assistant. Be as concise as possible.'], ['placeholder', '{chat_history}'], ['human', '{input}'], ['placeholder', '{agent_scratchpad}'] ]) }) const agentExecutor = new AgentExecutor({ agent, tools // verbose: true }) const result = await agentExecutor.invoke({ input: 'What is the weather in San Francisco?' }) console.log(result.output) } await main() ``` -------------------------------- ### Install Agentic CLI with pnpm Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/docs/publishing/guides/existing-mcp-server.mdx Install the Agentic CLI globally using pnpm. Ensure Node.js is installed. ```bash pnpm i -g @agentic/cli ``` -------------------------------- ### Install Additional Dependencies (npm) Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/docs/marketplace/ts-sdks/mastra.mdx Install the OpenAI provider and dotenv for environment variable management using npm. ```bash npm install @ai-sdk/openai dotenv ``` -------------------------------- ### Install Agentic CLI with yarn Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/docs/publishing/guides/existing-mcp-server.mdx Install the Agentic CLI globally using yarn. Ensure Node.js is installed. ```bash yarn global add @agentic/cli ``` -------------------------------- ### Install Agentic Platform with pnpm Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/docs/publishing/guides/existing-mcp-server.mdx Install the `@agentic/platform` package as a development dependency using pnpm. ```bash pnpm add -D @agentic/platform ``` -------------------------------- ### Install @agentic/platform-core Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/packages/platform-core/readme.md Install the package via npm. ```bash npm i @agentic/platform-core ``` -------------------------------- ### Importing from Shared Packages Example Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/CLAUDE.md Demonstrates importing modules from shared packages using a path alias. Ensure the alias is correctly configured. ```javascript import { logger } from '~/types' ``` -------------------------------- ### Install Additional Dependencies for OpenAI Support (bun) Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/docs/marketplace/ts-sdks/langchain.mdx Install the @langchain/openai and dotenv packages using bun. ```bash bun add @langchain/openai dotenv ``` -------------------------------- ### Install @agentic/platform-types Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/packages/types/readme.md Install the package using npm. ```bash npm i @agentic/platform-types ``` -------------------------------- ### Create xmcp App Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/docs/publishing/guides/ts-xmcp.mdx Use this command to initiate a new xmcp application. Ensure Node.js is installed prior to execution. ```bash npx create-xmcp-app@latest ``` -------------------------------- ### Install LangChain and Agentic Packages (yarn) Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/docs/marketplace/ts-sdks/langchain.mdx Install the necessary LangChain and Agentic packages using yarn. ```bash yarn add langchain @langchain/core @langchain/agents @agentic/langchain @agentic/platform-tool-client ``` -------------------------------- ### Install LangChain and Agentic Packages (npm) Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/docs/marketplace/ts-sdks/langchain.mdx Install the necessary LangChain and Agentic packages using npm. ```bash npm install langchain @langchain/core @langchain/agents @agentic/langchain @agentic/platform-tool-client ``` -------------------------------- ### Install Additional Dependencies (pnpm) Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/docs/marketplace/ts-sdks/mastra.mdx Install the OpenAI provider and dotenv for environment variable management using pnpm. ```bash pnpm add @ai-sdk/openai dotenv ``` -------------------------------- ### Install Agentic and OpenAI dependencies Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/docs/marketplace/ts-sdks/openai-chat.mdx Install the necessary packages using your preferred package manager. ```npm npm install openai @agentic/platform-tool-client ``` ```pnpm pnpm add openai @agentic/platform-tool-client ``` ```bun bun add openai @agentic/platform-tool-client ``` ```yarn yarn add openai @agentic/platform-tool-client ``` -------------------------------- ### Install Mastra Core Packages (yarn) Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/docs/marketplace/ts-sdks/mastra.mdx Install the necessary Mastra core packages using yarn. ```bash yarn add @mastra/core @agentic/mastra @agentic/platform-tool-client ``` -------------------------------- ### Install Additional Dependencies (yarn) Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/docs/marketplace/ts-sdks/mastra.mdx Install the OpenAI provider and dotenv for environment variable management using yarn. ```bash yarn add @ai-sdk/openai dotenv ``` -------------------------------- ### Install OpenAI provider dependencies Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/docs/marketplace/ts-sdks/llamaindex.mdx Install the optional OpenAI provider and dotenv for environment variable management. ```npm npm install @llamaindex/openai dotenv ``` ```pnpm pnpm add @llamaindex/openai dotenv ``` ```bun bun add @llamaindex/openai dotenv ``` ```yarn yarn add @llamaindex/openai dotenv ``` -------------------------------- ### Install Agentic Platform with npm Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/docs/publishing/guides/existing-mcp-server.mdx Install the `@agentic/platform` package as a development dependency using npm. ```bash npm i -save-dev @agentic/platform ``` -------------------------------- ### Install LangChain and Agentic Packages (pnpm) Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/docs/marketplace/ts-sdks/langchain.mdx Install the necessary LangChain and Agentic packages using pnpm. ```bash pnpm add langchain @langchain/core @langchain/agents @agentic/langchain @agentic/platform-tool-client ``` -------------------------------- ### Install @agentic/serper Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/stdlib/serper/readme.md Install the package along with the required zod peer dependency. ```bash npm i @agentic/serper zod ``` -------------------------------- ### Install Agentic AI SDK and Platform Tool Client Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/docs/marketplace/ts-sdks/ai-sdk.mdx Install the necessary packages for using Agentic tools with the Vercel AI SDK using npm, pnpm, bun, or yarn. ```bash npm install ai @agentic/ai-sdk @agentic/platform-tool-client ``` ```bash pnpm add ai @agentic/ai-sdk @agentic/platform-tool-client ``` ```bash bun add ai @agentic/ai-sdk @agentic/platform-tool-client ``` ```bash yarn add ai @agentic/ai-sdk @agentic/platform-tool-client ``` -------------------------------- ### ESM Import Example Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/CLAUDE.md Demonstrates correct ESM import syntax without file extensions. Use for importing modules within the project. ```javascript import { Foo } from './foo' ``` -------------------------------- ### Install Additional Dependencies for OpenAI Support (yarn) Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/docs/marketplace/ts-sdks/langchain.mdx Install the @langchain/openai and dotenv packages using yarn. ```bash yarn add @langchain/openai dotenv ``` -------------------------------- ### Install Mastra Core Packages (npm) Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/docs/marketplace/ts-sdks/mastra.mdx Install the necessary Mastra core packages using npm. ```bash npm install @mastra/core @agentic/mastra @agentic/platform-tool-client ``` -------------------------------- ### Install @agentic/genkit and zod Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/stdlib/genkit/readme.md Run this command in your terminal to install the necessary packages for using the Genkit adapter. ```bash npm i @agentic/genkit zod ``` -------------------------------- ### Install Additional Dependencies for OpenAI Support (pnpm) Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/docs/marketplace/ts-sdks/langchain.mdx Install the @langchain/openai and dotenv packages using pnpm. ```bash pnpm add @langchain/openai dotenv ``` -------------------------------- ### Install @agentic/llamaindex Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/stdlib/llamaindex/readme.md Install the @agentic/llamaindex package along with its dependencies zod and llamaindex using npm. ```bash npm i @agentic/llamaindex zod llamaindex ``` -------------------------------- ### Install Mastra Core Packages (pnpm) Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/docs/marketplace/ts-sdks/mastra.mdx Install the necessary Mastra core packages using pnpm. ```bash pnpm add @mastra/core @agentic/mastra @agentic/platform-tool-client ``` -------------------------------- ### Install @agentic/mastra Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/stdlib/mastra/readme.md Install the @agentic/mastra package along with its dependencies zod and @mastra/core using npm. ```bash npm i @agentic/mastra zod @mastra/core ``` -------------------------------- ### Free Monthly Pricing Plan (TypeScript) Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/docs/publishing/config/examples.mdx Example configuration for a free monthly pricing plan, used by default if no plans are specified. Includes rate limiting. ```typescript import { defineConfig } from '@agentic/platform' export default defineConfig({ name: 'Free Monthly Pricing Example', description: "This example shows the free monthly pricing plan which is used by default for projects that don't specify any pricing plans.", origin: { type: 'mcp', url: 'https://agentic-basic-mcp-test.onrender.com/mcp' }, pricingPlans: [ { name: 'Free', slug: 'free', lineItems: [ { slug: 'base', usageType: 'licensed', amount: 0 } ], rateLimit: { enabled: true, interval: 60, limit: 1000 } } ] }) ``` -------------------------------- ### Install Additional Dependencies for OpenAI Provider Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/docs/marketplace/ts-sdks/ai-sdk.mdx Install the OpenAI provider and dotenv for managing environment variables. This is optional if you are not using OpenAI. ```bash npm install @ai-sdk/openai dotenv ``` ```bash pnpm add @ai-sdk/openai dotenv ``` ```bash bun add @ai-sdk/openai dotenv ``` ```bash yarn add @ai-sdk/openai dotenv ``` -------------------------------- ### ESM Import with Types Example Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/CLAUDE.md Shows how to import types using ESM syntax without file extensions. Useful for type definitions. ```javascript import { type Route } from './types/root' ``` -------------------------------- ### Install LlamaIndex Agentic dependencies Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/docs/marketplace/ts-sdks/llamaindex.mdx Install the core LlamaIndex and Agentic packages required for integration. ```npm npm install llamaindex @llamaindex/workflow @agentic/llamaindex @agentic/platform-tool-client ``` ```pnpm pnpm add llamaindex @llamaindex/workflow @agentic/llamaindex @agentic/platform-tool-client ``` ```bun bun add llamaindex @llamaindex/workflow @agentic/llamaindex @agentic/platform-tool-client ``` ```yarn yarn add llamaindex @llamaindex/workflow @agentic/llamaindex @agentic/platform-tool-client ``` -------------------------------- ### Initialize and Use AgenticApiClient Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/packages/api-client/readme.md Import and instantiate the AgenticApiClient. An optional API key can be provided during initialization. This example demonstrates fetching a public project by its identifier. ```typescript import { AgenticApiClient } from '@agentic/platform-api-client' // Takes an optional `apiKey` const agenticApiClient = new AgenticApiClient() const searchProject = await agenticApiClient.getPublicProjectByIdentifier({ projectIdentifier: '@agentic/search' }) console.log(searchProject) ``` -------------------------------- ### Install FastMCP dependencies Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/docs/publishing/guides/ts-fastmcp.mdx Install the required fastmcp and zod packages using your preferred package manager. ```bash npm add fastmcp zod ``` ```bash pnpm add fastmcp zod ``` ```bash bun add fastmcp zod ``` ```bash yarn add fastmcp zod ``` -------------------------------- ### Install Hono Dependencies Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/docs/publishing/guides/ts-openapi-hono.mdx Installs necessary Hono, Zod, and OpenAPI related packages using npm, pnpm, bun, or yarn. ```bash npm add hono @hono/node-server @hono/zod-openapi zod ``` ```bash pnpm add hono @hono/node-server @hono/zod-openapi zod ``` ```bash bun add hono @hono/node-server @hono/zod-openapi zod ``` ```bash yarn add hono @hono/node-server @hono/zod-openapi zod ``` -------------------------------- ### SerperClient TypeScript Example Source: https://context7.com/transitive-bullshit/chatgpt-api/llms.txt Example of using the SerperClient directly as a TypeScript client for Google Search, including searching for news, images, videos, and places. Requires SERPER_API_KEY environment variable. ```typescript import { SerperClient } from '@agentic/serper' import { createAISDKTools } from '@agentic/ai-sdk' import { generateText } from 'ai' import { openai } from '@ai-sdk/openai' // Create a Serper client (requires SERPER_API_KEY env var) const serper = new SerperClient({ apiKey: process.env.SERPER_API_KEY }) // Use directly as a TypeScript client const searchResults = await serper.search({ q: 'latest AI developments', num: 10, type: 'news' }) console.log(searchResults.news) // Search for images const images = await serper.searchImages('cute puppies') console.log(images.images) // Search for videos const videos = await serper.searchVideos('TypeScript tutorial') console.log(videos.videos) // Search for places const places = await serper.searchPlaces('coffee shops near me') console.log(places.places) // Use as an LLM tool const result = await generateText({ model: openai('gpt-4o-mini'), tools: createAISDKTools(serper), toolChoice: 'required', prompt: 'Search for the latest news about AI' }) console.log(result.toolResults[0]) ``` -------------------------------- ### Install Additional Dependencies for OpenAI Support (npm) Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/docs/marketplace/ts-sdks/langchain.mdx Install the @langchain/openai and dotenv packages using npm to enable OpenAI integration. ```bash npm install @langchain/openai dotenv ``` -------------------------------- ### Use Agentic tools with OpenAI Chat Completions Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/docs/marketplace/ts-sdks/openai-chat.mdx Example showing how to initialize an Agentic tool, invoke it via OpenAI's tool calling API, and process the result. ```ts import 'dotenv/config' import { AgenticToolClient } from '@agentic/platform-tool-client' import OpenAI from 'openai' async function main() { const searchTool = await AgenticToolClient.fromIdentifier('@agentic/search') const openai = new OpenAI() const messages: OpenAI.ChatCompletionMessageParam[] = [ { role: 'system', content: 'You are a helpful assistant. Be as concise as possible.' }, { role: 'user', content: 'What is the weather in San Francisco?' } ] { // First call to OpenAI to invoke the tool const res = await openai.chat.completions.create({ messages, model: 'gpt-4o-mini', temperature: 0, tools: searchTool.functions.toolSpecs, tool_choice: 'required' }) const message = res.choices[0]!.message! const toolCall = message.tool_calls![0]!.function! const toolResult = await searchTool.callTool( toolCall.name, toolCall.arguments ) messages.push(message) messages.push({ role: 'tool', tool_call_id: message.tool_calls![0]!.id, content: JSON.stringify(toolResult) }) } { // Second call to OpenAI to generate a text response const res = await openai.chat.completions.create({ messages, model: 'gpt-4o-mini', temperature: 0, tools: searchTool.functions.toolSpecs }) const message = res.choices?.[0]?.message console.log(message?.content) } } await main() ``` -------------------------------- ### Install Hono MCP dependencies Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/docs/publishing/guides/ts-mcp-hono.mdx Install the required packages for Hono, MCP, and Zod using your preferred package manager. ```bash npm add hono @hono/node-server @hono/mcp @modelcontextprotocol/sdk zod ``` ```bash pnpm add hono @hono/node-server @hono/mcp @modelcontextprotocol/sdk zod ``` ```bash bun add hono @hono/node-server @hono/mcp @modelcontextprotocol/sdk zod ``` ```bash yarn add hono @hono/node-server @hono/mcp @modelcontextprotocol/sdk zod ``` -------------------------------- ### Configure Pricing Plans in agentic.config.ts Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/docs/publishing/config/pricing.mdx Examples of defining various pricing strategies including free, freemium with trials, and metered pay-as-you-go models. ```ts import { defineConfig } from '@agentic/platform' export default defineConfig({ // ... pricingPlans: [ { name: 'Free', slug: 'free', lineItems: [ { slug: 'base', usageType: 'licensed', amount: 0 } ] } ] }) ``` ```ts import { defaultFreePricingPlan, defineConfig } from '@agentic/platform' export default defineConfig({ // ... pricingPlans: [ defaultFreePricingPlan, { name: 'Basic', slug: 'basic', trialPeriodDays: 7, lineItems: [ { slug: 'base', usageType: 'licensed', amount: 499 // $4.99 USD } ] } ] }) ``` ```ts import { defineConfig } from '@agentic/platform' export default defineConfig({ // ... pricingPlans: [ { name: 'Free', slug: 'free', lineItems: [ { slug: 'base', usageType: 'licensed', amount: 0 } ], // Free but limited to 20 requests per day rateLimit: { limit: 20, interval: '1d' } }, { name: 'Pay-As-You-Go', slug: 'pay-as-you-go', lineItems: [ { slug: 'requests', usageType: 'metered', billingScheme: 'tiered', tiersMode: 'volume', // $0.00467 USD per request up to 999 requests per month // then $0.00053 USD for unlimited further requests that month tiers: [ { upTo: 999, unitAmount: 0.467 }, { upTo: 'inf', unitAmount: 0.053 } ] } ], // Limit to 1000 requests per day rateLimit: { limit: 1000, interval: '1d' } } ] }) ``` -------------------------------- ### Use Agentic Search Tool with Vercel AI SDK Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/docs/marketplace/ts-sdks/ai-sdk.mdx Example demonstrating how to use the Agentic search tool with the Vercel AI SDK and OpenAI. Requires API keys for OpenAI and Agentic. ```typescript import 'dotenv/config' import { createAISDKTools } from '@agentic/ai-sdk' import { AgenticToolClient } from '@agentic/platform-tool-client' import { createOpenAI } from '@ai-sdk/openai' import { generateText } from 'ai' async function main() { const searchTool = await AgenticToolClient.fromIdentifier('@agentic/search') const openai = createOpenAI({ compatibility: 'strict' }) const result = await generateText({ model: openai('gpt-4o-mini'), tools: createAISDKTools(searchTool), toolChoice: 'required', temperature: 0, system: 'You are a helpful assistant. Be as concise as possible.', prompt: 'What is the weather in San Francisco?' }) console.log(JSON.stringify(result.toolResults[0], null, 2)) } await main() ``` -------------------------------- ### Create and Run a Weather Agent (TypeScript) Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/docs/marketplace/ts-sdks/mastra.mdx Example of creating a Mastra agent that uses the @agentic/search tool and the OpenAI provider to answer weather-related questions. Ensure you have 'dotenv/config' imported and OPENAI_API_KEY set in your .env file. ```typescript import 'dotenv/config' import { createMastraTools } from '@agentic/mastra' import { AgenticToolClient } from '@agentic/platform-tool-client' import { openai } from '@ai-sdk/openai' import { Agent } from '@mastra/core/agent' async function main() { const searchTool = await AgenticToolClient.fromIdentifier('@agentic/search') const weatherAgent = new Agent({ name: 'Weather Agent', instructions: 'You are a helpful assistant. Be as concise as possible.', model: openai('gpt-4o-mini'), tools: createMastraTools(searchTool) }) const res = await weatherAgent.generate( 'What is the weather in San Francisco?' ) console.log(res.text) } await main() ``` -------------------------------- ### Example Agentic Deployment Output Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/docs/publishing/guides/existing-mcp-server.mdx This JSON object represents the output of a successful deployment. It includes details about the deployment's ID, creation timestamp, identifier, published status, associated tools, pricing plans, and gateway URLs. ```json { "id": "depl_kf4c3o8efh2y84dp5iwsha95", "createdAt": "2025-06-28 05:38:34.960754+00", "updatedAt": "2025-06-28 05:38:34.960754+00", "identifier": "@dev/search@42ad78bf", "hash": "42ad78bf", "published": false, "description": "Official Google Search tool. Useful for finding up-to-date news and information about any topic.", "readme": "", "userId": "user_bhlpuiioipxilpuq7xaoh1ae", "projectId": "proj_rxs9jorlwolc3seq8enqgrgc", "tools": [ { "name": "search", "description": "Uses Google Search to return the most relevant web pages for a given query. Useful for finding up-to-date news and information about any topic.", "inputSchema": { "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "properties": { "num": { "type": "integer", "default": 5, "description": "Number of results to return" }, "type": { "enum": [ "search", "images", "videos", "places", "news", "shopping" ], "type": "string", "default": "search", "description": "Type of Google search to perform" }, "query": { "type": "string", "description": "Search query" } }, "required": ["query"], "additionalProperties": false }, "outputSchema": { "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "properties": { "news": {}, "images": {}, "places": {}, "videos": {}, "results": {}, "shopping": {}, "answerBox": {}, "knowledgeGraph": {} }, "additionalProperties": false } } ], "toolConfigs": [ { "name": "search", "cacheControl": "public, max-age=60, s-maxage=60 stale-while-revalidate=10" } ], "pricingPlans": [ { "name": "Free", "slug": "free", "rateLimit": { "interval": 86400, "limit": 10, "mode": "approximate", "enabled": true }, "lineItems": [ { "slug": "requests", "usageType": "metered", "billingScheme": "per_unit", "unitAmount": 0 } ] }, { "name": "Standard", "slug": "standard", "interval": "month", "rateLimit": { "interval": 1, "limit": 100, "mode": "approximate", "enabled": true }, "lineItems": [ { "slug": "base", "usageType": "licensed", "amount": 1000 }, { "slug": "requests", "usageType": "metered", "billingScheme": "tiered", "tiersMode": "volume", "tiers": [ { "unitAmount": 0, "upTo": 1000 }, { "unitAmount": 0.01, "upTo": 50000 }, { "unitAmount": 0.008, "upTo": 500000 }, { "unitAmount": 0.006, "upTo": 2500000 }, { "unitAmount": 0.005, "upTo": "inf" } ] } ] } ], "pricingIntervals": ["month"], "defaultRateLimit": { "interval": 60, "limit": 1000, "mode": "approximate", "enabled": true }, "gatewayBaseUrl": "https://gateway.agentic.so/@dev/search@42ad78bf", "gatewayMcpUrl": "https://gateway.agentic.so/@dev/search@42ad78bf/mcp", "marketplaceUrl": "https://agentic.so/marketplace/projects/@dev/search", "adminUrl": "https://agentic.so/app/projects/@dev/search/deployments/42ad78bf" } ``` -------------------------------- ### Create a FastMCP server Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/docs/publishing/guides/ts-fastmcp.mdx Initialize a FastMCP server instance and define a tool with Zod validation. The server must be started with the httpStream transport type. ```typescript import { FastMCP } from 'fastmcp' import { z } from 'zod' // Or any validation library that supports Standard Schema const server = new FastMCP({ name: 'Example', version: '0.0.1' }) server.addTool({ name: 'add', description: 'Add two numbers', parameters: z.object({ a: z.number(), b: z.number() }), execute: async (args) => { return String(args.a + args.b) } }) server.start({ transportType: 'httpStream', httpStream: { port: 8080 } }) ``` -------------------------------- ### Implement ModelFetch MCP Server in TypeScript Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/docs/publishing/guides/ts-modelfetch.mdx Implement your MCP server by defining tools, resources, and prompts. This example registers an 'add' tool that sums two numbers. ```typescript import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js' import { z } from 'zod' const server = new McpServer({ title: 'My MCP Server', name: 'my-mcp-server', version: '1.0.0' }) server.registerTool( 'add', { title: 'Add Numbers', description: 'Add two numbers together', inputSchema: { a: z.number(), b: z.number() } }, ({ a, b }) => ({ content: [ { type: 'text', text: `${a} + ${b} = ${a + b}` } ] }) ) export default server ``` -------------------------------- ### Build All Packages and Apps Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/CLAUDE.md This command builds all packages and applications, excluding the website, for deployment or testing. ```bash pnpm build ``` -------------------------------- ### Navigate to Project Directory Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/docs/publishing/guides/ts-modelfetch.mdx After creating the ModelFetch project, navigate to the project directory using this command. ```bash cd my-mcp-server ``` -------------------------------- ### Install @agentic/platform-validators Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/packages/validators/readme.md Install the package using npm. This package is typically used internally by other Agentic packages. ```bash npm i @agentic/platform-validators ``` -------------------------------- ### View CLI Usage and Commands Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/packages/cli/readme.md Displays the help menu and available commands for the Agentic CLI. ```sh Usage: agentic [options] [command] Options: -j, --json Print output as JSON -V, --version output the version number -h, --help display help for command Commands: login|signin [options] Signs in to Agentic. If no credentials are provided, uses GitHub auth. signup [options] Creates a new account for Agentic. If no credentials are provided, uses GitHub auth. whoami Displays info about the current user. logout|signout Signs the current user out. deploy [options] Creates a new deployment. publish [options] [deploymentIdentifier] Publishes a deployment. Defaults to the most recent deployment for the project in the target directory. If a deployment identifier is provided, it will be used instead. get Gets details for a specific deployment. list|ls [options] [identifier] Lists deployments. debug [options] Prints config for a local project. help [command] display help for command ``` -------------------------------- ### Install Agentic Genkit dependencies Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/docs/marketplace/ts-sdks/genkit.mdx Install the required packages to use Agentic tools with Firebase Genkit. ```npm npm install genkit @agentic/genkit @agentic/platform-tool-client ``` ```pnpm pnpm add genkit @agentic/genkit @agentic/platform-tool-client ``` ```bun bun add genkit @agentic/genkit @agentic/platform-tool-client ``` ```yarn yarn add genkit @agentic/genkit @agentic/platform-tool-client ``` -------------------------------- ### Create a FastMCP server Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/docs/publishing/guides/py-fastmcp.mdx Create a FastMCP server instance and define a tool function. Run the server using the Streamable HTTP transport. ```python from fastmcp import FastMCP mcp = FastMCP("Demo 🚀") @mcp.tool def add(a: int, b: int) -> int: """Add two numbers""" return a + b if __name__ == "__main__": mcp.run(transport="http", host="127.0.0.1", port=8000, path="/mcp") ``` -------------------------------- ### Log in or sign up with email and password Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/docs/publishing/guides/existing-mcp-server.mdx Log in to an existing Agentic account or create a new one using email and password credentials. ```bash agentic login -e -p ``` ```bash agentic signup -e -p -u ``` -------------------------------- ### Install @agentic/platform Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/packages/platform/readme.md Install the @agentic/platform package using npm. This command is used to add the package to your project's dependencies. ```bash npm i @agentic/platform ``` -------------------------------- ### Create ModelFetch MCP Server Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/docs/publishing/guides/ts-modelfetch.mdx Use this command to create a new ModelFetch MCP server project. Follow the interactive prompts to choose a runtime, language, and package manager. ```bash npx -y create-modelfetch@latest ``` -------------------------------- ### Basic OpenAPI Origin Configuration (TypeScript) Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/docs/publishing/config/examples.mdx Configure the Agentic MCP gateway with an origin OpenAPI server. Requires `@agentic/platform` and a local OpenAPI specification file. ```typescript import { defineConfig } from '@agentic/platform' export default defineConfig({ name: 'Basic OpenAPI Example', description: "This example shows how to configure Agentic's MCP gateway with an origin OpenAPI server.", origin: { type: 'openapi', url: 'https://jsonplaceholder.typicode.com', spec: './jsonplaceholder.json' } }) ``` -------------------------------- ### Install Agentic CLI Globally Source: https://context7.com/transitive-bullshit/chatgpt-api/llms.txt Install the Agentic CLI globally using npm. This command is used for managing Agentic projects and deployments. ```bash npm install -g @agentic/cli ``` -------------------------------- ### Deploy Project with Agentic CLI Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/docs/publishing/guides/existing-mcp-server.mdx Run this command from the directory containing your agentic configuration file to create a new immutable preview deployment. Subsequent changes can be deployed using the same command. ```bash agentic deploy ``` -------------------------------- ### GET /@username/tool-name/mcp Source: https://context7.com/transitive-bullshit/chatgpt-api/llms.txt Provides the MCP endpoint for configuring clients like Claude Desktop. ```APIDOC ## GET /@username/tool-name/mcp ### Description Returns the MCP configuration endpoint for a specific tool, used to integrate Agentic tools into MCP-compliant clients. ### Method GET ### Endpoint https://gateway.agentic.so/@username/tool-name/mcp ``` -------------------------------- ### Use Agentic tools with Genkit Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/docs/marketplace/ts-sdks/genkit.mdx Example implementation using the @agentic/search tool with Genkit and OpenAI. ```ts import 'dotenv/config' import { createGenkitTools } from '@agentic/genkit' import { AgenticToolClient } from '@agentic/platform-tool-client' import { genkit } from 'genkit' import { gpt4oMini, openAI } from 'genkitx-openai' async function main() { const searchTool = await AgenticToolClient.fromIdentifier('@agentic/search') const ai = genkit({ plugins: [openAI()] }) const result = await ai.generate({ model: gpt4oMini, tools: createGenkitTools(ai, searchTool), system: 'You are a helpful assistant. Be as concise as possible.', prompt: 'What is the weather in San Francisco?' }) console.log(result) } await main() ``` -------------------------------- ### Publish an Agentic deployment Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/docs/publishing/guides/existing-mcp-server.mdx Execute this command to make your deployment publicly available and enable Stripe subscriptions. ```bash agentic publish ``` -------------------------------- ### Disabled Rate Limit Configuration Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/docs/publishing/config/rate-limits.mdx An example of how to disable a rate limit by setting the 'enabled' property to false. ```ts { enabled: false } ``` -------------------------------- ### HTTP Endpoint Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/todo.md The HTTP endpoint allows for standard GET and POST requests to interact with chatbot tools. ```APIDOC ## HTTP Endpoint ### Description This endpoint allows for standard HTTP requests (GET, POST) to interact with chatbot tools. ### Method GET, POST ### Endpoint `https://gateway.agentic.so/@{username}/{project-slug}/{tool-name}` ``` -------------------------------- ### Get Details of a Specific Agentic Deployment Source: https://context7.com/transitive-bullshit/chatgpt-api/llms.txt Retrieve detailed information about a specific Agentic deployment using its username and project name. ```bash agentic get @username/project-name ``` -------------------------------- ### Deploy to Vercel Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/docs/publishing/guides/ts-xmcp.mdx Deploy the pre-built application to Vercel for production. This command assumes the project has already been built for Vercel. ```bash vercel deploy --prod --prebuilt ``` -------------------------------- ### Create a Hono MCP Node.js server Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/docs/publishing/guides/ts-mcp-hono.mdx Initialize a Hono application and register an MCP tool using the @hono/mcp middleware. ```typescript import { StreamableHTTPTransport } from '@hono/mcp' import { serve } from '@hono/node-server' import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js' import { Hono } from 'hono' import { logger } from 'hono/logger' import { z } from 'zod' const app = new Hono() app.use(logger()) const mcpServer = new McpServer({ name: 'Example', version: '0.0.1' }) mcpServer.registerTool( 'add', { description: 'Add two numbers', inputSchema: z.object({ a: z.number(), b: z.number() }) }, async (args) => { return { content: [ { type: 'text', content: String(args.a + args.b) } ] } } ) app.all('/mcp', async (c) => { const transport = new StreamableHTTPTransport() await mcpServer.connect(transport) return transport.handleRequest(c) }) serve({ fetch: app.fetch, port: 8787 }) ``` -------------------------------- ### Incorrect ESM Import Example (with .ts extension) Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/CLAUDE.md Illustrates an incorrect ESM import that includes the `.ts` file extension. Omit extensions for module imports. ```javascript import { Foo } from './foo.ts' ``` -------------------------------- ### Build xmcp App for Vercel Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/docs/publishing/guides/ts-xmcp.mdx Build the MCP server specifically for deployment on Vercel. This command prepares the project for Vercel's hosting environment. ```bash xmcp build --vercel ``` -------------------------------- ### List Agentic Deployments as JSON Source: https://context7.com/transitive-bullshit/chatgpt-api/llms.txt List all Agentic deployments and output the result in JSON format, suitable for scripting. ```bash agentic list --json ``` -------------------------------- ### Incorrect ESM Import with Types Example (with .js extension) Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/CLAUDE.md Shows an incorrect ESM import for types that includes the `.js` extension. File extensions should be omitted. ```javascript import { type Route } from './types/root.js' ``` -------------------------------- ### Incorrect ESM Import Example (with .js extension) Source: https://github.com/transitive-bullshit/chatgpt-api/blob/main/CLAUDE.md Highlights an incorrect way to import modules using ESM by including the `.js` file extension. This should be avoided. ```javascript import { Foo } from './foo.js' ```