Skip to content
Docs
FR Create an account

Developer tools

Agent Toolkit

Tchin API functions for your own AI agent (WhatsApp, website, support): create a payment or a payout, read their status and your balance. Ready for OpenAI, the Vercel AI SDK and LangChain.

Using it

const { TchinAgentToolkit } = require('./tchin-agent-toolkit');
const tchin = new TchinAgentToolkit(process.env.TCHIN_PUBLIC_KEY, process.env.TCHIN_PRIVATE_KEY, {
  env: 'test',          // 'live' pour de vrai
  sansVersement: true,  // pas d'argent sortant (conseillé pour un agent public)
});

// OpenAI Chat Completions
const r = await openai.chat.completions.create({ model: 'gpt-5', messages, tools: tchin.getTools() });
for (const appel of r.choices[0].message.tool_calls || []) {
  const resultat = await tchin.executer(appel.function.name, appel.function.arguments);
  messages.push({ role: 'tool', tool_call_id: appel.id, content: JSON.stringify(resultat) });
}

// OpenAI Agents SDK
const { Agent, tool } = require('@openai/agents');
const agent = new Agent({ name: 'Caisse', instructions: 'Tu aides les clients à payer.', tools: tchin.getAgentTools(tool) });

// Vercel AI SDK
const { tool: outil, jsonSchema } = require('ai');
const tools = tchin.getVercelTools(outil, jsonSchema);

// LangChain
const { tool: lcTool } = require('@langchain/core/tools');
const lcTools = tchin.getLangChainTools(lcTool);

Tools

ToolWhat it does
tchin_creer_paiementa payment: returns token and payment_url; the customer pays themselves
tchin_etat_paiementpending, completed, failed, cancelled
tchin_creer_versementsend money to a customer, who chooses where to receive it (money out: removed with sansVersement)
tchin_versement, tchin_annuler_versementa payout’s status; cancel it
tchin_soldeyour balances by country and in crypto

Security

  • lectureSeule: the agent only reads. sansVersement: no money out. outils: an explicit list.
  • The toolkit refuses to start in a browser: your keys stay on the server.
  • Errors are returned to the model as messages, never your keys.