gpt4free

implementation of python library called as same as this one which provides free providers for AI

Pure Nim score 15/100 · tests present · no docs generated

Summary

Latest Version Unknown
License MIT
CI Status Failing
Downloads 0
Last Indexed 2026-07-21 05:23

Installation

nimble install gpt4free
choosenim install gpt4free
git clone https://github.com/Monsler/gpt4free

OS Compatibility

Platform Linux macOS Windows FreeBSD OpenBSD NetBSD Android iOS WASM Embedded
gpt4free - - - - - - -

Source

Repository https://github.com/Monsler/gpt4free
Homepage https://github.com/Monsler/gpt4free
Registry Source nimble_official

README

gpt4free Nim

This is an implementation of python library called as same as this one. Provides free access to popular LLMs (And more soon!)

Install:

nimble add gpt4free

Example:

import gpt4free

when isMainModule:
    let bot = newChatCompletion("openrouter/free", Provider.OpenRouter, @[
                newMessage("system", "you are a helpful ai chat bot."),
                newMessage("user", "hello, can you tell me a funny story?")
            ], true)

    let response = waitFor bot.createCompletion()

    if response.isSome():
        let t = response.get()

        try:
            echo "Model answer: \n\n", t.content, "\n\nReasoning:\n\n", t.reasoning
        except:
            echo "Failed: ", $t.raw
        else:
            echo "response is nil"

    quit(0)