Skip to content
Merged
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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ gemini-api completion powershell | Out-String | Invoke-Expression
gemini-api agent run "Analyze market trends for Q3" --agent deep-research-preview-04-2026

# Choose a different model
gemini-api generate "Write a haiku about APIs" --model gemini-2.5-pro
gemini-api generate "Write a haiku about APIs" --model gemini-pro-latest

# Generate an image (prints the written file path)
gemini-api image "a lighthouse at sunset"
Expand Down Expand Up @@ -366,7 +366,7 @@ Commands are grouped the way `gemini-api --help` shows them. Every command accep

```bash
# Choose a different model
gemini-api generate "Write a haiku about APIs" --model gemini-2.5-pro
gemini-api generate "Write a haiku about APIs" --model gemini-pro-latest
# Generate with the default model (streams the reply)
gemini-api generate "Explain concurrency in one sentence"
```
Expand Down
2 changes: 1 addition & 1 deletion internal/cli/agent/intent_agent-run.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions internal/cli/agent/intent_generate.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 2 additions & 8 deletions internal/cli/catalog.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions internal/cli/custom/custom_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -736,25 +736,25 @@ func TestNormalizeIdentifier(t *testing.T) {
name: "models get positional prefixed",
flagName: "model",
shorthand: "m",
desc: "Model id, e.g. gemini-2.5-flash",
desc: "Model id, e.g. gemini-flash-latest",
normalize: normalizeModelPositional,
args: []string{"models/gemini-2.5-flash"},
wantVal: "gemini-2.5-flash",
args: []string{"models/gemini-flash-latest"},
wantVal: "gemini-flash-latest",
},
{
name: "models get flag bare",
flagName: "model",
shorthand: "m",
desc: "Model id, e.g. gemini-2.5-flash",
desc: "Model id, e.g. gemini-flash-latest",
normalize: normalizeModelPositional,
args: []string{"--model", "gemini-2.5-flash"},
wantVal: "gemini-2.5-flash",
args: []string{"--model", "gemini-flash-latest"},
wantVal: "gemini-flash-latest",
},
{
name: "models get invalid flag",
flagName: "model",
shorthand: "m",
desc: "Model id, e.g. gemini-2.5-flash",
desc: "Model id, e.g. gemini-flash-latest",
normalize: normalizeModelPositional,
args: []string{"--model", "../files/x"},
wantErr: `invalid model id "../files/x"`,
Expand All @@ -763,7 +763,7 @@ func TestNormalizeIdentifier(t *testing.T) {
name: "models get missing id",
flagName: "model",
shorthand: "m",
desc: "Model id, e.g. gemini-2.5-flash",
desc: "Model id, e.g. gemini-flash-latest",
normalize: normalizeModelPositional,
args: nil,
wantErr: "missing required flag: --model (or pass it as the [model] argument)",
Expand Down
2 changes: 1 addition & 1 deletion internal/cli/custom/hardening_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ func FuzzTimestampRoundTrip(f *testing.F) {
}

func FuzzIdentifierNormalizers(f *testing.F) {
for _, seed := range []string{"files/abc-123", "models/gemini-2.5-flash", "../x", "files/", "a/b", "%2e%2e", " x "} {
for _, seed := range []string{"files/abc-123", "models/gemini-flash-latest", "../x", "files/", "a/b", "%2e%2e", " x "} {
f.Add(seed)
}
f.Fuzz(func(t *testing.T, in string) {
Expand Down
4 changes: 2 additions & 2 deletions internal/cli/custom/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,13 +214,13 @@ func normalizeFilePositional(id string) (string, error) {
var modelIDShape = regexp.MustCompile(`^[a-zA-Z0-9][a-zA-Z0-9._-]*$`)

// normalizeModelPositional strips an optional "models/" prefix so both
// "models get gemini-2.5-flash" and "models get models/gemini-2.5-flash"
// "models get gemini-flash-latest" and "models get models/gemini-flash-latest"
// resolve to the bare id the path parameter expects, and rejects empty or
// malformed ids before they reach the API.
func normalizeModelPositional(id string) (string, error) {
id = strings.TrimPrefix(strings.TrimSpace(id), "models/")
if !modelIDShape.MatchString(id) {
return "", fmt.Errorf("invalid model id %q; expected a model name like \"gemini-2.5-flash\"", id)
return "", fmt.Errorf("invalid model id %q; expected a model name like \"gemini-flash-latest\"", id)
}
return id, nil
}
Expand Down
8 changes: 4 additions & 4 deletions internal/cli/models/modelsget.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 3 additions & 9 deletions internal/sdk/models/interactions/model.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion internal/sdk/models/operations/modelsget.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading