TypeScript SDK for the Agent Command Center, Future AGI's open-source, OpenAI-compatible AI gateway. Fully typed, ESM and CJS, Node 18+. Plus a family of framework integrations: LangChain, LlamaIndex, React, and the Vercel AI SDK.
npm install @agentcc/client
# or
pnpm add @agentcc/client
# or
yarn add @agentcc/clientimport { AgentCC } from "@agentcc/client";
const client = new AgentCC({
apiKey: process.env.AGENTCC_API_KEY,
baseUrl: "https://gateway.futureagi.com/v1",
});
const response = await client.chat.completions.create({
model: "gpt-4o",
messages: [{ role: "user", content: "Summarize the theory of relativity." }],
});
console.log(response.choices[0].message.content);The client reads AGENTCC_API_KEY and AGENTCC_BASE_URL from the environment when those options are not passed explicitly.
const stream = await client.chat.completions.create({
model: "gpt-4o",
messages: [{ role: "user", content: "Write a haiku about programming." }],
stream: true,
});
for await (const chunk of stream) {
const delta = chunk.choices[0]?.delta?.content;
if (delta) process.stdout.write(delta);
}const response = await client.chat.completions.create({
model: "gpt-4o",
messages: [{ role: "user", content: "What's the weather in Paris?" }],
tools: [
{
type: "function",
function: {
name: "get_weather",
description: "Get the current weather for a location.",
parameters: {
type: "object",
properties: {
location: { type: "string" },
unit: { type: "string", enum: ["celsius", "fahrenheit"] },
},
required: ["location"],
},
},
},
],
});
const toolCalls = response.choices[0].message.tool_calls;
if (toolCalls) {
for (const tc of toolCalls) {
const args = JSON.parse(tc.function.arguments);
// call your function, then send the result back as a tool message
}
}ClientOptions accepts a config object for gateway-level routing, caching, and guardrails:
import { AgentCC } from "@agentcc/client";
import type { GatewayConfig } from "@agentcc/client";
const config: GatewayConfig = {
strategy: "fallback",
targets: [
{ provider: "openai", model: "gpt-4o" },
{ provider: "anthropic", model: "claude-sonnet-4-20250514" },
],
};
const client = new AgentCC({
apiKey: process.env.AGENTCC_API_KEY,
baseUrl: "https://gateway.futureagi.com/v1",
config,
});| Resource | Access path |
|---|---|
| Chat completions | client.chat.completions |
| Legacy completions | client.completions |
| Embeddings | client.embeddings |
| Images | client.images |
| Audio | client.audio |
| Models | client.models |
| Moderations | client.moderations |
| Files | client.files |
| Batches | client.batches |
| Rerank | client.rerank |
| Package | Description |
|---|---|
@agentcc/langchain |
Drop-in ChatOpenAI replacement for LangChain.js chains |
@agentcc/llamaindex |
LLM and embedding classes for LlamaIndex.TS pipelines |
@agentcc/react |
React context, useAgentCCChat, and related hooks for chat UIs |
@agentcc/vercel |
Vercel AI SDK provider for generateText / streamText |
| Variable | Description |
|---|---|
AGENTCC_API_KEY |
API key (sk-agentcc-*) |
AGENTCC_BASE_URL |
Gateway base URL (e.g. https://gateway.futureagi.com/v1) |
Apache 2.0 — see LICENSE.