Public api
Opened this issue · 12 comments
I was wondering if it was possible for thisworddoesnotexist.com to have an API that other developers can use so they don't have to set this project up themselves
It's definitely possible, but hosting costs can be pretty expensive for inference queries. @duncte123 can you tell me a bit more about your use case?
Of course I can, my use case would be a command on a discord bot that displays the words and mimics the formatting on the website.
This could be achieved by web-scraping but an api is just easier to work with.
@duncte123 sweet, that's very cachable. I cached 100,000 words for the website in this file: https://github.com/turtlesoupy/this-word-does-not-exist/blob/master/website/data/words.json.gz
The JSON format should be pretty obvious once unzipping. Maybe load it in and start from there?
That json is definitely workable, the only thing that I'm missing in the data are the permalinks for linking back to the site
@duncte123 try https://www.thisworddoesnotexist.com/api/random_word.json
I reserve the right to add a mandatory API key in the future!
@duncte123 try https://www.thisworddoesnotexist.com/api/random_word.json
I reserve the right to add a mandatory API key in the future!
Thank you so much, I'll make sure to sign up for the API key if it ever becomes required
nice API @turtlesoupy what about to include a query function that allows to ask for 8 characters lenght words? e.g
@desegura can you describe your use case as well? Generating from scratch is quite expensive unless it’s in a cache
imagine this call: "https://www.thisworddoesnotexist.com/?len=7"
returning: "zupital" e.g
I mean a way to stablish the length of the word
I know it will be expensive but very usefull
Would there be a way to send an API request to define a specific word, analogous to the website's "Write your own" feature?