[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-11348":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":16,"stars7d":17,"stars30d":18,"stars90d":16,"forks30d":16,"starsTrendScore":16,"compositeScore":19,"rankGlobal":10,"rankLanguage":10,"license":20,"archived":21,"fork":21,"defaultBranch":22,"hasWiki":21,"hasPages":21,"topics":23,"createdAt":10,"pushedAt":10,"updatedAt":24,"readmeContent":25,"aiSummary":26,"trendingCount":16,"starSnapshotCount":16,"syncStatus":27,"lastSyncTime":28,"discoverSource":29},11348,"openai-cli","openai\u002Fopenai-cli","openai","Official CLI for the OpenAI API","",null,"Go",627,30,8,3,0,5,89,59.87,"Apache License 2.0",false,"main",[],"2026-06-11 04:04:14","# OpenAI CLI\n\nThe official CLI for the [OpenAI REST API](https:\u002F\u002Fplatform.openai.com\u002Fdocs).\n\n\u003C!-- x-release-please-start-version -->\n\n## Installation\n\n### Installing with Homebrew\n\n```sh\nbrew install openai\u002Ftools\u002Fopenai\n```\n\n### Installing with Go\n\nTo test or install the CLI locally, you need [Go](https:\u002F\u002Fgo.dev\u002Fdoc\u002Finstall) version 1.25 or later installed.\n\n```sh\ngo install 'github.com\u002Fopenai\u002Fopenai-cli\u002Fcmd\u002Fopenai@latest'\n```\n\nOnce you have run `go install`, the binary is placed in your Go bin directory:\n\n- **Default location**: `$HOME\u002Fgo\u002Fbin` (or `$GOPATH\u002Fbin` if GOPATH is set)\n- **Check your path**: Run `go env GOPATH` to see the base directory\n\nIf commands aren't found after installation, add the Go bin directory to your PATH:\n\n```sh\n# Add to your shell profile (.zshrc, .bashrc, etc.)\nexport PATH=\"$PATH:$(go env GOPATH)\u002Fbin\"\n```\n\n\u003C!-- x-release-please-end -->\n\n### Running Locally\n\nAfter cloning the git repository for this project, you can use the\n`scripts\u002Frun` script to run the tool locally:\n\n```sh\n.\u002Fscripts\u002Frun args...\n```\n\n## Usage\n\nThe CLI follows a resource-based command structure:\n\n```sh\nopenai [resource] \u003Ccommand> [flags...]\n```\n\nStandard API endpoints require an [API key](https:\u002F\u002Fplatform.openai.com\u002Fsettings\u002Forganization\u002Fapi-keys):\n\n```sh\nexport OPENAI_API_KEY=\"sk-...\"\n\nopenai responses create \\\n  --input \"Say this is a test\" \\\n  --model gpt-5.5\n```\n\nAdmin endpoints require an [admin API key](https:\u002F\u002Fplatform.openai.com\u002Fsettings\u002Forganization\u002Fadmin-keys):\n\n```sh\nexport OPENAI_ADMIN_KEY=\"sk-admin-...\"\n\nopenai admin:organization:usage completions \\\n  --start-time 1735689600 \\\n  --end-time 1735776000 \\\n  --bucket-width 1d\n```\n\nFor details about specific commands, use the `--help` flag.\n\n### Environment variables\n\n| Environment variable    | Required | Default value |\n| ----------------------- | -------- | ------------- |\n| `OPENAI_API_KEY`        | no       | `null`        |\n| `OPENAI_ADMIN_KEY`      | no       | `null`        |\n| `OPENAI_ORG_ID`         | no       | `null`        |\n| `OPENAI_PROJECT_ID`     | no       | `null`        |\n| `OPENAI_WEBHOOK_SECRET` | no       | `null`        |\n\n### Global flags\n\n- `--api-key` (can also be set with `OPENAI_API_KEY` env var)\n- `--admin-api-key` (can also be set with `OPENAI_ADMIN_KEY` env var)\n- `--organization` (can also be set with `OPENAI_ORG_ID` env var)\n- `--project` (can also be set with `OPENAI_PROJECT_ID` env var)\n- `--webhook-secret` (can also be set with `OPENAI_WEBHOOK_SECRET` env var)\n- `--help` - Show command line usage\n- `--debug` - Enable debug logging. This includes HTTP request\u002Fresponse details and bodies; do not share debug logs if they may contain sensitive payloads.\n- `--version`, `-v` - Show the CLI version\n- `--base-url` - Use a custom API backend URL\n- `--format` - Change the output format (`auto`, `explore`, `json`, `jsonl`, `pretty`, `raw`, `yaml`)\n- `--format-error` - Change the output format for errors (`auto`, `explore`, `json`, `jsonl`, `pretty`, `raw`, `yaml`)\n- `--transform` - Transform the data output using [GJSON syntax](https:\u002F\u002Fgithub.com\u002Ftidwall\u002Fgjson\u002Fblob\u002Fmaster\u002FSYNTAX.md)\n- `--transform-error` - Transform the error output using [GJSON syntax](https:\u002F\u002Fgithub.com\u002Ftidwall\u002Fgjson\u002Fblob\u002Fmaster\u002FSYNTAX.md)\n\n### Passing files as arguments\n\nTo pass files to your API, you can use the `@myfile.ext` syntax:\n\n```bash\nopenai \u003Ccommand> --arg @abe.jpg\n```\n\nFiles can also be passed inside JSON or YAML blobs:\n\n```bash\nopenai \u003Ccommand> --arg '{image: \"@abe.jpg\"}'\n# Equivalent:\nopenai \u003Ccommand> \u003C\u003CYAML\narg:\n  image: \"@abe.jpg\"\nYAML\n```\n\nIf you need to pass a string literal that begins with an `@` sign, you can\nescape the `@` sign to avoid accidentally passing a file.\n\n```bash\nopenai \u003Ccommand> --username '\\@abe'\n```\n\n#### Explicit encoding\n\nFor JSON endpoints, the CLI tool does filetype sniffing to determine whether the\nfile contents should be sent as a string literal (for plain text files) or as a\nbase64-encoded string literal (for binary files). If you need to explicitly send\nthe file as either plain text or base64-encoded data, you can use\n`@file:\u002F\u002Fmyfile.txt` (for string encoding) or `@data:\u002F\u002Fmyfile.dat` (for\nbase64-encoding). Note that absolute paths will begin with `@file:\u002F\u002F` or\n`@data:\u002F\u002F`, followed by a third `\u002F` (for example, `@file:\u002F\u002F\u002Ftmp\u002Ffile.txt`).\n\n```bash\nopenai \u003Ccommand> --arg @data:\u002F\u002Ffile.txt\n```\n\n## Linking different Go SDK versions\n\nYou can link the CLI against a different version of the OpenAI Go SDK\nfor development purposes using the `.\u002Fscripts\u002Flink` script.\n\nTo link to a specific version from a repository (version can be a branch,\ngit tag, or commit hash):\n\n```bash\n.\u002Fscripts\u002Flink github.com\u002Forg\u002Frepo@version\n```\n\nTo link to a local copy of the SDK:\n\n```bash\n.\u002Fscripts\u002Flink ..\u002Fpath\u002Fto\u002Fopenai-go\n```\n\nIf you run the link script without any arguments, it will default to `..\u002Fopenai-go`.\n\n## License\n\nCopyright 2026 OpenAI\n\nThis project is licensed under the [Apache License 2.0](LICENSE).\n","OpenAI CLI 是官方提供的用于与 OpenAI REST API 交互的命令行工具。它采用 Go 语言编写，支持通过资源导向的命令结构来调用 API，包括标准 API 和管理 API 功能，并允许用户通过环境变量或全局标志配置 API 密钥等信息。此外，该工具还提供了多种输出格式选项以适应不同需求。适用于需要在终端环境下快速访问和使用 OpenAI 服务的开发者或团队，如自动化脚本编写、批量处理请求等场景。",2,"2026-06-11 03:31:42","CREATED_QUERY"]