Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
lint:
timeout-minutes: 10
name: lint
runs-on: ${{ github.repository == 'stainless-sdks/openai-cli' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
runs-on: ${{ startsWith(github.repository, 'stainless-sdks/') && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
if: (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata')

steps:
Expand Down Expand Up @@ -54,7 +54,7 @@ jobs:
permissions:
contents: read
id-token: write
runs-on: ${{ github.repository == 'stainless-sdks/openai-cli' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
runs-on: ${{ startsWith(github.repository, 'stainless-sdks/') && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
if: (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata')
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
Expand Down Expand Up @@ -109,7 +109,7 @@ jobs:
test:
timeout-minutes: 10
name: test
runs-on: ${{ github.repository == 'stainless-sdks/openai-cli' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
runs-on: ${{ startsWith(github.repository, 'stainless-sdks/') && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
Expand Down
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "1.4.0"
".": "1.5.0"
}
8 changes: 4 additions & 4 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 258
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai/openai-ae4c1a92306e31f05678c3de72efbf1903b5c09924dacd42a555cc5ccc0e5eb1.yml
openapi_spec_hash: 0973932f9a3f0b46a0933b143878f9fe
config_hash: b40012963b4619be8229fcca0105b627
configured_endpoints: 259
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai/openai-8ed7dcb0d163e7f5205dbe172d6ad5b7ce367b23c20629830e39a0aee920a029.yml
openapi_spec_hash: 011cdae0c67909fb80a4a5eb54ca5bca
config_hash: 896f0f71bc7d1ee09435813cdef97523
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Changelog

## 1.5.0 (2026-07-17)

Full Changelog: [v1.4.0...v1.5.0](https://github.com/openai/openai-cli/compare/v1.4.0...v1.5.0)

### Features

* **api:** /organization/projects/{project_id}/service_accounts/{service_account_id}/api_keys" endpoint ([ad0f9fa](https://github.com/openai/openai-cli/commit/ad0f9fa6c506df6341cb3e7a7170cde6a6744fef))
* **api:** manual updates ([3c1f4b8](https://github.com/openai/openai-cli/commit/3c1f4b878c9c9e612f70369816c2fcf98306a350))
* **api:** manual updates ([cff8c9d](https://github.com/openai/openai-cli/commit/cff8c9d86782342fbef787152ac4cfa32fdd70f7))
* **stlc:** configurable CI runner and private-production-repo support in workflow templates ([8c73e8c](https://github.com/openai/openai-cli/commit/8c73e8c92716a1cdb9a374f1325626828a5b9577))

## 1.4.0 (2026-07-14)

Full Changelog: [v1.3.0...v1.4.0](https://github.com/openai/openai-cli/compare/v1.3.0...v1.4.0)
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ require (
github.com/goccy/go-yaml v1.18.0
github.com/itchyny/json2yaml v0.1.4
github.com/muesli/reflow v0.3.0
github.com/openai/openai-go/v3 v3.42.0
github.com/openai/openai-go/v3 v3.43.0
github.com/stretchr/testify v1.10.0
github.com/tidwall/gjson v1.18.0
github.com/tidwall/pretty v1.2.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ github.com/muesli/reflow v0.3.0 h1:IFsN6K9NfGtjeggFP+68I4chLZV2yIKsXJFNZ+eWh6s=
github.com/muesli/reflow v0.3.0/go.mod h1:pbwTDkVPibjO2kyvBQRBxTWEEGDGq0FlB1BIKtnHY/8=
github.com/muesli/termenv v0.16.0 h1:S5AlUN9dENB57rsbnkPyfdGuWIlkmzJjbFf0Tf5FWUc=
github.com/muesli/termenv v0.16.0/go.mod h1:ZRfOIKPFDYQoDFF4Olj7/QJbW60Ol/kL1pU3VfY/Cnk=
github.com/openai/openai-go/v3 v3.42.0 h1:16Skv1hpEhSm3imZpPGSeEBDUgVJJA9cHryKGGsVYI8=
github.com/openai/openai-go/v3 v3.42.0/go.mod h1:cdufnVK14cWcT9qA1rRtrXx4FTRsgbDPW7Ia7SS5cZo=
github.com/openai/openai-go/v3 v3.43.0 h1:C+MFVUMU3TJNgES+Ikt7HF8xcX7J0wynKeR9ST22hZM=
github.com/openai/openai-go/v3 v3.43.0/go.mod h1:cdufnVK14cWcT9qA1rRtrXx4FTRsgbDPW7Ia7SS5cZo=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
Expand Down
7 changes: 6 additions & 1 deletion pkg/cmd/adminorganizationprojectserviceaccount.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (

var adminOrganizationProjectsServiceAccountsCreate = cli.Command{
Name: "create",
Usage: "Creates a new service account in the project. This also returns an unredacted\nAPI key for the service account.",
Usage: "Creates a new service account in the project. By default, this also returns an\nunredacted API key for the service account.",
Suggest: true,
Flags: []cli.Flag{
&requestflag.Flag[string]{
Expand All @@ -30,6 +30,11 @@ var adminOrganizationProjectsServiceAccountsCreate = cli.Command{
Required: true,
BodyPath: "name",
},
&requestflag.Flag[*bool]{
Name: "create-service-account-only",
Usage: "Create the service account without default roles or an API key.",
BodyPath: "create_service_account_only",
},
},
Action: handleAdminOrganizationProjectsServiceAccountsCreate,
HideHelpCommand: true,
Expand Down
5 changes: 4 additions & 1 deletion pkg/cmd/adminorganizationprojectserviceaccount_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,15 @@ func TestAdminOrganizationProjectsServiceAccountsCreate(t *testing.T) {
"admin:organization:projects:service-accounts", "create",
"--project-id", "project_id",
"--name", "name",
"--create-service-account-only=true",
)
})

t.Run("piping data", func(t *testing.T) {
// Test piping YAML data over stdin
pipeData := []byte("name: name")
pipeData := []byte("" +
"name: name\n" +
"create_service_account_only: true\n")
mocktest.TestRunMockTestWithPipeAndFlags(
t, pipeData,
"--api-key", "string",
Expand Down
101 changes: 101 additions & 0 deletions pkg/cmd/adminorganizationprojectserviceaccountapikey.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

package cmd

import (
"context"
"fmt"

"github.com/openai/openai-cli/internal/apiquery"
"github.com/openai/openai-cli/internal/requestflag"
"github.com/openai/openai-go/v3"
"github.com/openai/openai-go/v3/option"
"github.com/tidwall/gjson"
"github.com/urfave/cli/v3"
)

var adminOrganizationProjectsServiceAccountsAPIKeysCreate = cli.Command{
Name: "create",
Usage: "Creates an API key for a service account in the project.",
Suggest: true,
Flags: []cli.Flag{
&requestflag.Flag[string]{
Name: "project-id",
Usage: "The ID of the project.",
Required: true,
PathParam: "project_id",
},
&requestflag.Flag[string]{
Name: "service-account-id",
Usage: "The ID of the service account.",
Required: true,
PathParam: "service_account_id",
},
&requestflag.Flag[string]{
Name: "name",
Usage: "API key name.",
BodyPath: "name",
},
&requestflag.Flag[[]string]{
Name: "scope",
Usage: "API key scopes.",
BodyPath: "scopes",
},
},
Action: handleAdminOrganizationProjectsServiceAccountsAPIKeysCreate,
HideHelpCommand: true,
}

func handleAdminOrganizationProjectsServiceAccountsAPIKeysCreate(ctx context.Context, cmd *cli.Command) error {
client := openai.NewClient(getDefaultRequestOptions(cmd)...)
unusedArgs := cmd.Args().Slice()
if !cmd.IsSet("project-id") && len(unusedArgs) > 0 {
cmd.Set("project-id", unusedArgs[0])
unusedArgs = unusedArgs[1:]
}
if !cmd.IsSet("service-account-id") && len(unusedArgs) > 0 {
cmd.Set("service-account-id", unusedArgs[0])
unusedArgs = unusedArgs[1:]
}
if len(unusedArgs) > 0 {
return fmt.Errorf("Unexpected extra arguments: %v", unusedArgs)
}

options, err := flagOptions(
cmd,
apiquery.NestedQueryFormatBrackets,
apiquery.ArrayQueryFormatBrackets,
ApplicationJSON,
false,
)
if err != nil {
return err
}

params := openai.AdminOrganizationProjectServiceAccountAPIKeyNewParams{}

Check failure on line 75 in pkg/cmd/adminorganizationprojectserviceaccountapikey.go

View workflow job for this annotation

GitHub Actions / test

undefined: openai.AdminOrganizationProjectServiceAccountAPIKeyNewParams

Check failure on line 75 in pkg/cmd/adminorganizationprojectserviceaccountapikey.go

View workflow job for this annotation

GitHub Actions / lint

undefined: openai.AdminOrganizationProjectServiceAccountAPIKeyNewParams

var res []byte
options = append(options, option.WithResponseBodyInto(&res))
_, err = client.Admin.Organization.Projects.ServiceAccounts.APIKeys.New(

Check failure on line 79 in pkg/cmd/adminorganizationprojectserviceaccountapikey.go

View workflow job for this annotation

GitHub Actions / test

client.Admin.Organization.Projects.ServiceAccounts.APIKeys undefined (type openai.AdminOrganizationProjectServiceAccountService has no field or method APIKeys)

Check failure on line 79 in pkg/cmd/adminorganizationprojectserviceaccountapikey.go

View workflow job for this annotation

GitHub Actions / lint

client.Admin.Organization.Projects.ServiceAccounts.APIKeys undefined (type openai.AdminOrganizationProjectServiceAccountService has no field or method APIKeys)
ctx,
cmd.Value("project-id").(string),
cmd.Value("service-account-id").(string),
params,
options...,
)
if err != nil {
return err
}

obj := gjson.ParseBytes(res)
format := cmd.Root().String("format")
explicitFormat := cmd.Root().IsSet("format")
transform := cmd.Root().String("transform")
return ShowJSON(obj, ShowJSONOpts{
ExplicitFormat: explicitFormat,
Format: format,
RawOutput: cmd.Root().Bool("raw-output"),
Title: "admin:organization:projects:service-accounts:api-keys create",
Transform: transform,
})
}
40 changes: 40 additions & 0 deletions pkg/cmd/adminorganizationprojectserviceaccountapikey_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

package cmd

import (
"testing"

"github.com/openai/openai-cli/internal/mocktest"
)

func TestAdminOrganizationProjectsServiceAccountsAPIKeysCreate(t *testing.T) {
t.Run("regular flags", func(t *testing.T) {
mocktest.TestRunMockTestWithFlags(
t,
"--api-key", "string",
"--admin-api-key", "string",
"admin:organization:projects:service-accounts:api-keys", "create",
"--project-id", "project_id",
"--service-account-id", "service_account_id",
"--name", "name",
"--scope", "string",
)
})

t.Run("piping data", func(t *testing.T) {
// Test piping YAML data over stdin
pipeData := []byte("" +
"name: name\n" +
"scopes:\n" +
" - string\n")
mocktest.TestRunMockTestWithPipeAndFlags(
t, pipeData,
"--api-key", "string",
"--admin-api-key", "string",
"admin:organization:projects:service-accounts:api-keys", "create",
"--project-id", "project_id",
"--service-account-id", "service_account_id",
)
})
}
8 changes: 8 additions & 0 deletions pkg/cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,14 @@ func init() {
&adminOrganizationProjectsServiceAccountsDelete,
},
},
{
Name: "admin:organization:projects:service-accounts:api-keys",
Category: "API RESOURCE",
Suggest: true,
Commands: []*cli.Command{
&adminOrganizationProjectsServiceAccountsAPIKeysCreate,
},
},
{
Name: "admin:organization:projects:api-keys",
Category: "API RESOURCE",
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

package cmd

const Version = "1.4.0" // x-release-please-version
const Version = "1.5.0" // x-release-please-version
Loading