Package Installation
npm install @graphysdk/ai
Peer Dependencies
The AI SDK requires @graphysdk/core for the GraphConfig type:
npm install @graphysdk/core
Import
import { GraphyAiSdk } from '@graphysdk/ai';
import type { GraphConfig } from '@graphysdk/core';
TypeScript Configuration
The SDK is written in TypeScript and ships with type definitions. No additional @types packages are needed.
Minimum TypeScript version: 4.7+
Recommended tsconfig.json settings:
{
"compilerOptions": {
"moduleResolution": "bundler",
"esModuleInterop": true,
"strict": true
}
}
Environment Setup
Store your API key in an environment variable:
# .env
GRAPHY_API_KEY=your-api-key
Access it in your code:
const ai = new GraphyAiSdk({
apiKey: process.env.GRAPHY_API_KEY,
baseUrl: 'https://agents.graphy.dev',
});
Never commit API keys to version control. Use environment variables or a secrets manager.
Verify Installation
import { GraphyAiSdk } from '@graphysdk/ai';
const ai = new GraphyAiSdk({
apiKey: process.env.GRAPHY_API_KEY,
baseUrl: 'https://agents.graphy.dev',
});
// Check connectivity
const health = await ai.ping();
console.log(health); // { ok: true, latency: 45 }