Skip to main content

huggingface-hub-datacircle

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 InferenceClient of huggingface_hub four tools that call Datacircle's open API, https://api.datacircle.dev/v1. You pass the tools to client.chat_completion(). The package then runs each tool call from the model. You can run the tools on Inference Providers or on your own server. You need no key and no account for Datacircle.

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

pip install huggingface-hub-datacircle

huggingface-hub-datacircle works with huggingface_hub 0.24.6 and later, on Python 3.9 and later.

Use the tools

Send the tools with client.chat_completion(). If the model calls a tool, call_all() gives you the tool messages to send back:

from huggingface_hub import InferenceClient
from huggingface_hub_datacircle import call_all, datacircle_tools

client = InferenceClient()
model = "Qwen/Qwen3-235B-A22B-Instruct-2507"
messages = [{"role": "user", "content": "Who are the 3 best providers for the email-finder API?"}]
response = client.chat_completion(messages, model=model, tools=datacircle_tools())

while response.choices[0].message.tool_calls:
    messages.append(response.choices[0].message)
    messages.extend(call_all(response.choices[0].message))
    response = client.chat_completion(messages, model=model, tools=datacircle_tools())

print(response.choices[0].message.content)

InferenceClient() reads your Hugging Face token from HF_TOKEN or from hf auth login. For your own server, use InferenceClient(base_url="http://localhost:8080/v1"). client.chat.completions.create() takes the same arguments as client.chat_completion().

Each tool message has role: "tool" and the call's id in tool_call_id. The tool's name sits in name. The answer sits in content as JSON text.

Stream

With stream=True, some chunks hold pieces of tool calls. Pass each chunk's delta.tool_calls to collect_tool_calls(). collect_tool_calls() puts the pieces of each call together in one list. Then run the list with call_all():

from huggingface_hub import InferenceClient
from huggingface_hub_datacircle import call_all, collect_tool_calls, datacircle_tools

client = InferenceClient()
model = "Qwen/Qwen3-235B-A22B-Instruct-2507"
messages = [{"role": "user", "content": "Which APIs does the provider Bright Data sell?"}]

for turn in range(5):
    content, calls = "", []
    for chunk in client.chat_completion(messages, model=model, tools=datacircle_tools(), stream=True):
        delta = chunk.choices[0].delta
        content += delta.content or ""
        collect_tool_calls(calls, delta.tool_calls)
    if not calls:
        print(content)
        break
    messages.append({"role": "assistant", "content": content, "tool_calls": calls})
    messages.extend(call_all(calls))

With AsyncInferenceClient, use await acall_all(...). acall_all() runs the calls at the same time. Your event loop keeps running.

Use the Datacircle tools beside your own tools

You can put the Datacircle tools in the same list as yours: tools=[*datacircle_tools(), my_tool]. call() runs one tool call. For your own tools, call() returns None. Your code then runs the tool itself:

import json

from huggingface_hub_datacircle import call

for tool_call in response.choices[0].message.tool_calls or []:
    message = call(tool_call)
    if message is None:
        arguments = tool_call.function.arguments
        if isinstance(arguments, str):
            arguments = json.loads(arguments)
        output = my_tools[tool_call.function.name](**arguments)
        message = {"role": "tool", "tool_call_id": tool_call.id, "name": tool_call.function.name, "content": str(output)}
    messages.append(message)

To give the model only some of the tools, list their names: datacircle_tools(["datacircle_best_plans"]).

Call a tool yourself

You can call each tool without a model. You get the JSON text of the tool's answer:

import json

from huggingface_hub_datacircle import run

print(json.loads(run("datacircle_best_plans", {"slug": "email-finder", "limit": 3}))["plans"])
print(run("datacircle_provider", {"slug": "Bright Data"}))

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.

You can give a provider's name in place of a slug. The tool turns Bright Data into bright-data.

For an unknown slug, the tool returns {"error": "..."} with the API's message. The error for an unknown API slug lists every valid slug. The tool checks each number from the model before any API call. For a number out of range, the tool returns {"error": "..."} and makes no API call. If the network fails, the tool returns {"error": "..."} with the network error's message. The tool never raises an error. The model can then call the tool again.

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 API can ask the tool to wait. The tool then waits once, for a minute at most. Each call uses only Python's standard library. Nothing goes to disk.

MIT license.

Metadata

Release files for huggingface-hub-datacircle 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for huggingface-hub-datacircle 0.1.0
File Size Uploaded Provenance Actions
huggingface_hub_datacircle-0.1.0.tar.gz 16.0 kB Without provenance Details for huggingface_hub_datacircle-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for huggingface-hub-datacircle 0.1.0
File Interpreter ABI Platform Actions
huggingface_hub_datacircle-0.1.0-py3-none-any.whl Python 3 none any Details for huggingface_hub_datacircle-0.1.0-py3-none-any.whl

Total release size: 28.2 kB

Release files / huggingface_hub_datacircle-0.1.0.tar.gz

Download URL huggingface_hub_datacircle-0.1.0.tar.gz
Size 16.0 kB
Tags Source
SHA-256 checksum
How to use checksums
9fc4571733d0d1c2c30123f721268974e4651edfc0645ba5d5d9ac7b669c39d5
BLAKE2b-256 checksum
How to use checksums
843f2cc371c60d5123169342f43ae02e8c928b43b7402356b621e0fd23ac0412
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.17 {"installer":{"name":"uv","version":"0.12.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / huggingface_hub_datacircle-0.1.0-py3-none-any.whl

Download URL huggingface_hub_datacircle-0.1.0-py3-none-any.whl
Size 12.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5dc9c3dc33dff699211a52d0da2b77d847b1e60f72f93342df0231d23e14ffe0
BLAKE2b-256 checksum
How to use checksums
528295c441af88754ac13446c7c43248fea1bd6f0a27a8794e2eb4ce4b731d73
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.17 {"installer":{"name":"uv","version":"0.12.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for huggingface-hub-datacircle 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page