README

NAME

HuggingFace::API - Raku client for the HuggingFace API

SYNOPSIS

use HuggingFace::API;

my $hf = HuggingFace::API.new;

# Search for models
my @models = $hf.search('mistral', :limit(5));
for @models -> %m {
    say "%m<id> — %m<downloads> downloads";
}

# Download a tokenizer
my $json = $hf.get-tokenizer('mistralai/Mistral-7B-v0.1');

# Save tokenizer to file
$hf.get-tokenizer-to-file('mistralai/Mistral-7B-v0.1', 'tokenizer.json'.IO);

# With API key (for gated models)
my $hf-auth = HuggingFace::API.new(:api-key('hf_...'));
my $json = $hf-auth.get-tokenizer('meta-llama/Llama-3-8B');

DESCRIPTION

HuggingFace::API provides a Raku client for the HuggingFace API. Currently supports model search and tokenizer downloads.

Methods

my $hf = HuggingFace::API.new(
    :api-key('hf_...'),     # Optional, for gated models
);

# Search models by prefix
$hf.search(Str $query, Int :$limit = 10 --> List)
    # Returns list of hashes with: id, author, downloads, likes, pipeline, tags, description

# Download tokenizer JSON as string
$hf.get-tokenizer(Str $model-id, Str :$filename = 'tokenizer.json' --> Str)

# Download tokenizer JSON to file
$hf.get-tokenizer-to-file(Str $model-id, IO::Path $output, Str :$filename = 'tokenizer.json' --> IO::Path)

AUTHOR

Matt Doughty [email protected]

COPYRIGHT AND LICENSE

Copyright 2026 Matt Doughty

This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.

HuggingFace::API v0.2.1

Raku client for the HuggingFace API — model search and tokenizer downloads

Authors

  • Matt Doughty

License

Artistic-2.0

Dependencies

Cro::HTTP:ver<0.8.11>:auth<zef:cro>JSON::Fast:ver<0.19>:auth<cpan:TIMOTIMO>

Test Dependencies

Provides

  • HuggingFace::API

The Camelia image is copyright 2009 by Larry Wall. "Raku" is trademark of the Yet Another Society. All rights reserved.