Skip to content

About

OpenAI Node SDK tools on Datacircle's open API, for runTools and ResponsesToolRunner: find the best GTM APIs, no key

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

Datacircle tools for the OpenAI Node SDK

Find the best GTM APIs. We benchmark all the GTM APIs and we put the results on our website.

Our website: https://datacircle.dev

This package gives the OpenAI Node SDK four function tools that call Datacircle's open API, https://api.datacircle.dev/v1. They run in the SDK's own tool runners: client.chat.completions.runTools() and ResponsesToolRunner. You need no key and no account.

Tool What the tool gives Call
datacircle_list_apis Every GTM API on Datacircle, with the API's slug, number of plans, number of providers and best plan GET /apis
datacircle_best_plans One API's plans, sorted by score out of 100, best first. Each plan comes with a rank and a price per 1,000 calls GET /apis/{slug}/best
datacircle_search_plans Plans that match a provider or plan name, on all APIs or on one API. You can sort them by score, provider or price GET /plans
datacircle_provider The APIs a provider sells, and the provider's rank on each API GET /providers/{slug}

Install

npm install @datacircle/openai openai

runTools() works with openai 5.0.0 and later. ResponsesToolRunner came in openai 7.33.0. The package works from ESM and from CommonJS.

Use the tools with Chat Completions

Give the tools to runTools():

import OpenAI from 'openai';
import { datacircleTools } from '@datacircle/openai';

const client = new OpenAI();

const runner = client.chat.completions.runTools({
  model: 'gpt-5.5',
  messages: [{ role: 'user', content: 'Who are the 3 best providers for the email-finder API?' }],
  tools: datacircleTools(),
});

console.log(await runner.finalContent());

stream: true works the same way. The tools can sit beside your own tools in the same list, made with zodFunction() or as plain function tools: tools: [...datacircleTools(), myTool].

Use the tools with the Responses API

Give the same tools to ResponsesToolRunner as functions:

import OpenAI from 'openai';
import { ResponsesToolRunner } from 'openai/helpers/responses-tool-runner';
import { datacircleFunctions } from '@datacircle/openai';

const client = new OpenAI();
const runner = new ResponsesToolRunner({ functions: datacircleFunctions() });

const response = await runner.run(client, {
  model: 'gpt-5.5',
  input: [{ role: 'user', content: 'Which APIs does Bright Data sell, and where does it rank?' }],
});

console.log(response.output_text);

{ stream: true, onEvent } as the third argument of run() works too. For a loop of your own on client.responses.create(), send datacircleFunctions().map((f) => f.tool) as tools. For each function_call, give await f.execute(JSON.parse(call.arguments)) back as its function_call_output, f being the function of that name.

Each tool has a strict schema. The model sends every argument, and null for an argument it leaves out. To give the model only some of the tools, filter them by name: datacircleTools().filter((t) => t.function.name !== 'datacircle_provider'), or datacircleFunctions().filter((f) => f.tool.name !== 'datacircle_provider').

Make each call yourself

You can also make each call without a model. You get the answer the model would read, as an object:

import { bestPlans } from '@datacircle/openai';

const answer = await bestPlans({ slug: 'email-finder', limit: 3 });
console.log(answer.plans);

The other calls are listApis(), searchPlans() and providerRanks().

What the model reads

Each tool gives the model a JSON object as text. Each plan comes with a rank, provider, plan, score, price per 1,000 (perThousand, in dollars) and a page on datacircle.dev. That page lists every field.

When the API gives no data, for example for an unknown slug, the tool returns {"error": "..."} with the API's message. When the input does not fit the schema, the tool returns {"error": "..."} that names each wrong argument. If the network fails, the model gets the error's message the same way. The model can then call again, and the run goes on. When you stop the run, the call stops too.

datacircleTools({ fetch }) and datacircleFunctions({ fetch }) set the fetch the tools use, for example to add a proxy or a timeout. Each call without a model takes the same options as its second argument.

Network

Each tool call makes one HTTPS GET request to https://api.datacircle.dev/v1 and nothing else. The request holds only the tool's own arguments: no key and nothing from your chats. The API takes up to 60 calls a minute from one IP address. The tool waits once, for a minute at most, when the API asks the tool to wait. The package depends only on zod, and stores nothing.

Links

MIT license.

About

OpenAI Node SDK tools on Datacircle's open API, for runTools and ResponsesToolRunner: find the best GTM APIs, no key

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages