{"id":20664260,"url":"https://github.com/casualcodersprojects/gopenai","last_synced_at":"2026-04-22T19:34:08.334Z","repository":{"id":64887452,"uuid":"577980817","full_name":"CasualCodersProjects/gopenai","owner":"CasualCodersProjects","description":"Go wrapper for OpenAI GPT-3 Completion, Editing, and DALLE Image API","archived":false,"fork":false,"pushed_at":"2023-03-16T20:45:50.000Z","size":426,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-01-17T12:36:45.023Z","etag":null,"topics":["dall-e","go","golang","gpt-3","openai","openai-api"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/CasualCodersProjects/gopenai","language":"Go","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/CasualCodersProjects.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"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}},"created_at":"2022-12-14T01:06:48.000Z","updated_at":"2024-12-15T04:48:48.000Z","dependencies_parsed_at":"2024-06-20T17:17:44.682Z","dependency_job_id":"35af7e25-573d-478c-b952-c0acbf864886","html_url":"https://github.com/CasualCodersProjects/gopenai","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CasualCodersProjects%2Fgopenai","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CasualCodersProjects%2Fgopenai/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CasualCodersProjects%2Fgopenai/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CasualCodersProjects%2Fgopenai/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CasualCodersProjects","download_url":"https://codeload.github.com/CasualCodersProjects/gopenai/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242826881,"owners_count":20191719,"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":["dall-e","go","golang","gpt-3","openai","openai-api"],"created_at":"2024-11-16T19:23:15.143Z","updated_at":"2026-04-22T19:34:08.243Z","avatar_url":"https://github.com/CasualCodersProjects.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OpenAI Binding for Go\n\nThis is a super simple wrapper for OpenAI's GPT Completion, GPT Edits, and DALL-E Image generation APIs.\n\n# Getting Started\n\n## Installing\n\n```\ngo get -u github.com/CasualCodersProjects/gopenai\n```\n\n## Usage\n\nInitializing the OpenAI object.\n\n```go\nopenAI := gopenai.NewOpenAI(\u0026gopenai.OpenAIOpts{})\n```\n\nPassing in an API Key.\n\n```go\nopenAI := gopenai.NewOpenAI(\u0026gopenai.OpenAIOpts{\n    APIKey: \"your-api-key-here\",\n})\n```\n\nCreating a Simple Completion.\n\n```go\n// if passed an empty string for the model and zero for the tokens, \n// will default to \"text-davinci-003\" and 256\nresults, err := openAI.CreateCompletionSimple(\"Write me a story about a woman named Alice\", \"\", 0)\nif err != nil {\n    panic(err)\n}\n```\n\nCreating a completion with more options.\n\n```go\nrequest := types.NewDefaultCompletionRequest(\"Your prompt here\\n\")\nrequest.MaxTokens = 1024\nrequest.Stop = []string{\"\\n\"}\nrequest.N = 3\n\nresults, err := openAI.CreateCompletion(request)\nif err != nil {\n    panic(err)\n}\n```\n\nCreating an Edit.\n\n```go\nrequest := types.NewDefaultEditRequest(\"Misspell this senstence\", \"Correct the spelling mistakes.\")\n\nresults, err := openAI.CreateEdit(request)\nif err != nil {\n    panic(err)\n}\n```\n\nCreating an Image.\n\n```go\nrequest := types.NewDefaultImageRequest(\"A dog in a hat\")\n\nresults, err := openAI.CreateImage(request)\nif err != nil {\n    panic(err)\n}\n```\n\n# FAQ\n\n## Will you support other OpenAI APIs?\n\nNot unless we need them! This library is for another Go project of ours, we figured we'd open source it so that others can use it too! It fits our needs, so updates will only be made on an as-needed basis. However, anyone is welcome to submit a Pull Request and add anything else they would also find useful!\n\n## Are you affiliated with OpenAI?\n\nNo. This is a community project.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcasualcodersprojects%2Fgopenai","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcasualcodersprojects%2Fgopenai","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcasualcodersprojects%2Fgopenai/lists"}