{"id":13568647,"url":"https://github.com/wkok/openai-clojure","last_synced_at":"2025-05-15T03:04:57.204Z","repository":{"id":65850162,"uuid":"595346921","full_name":"wkok/openai-clojure","owner":"wkok","description":"Clojure functions to drive the OpenAI API","archived":false,"fork":false,"pushed_at":"2024-11-05T19:03:33.000Z","size":487,"stargazers_count":225,"open_issues_count":5,"forks_count":32,"subscribers_count":11,"default_branch":"main","last_synced_at":"2025-05-15T03:04:23.471Z","etag":null,"topics":["chatgpt","clojure","gpt-3","openai"],"latest_commit_sha":null,"homepage":"https://cljdoc.org/d/net.clojars.wkok/openai-clojure","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wkok.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"wkok"}},"created_at":"2023-01-30T22:25:08.000Z","updated_at":"2025-05-11T03:22:20.000Z","dependencies_parsed_at":"2023-09-06T15:46:04.177Z","dependency_job_id":"4c4a035f-7293-48cb-934e-c008a1da7bce","html_url":"https://github.com/wkok/openai-clojure","commit_stats":{"total_commits":34,"total_committers":2,"mean_commits":17.0,"dds":0.05882352941176472,"last_synced_commit":"d6f7addede11f0a3706bba0146fefd9f14f1cdf7"},"previous_names":[],"tags_count":37,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wkok%2Fopenai-clojure","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wkok%2Fopenai-clojure/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wkok%2Fopenai-clojure/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wkok%2Fopenai-clojure/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wkok","download_url":"https://codeload.github.com/wkok/openai-clojure/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254264765,"owners_count":22041793,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chatgpt","clojure","gpt-3","openai"],"created_at":"2024-08-01T14:00:29.796Z","updated_at":"2025-05-15T03:04:57.141Z","avatar_url":"https://github.com/wkok.png","language":"Clojure","funding_links":["https://github.com/sponsors/wkok"],"categories":["Clojure"],"sub_categories":[],"readme":"# openai-clojure (Unofficial)\n\n[![Clojars Project](https://img.shields.io/clojars/v/net.clojars.wkok/openai-clojure.svg)](https://clojars.org/net.clojars.wkok/openai-clojure)\n![CI](https://github.com/wkok/openai-clojure/workflows/CI/badge.svg)\n\nClojure functions to drive the [OpenAI API](https://platform.openai.com/docs/introduction)\nand [Azure OpenAI API](https://learn.microsoft.com/en-us/azure/cognitive-services/openai/reference)\n\nThis unofficial library aims to hide the small differences between the 2 APIs, and allows therefore to develop\ntools and applications which can work with both variants.\n\n## Documentation\n\n[![cljdoc badge](https://cljdoc.org/badge/net.clojars.wkok/openai-clojure)](https://cljdoc.org/d/net.clojars.wkok/openai-clojure)\n\n* [Usage - OpenAI](/doc/01-usage-openai.md)\n* [Usage - Azure OpenAI](/doc/02-usage-azure.md)\n* [Streaming Tokens](/doc/03-streaming.md)\n* [API Reference](https://cljdoc.org/d/net.clojars.wkok/openai-clojure/0.22.0/api/wkok.openai-clojure.api)\n\n## Supported APIs\n\n|             | OpenAI | Azure OpenAI |\n| ----------- | :----: | :----------: |\n| Version     | v2.3.0 | v2024-06-01  |\n| [Chat](https://platform.openai.com/docs/api-reference/chat) | X | X |\n| [Audio](https://platform.openai.com/docs/api-reference/audio) | X | X |\n| [Completion](https://platform.openai.com/docs/api-reference/completions) | X | X |\n| [Embeddings](https://platform.openai.com/docs/api-reference/embeddings) | X | X |\n| [Models](https://platform.openai.com/docs/api-reference/models) | X | |\n| [Images](https://platform.openai.com/docs/api-reference/images) | X | X |\n| [Files](https://platform.openai.com/docs/api-reference/files) | X | |\n| [Fine-tuning](https://platform.openai.com/docs/api-reference/fine-tuning) | X | |\n| [Moderations](https://platform.openai.com/docs/api-reference/moderations) | X | |\n| [Assistants](https://platform.openai.com/docs/api-reference/assistants) | (beta) | |\n| [Threads](https://platform.openai.com/docs/api-reference/threads) | (beta) | |\n| [Messages](https://platform.openai.com/docs/api-reference/messages) | (beta) | |\n| [Runs](https://platform.openai.com/docs/api-reference/runs) | (beta) | |\n| [Vector Stores](https://platform.openai.com/docs/api-reference/vector-stores) | (beta) | |\n\n## Configuration\n\n[![Clojars Project](https://img.shields.io/clojars/v/net.clojars.wkok/openai-clojure.svg)](https://clojars.org/net.clojars.wkok/openai-clojure)\n\nAdd the `openai-clojure` dependency\n\n### deps.edn\n\n```\nnet.clojars.wkok/openai-clojure {:mvn/version \"0.22.0\"}\n```\n\n### Leiningen project.clj\n\n```\n[net.clojars.wkok/openai-clojure \"0.22.0\"]\n```\n\n## Java\n\nMinimum Java 11 required\n\n## Authentication\n\n### OpenAI\n\n#### API Key\n\nSet the environment variable `OPENAI_API_KEY` to your OpenAI API key.\n\n(For alternative options to pass the API Key see [options](/doc/01-usage-openai.md#options))\n\nAn API key can be generated in your [OpenAI account](https://platform.openai.com/account/api-keys)\n\n#### Organization\n\n*Optional* - If your OpenAI account uses multiple organizations, set the environment variable `OPENAI_ORGANIZATION` to the one used for your app.\n\n### Azure OpenAI\n\nSee: [Authentication - Azure OpenAI](/doc/02-usage-azure.md#authentication)\n\n## Quickstart\n\nSee the full [API Reference](https://cljdoc.org/d/net.clojars.wkok/openai-clojure/0.22.0/api/wkok.openai-clojure.api) for examples of all the supported OpenAI APIs.\n\nRequire the `api` namespace\n\n```\n(:require [wkok.openai-clojure.api :as api])\n```\n\nA simple chat conversation with OpenAI's ChatGPT could be:\n\n```clojure\n(api/create-chat-completion {:model \"gpt-3.5-turbo\"\n                             :messages [{:role \"system\" :content \"You are a helpful assistant.\"}\n                                        {:role \"user\" :content \"Who won the world series in 2020?\"}\n                                        {:role \"assistant\" :content \"The Los Angeles Dodgers won the World Series in 2020.\"}\n                                        {:role \"user\" :content \"Where was it played?\"}]})\n```\n\nResult:\n```clojure\n{:id \"chatcmpl-6srOKLabYTpTRwRUQxjkcBxw3uf1H\",\n :object \"chat.completion\",\n :created 1678532968,\n :model \"gpt-3.5-turbo-0301\",\n :usage {:prompt_tokens 56, :completion_tokens 19, :total_tokens 75},\n :choices\n [{:message\n   {:role \"assistant\",\n    :content\n    \"The 2020 World Series was played at Globe Life Field in Arlington, Texas.\"},\n   :finish_reason \"stop\",\n   :index 0}]}\n```\n\n## Issues and features\n\nPlease feel free to raise issues on Github or send pull requests\n\n## Acknowledgements\n\nThis library uses [Martian](https://github.com/oliyh/martian) - An HTTP abstraction library\n\n## License\n\n**This is an unofficial library, it is not affiliated with nor endorsed by OpenAI**\n\n[MIT License](https://github.com/wkok/openai-clojure/blob/master/LICENSE)\n\nCopyright (c) 2023 Werner Kok\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwkok%2Fopenai-clojure","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwkok%2Fopenai-clojure","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwkok%2Fopenai-clojure/lists"}