diff --git a/openrpc/cmd/cli.go b/openrpc/cmd/cli.go
index 63ad966c81f4802fc3897063371a9f085d6a3bac..f9962a887be718cdcb9fb52cf6eba9bc412bdd34 100644
--- a/openrpc/cmd/cli.go
+++ b/openrpc/cmd/cli.go
@@ -29,10 +29,10 @@ func (c *CompileCommand) Run() error {
 }
 
 type GenerateCommand struct {
-	Spec      string `name:"spec" short:"s" help:"path to jopenrpc spec"`
-	Output    string `name:"output" short:"o" help:"output directory and package"`
-	Templates string `name:"templates" short:"t" help:"template to generate with"`
-	Package   string `name:"package" short:"p" default:"api" help:"package name"`
+	Spec     string `name:"spec" short:"s" help:"path to jopenrpc spec"`
+	Output   string `name:"output" short:"o" help:"output directory and package"`
+	Template string `name:"template" short:"t" help:"template to generate with"`
+	Package  string `name:"package" short:"p" default:"api" help:"package name"`
 }
 
 func (c *GenerateCommand) Run() error {
@@ -45,7 +45,7 @@ func (c *GenerateCommand) Run() error {
 	}
 	openrpc.Package = c.Package
 
-	if err = generate.Generate(openrpc, c.Templates, c.Output); err != nil {
+	if err = generate.Generate(openrpc, c.Template, c.Output); err != nil {
 		return err
 	}
 
diff --git a/openrpc/generate/generate.go b/openrpc/generate/generate.go
index 377aa60c4b2a0a1c22884f04f9b2f6757b998bba..6bb5a81a97602e368570da1e69c5325bc8cd8d80 100644
--- a/openrpc/generate/generate.go
+++ b/openrpc/generate/generate.go
@@ -5,6 +5,7 @@ import (
 	"fmt"
 	"go/format"
 	"os"
+	"path"
 	"path/filepath"
 	"text/template"
 
@@ -45,8 +46,7 @@ var funcs = template.FuncMap{
 func Generate(rpc *types.OpenRPC, ts string, output string) error {
 
 	var wr bytes.Buffer
-	name := "types"
-	t, err := template.New(name).Funcs(funcs).ParseFiles(ts)
+	t, err := template.New(path.Base(ts)).Funcs(funcs).ParseFiles(ts)
 	if err != nil {
 		return err
 	}
@@ -63,7 +63,6 @@ func Generate(rpc *types.OpenRPC, ts string, output string) error {
 	}
 	wr.Reset()
 
-	name = name[:len(name)-len(filepath.Ext(name))]
 	err = os.WriteFile(output, fmtd, 0777)
 	if err != nil {
 		return err
diff --git a/openrpc/out/generate.go b/openrpc/out/generate.go
index 7a4e59acb5aa174dd51af27a62264dd6db3ae8e3..56b417cec0e46d257997e74360f18f131e0e48f9 100644
--- a/openrpc/out/generate.go
+++ b/openrpc/out/generate.go
@@ -1,3 +1,3 @@
 package out
 
-//go:generate go run gfx.cafe/open/jrpc/openrpc/cmd -p out -s generated_spec.json -o generated.go -t ../templates/types.gotmpl;
+//go:generate go run gfx.cafe/open/jrpc/openrpc/cmd generate -p out -s generated_spec.json -o generated_api.go -t ../templates/types.gotmpl
diff --git a/openrpc/templates/types.gotmpl b/openrpc/templates/types.gotmpl
index 2360c4f9989ba40474f582f485bb029a5173ab31..8231eb8950e981a9f0a7fbe358df896307b45329 100644
--- a/openrpc/templates/types.gotmpl
+++ b/openrpc/templates/types.gotmpl
@@ -1,6 +1,6 @@
 // Code generated by go-openrpc. DO NOT EDIT.
 
-package {{.Package}}
+package {{ .Package }}
 
 {{define "schemaType" -}}
     {{if not (eq .Ref "") -}}