all: more gemini key plumbing
diff --git a/cmd/sketch/main.go b/cmd/sketch/main.go
index f3f3139..7bfb1a6 100644
--- a/cmd/sketch/main.go
+++ b/cmd/sketch/main.go
@@ -287,14 +287,14 @@
 // with access to outside environment variables.
 func runInContainerMode(ctx context.Context, flags CLIFlags, logFile *os.File) error {
 	// Get credentials from environment
-	apiKey := os.Getenv("SKETCH_ANTHROPIC_API_KEY")
+	apiKey := os.Getenv("SKETCH_MODEL_API_KEY")
 	pubKey := os.Getenv("SKETCH_PUB_KEY")
-	antURL, err := skabandclient.LocalhostToDockerInternal(os.Getenv("SKETCH_ANT_URL"))
-	if err != nil && os.Getenv("SKETCH_ANT_URL") != "" {
+	modelURL, err := skabandclient.LocalhostToDockerInternal(os.Getenv("SKETCH_MODEL_URL"))
+	if err != nil && os.Getenv("SKETCH_MODEL_URL") != "" {
 		return err
 	}
 
-	return setupAndRunAgent(ctx, flags, antURL, apiKey, pubKey, true, logFile)
+	return setupAndRunAgent(ctx, flags, modelURL, apiKey, pubKey, true, logFile)
 }
 
 // runInUnsafeMode handles execution on the host machine without Docker.
@@ -329,7 +329,7 @@
 
 // setupAndRunAgent handles the common logic for setting up and running the agent
 // in both container and unsafe modes.
-func setupAndRunAgent(ctx context.Context, flags CLIFlags, antURL, apiKey, pubKey string, inInsideSketch bool, logFile *os.File) error {
+func setupAndRunAgent(ctx context.Context, flags CLIFlags, modelURL, apiKey, pubKey string, inInsideSketch bool, logFile *os.File) error {
 	// Configure HTTP client with optional recording
 	var client *http.Client
 	if flags.httprrFile != "" {
@@ -357,7 +357,7 @@
 		return err
 	}
 
-	llmService, err := selectLLMService(client, flags.modelName, antURL, apiKey)
+	llmService, err := selectLLMService(client, flags.modelName, modelURL, apiKey)
 	if err != nil {
 		return fmt.Errorf("failed to initialize LLM service: %w", err)
 	}
@@ -578,14 +578,14 @@
 // If modelName is "gemini", it uses the Gemini service.
 // Otherwise, it tries to use the OpenAI service with the specified model.
 // Returns an error if the model name is not recognized or if required configuration is missing.
-func selectLLMService(client *http.Client, modelName string, antURL, apiKey string) (llm.Service, error) {
+func selectLLMService(client *http.Client, modelName string, modelURL, apiKey string) (llm.Service, error) {
 	if modelName == "" || modelName == "claude" {
 		if apiKey == "" {
 			return nil, fmt.Errorf("missing ANTHROPIC_API_KEY")
 		}
 		return &ant.Service{
 			HTTPC:  client,
-			URL:    antURL,
+			URL:    modelURL,
 			APIKey: apiKey,
 		}, nil
 	}
@@ -596,6 +596,7 @@
 		}
 		return &gem.Service{
 			HTTPC:  client,
+			URL:    modelURL,
 			Model:  gem.DefaultModel,
 			APIKey: apiKey,
 		}, nil
diff --git a/dockerimg/dockerimg.go b/dockerimg/dockerimg.go
index 611901a..7aecb16 100644
--- a/dockerimg/dockerimg.go
+++ b/dockerimg/dockerimg.go
@@ -430,7 +430,7 @@
 		"-i",
 		"--name", cntrName,
 		"-p", hostPort + ":80", // forward container port 80 to a host port
-		"-e", "SKETCH_ANTHROPIC_API_KEY=" + config.ModelAPIKey,
+		"-e", "SKETCH_MODEL_API_KEY=" + config.ModelAPIKey,
 	}
 	if !config.OneShot {
 		cmdArgs = append(cmdArgs, "-t")
@@ -440,7 +440,7 @@
 		cmdArgs = append(cmdArgs, "-e", envVar)
 	}
 	if config.ModelURL != "" {
-		cmdArgs = append(cmdArgs, "-e", "SKETCH_ANT_URL="+config.ModelURL)
+		cmdArgs = append(cmdArgs, "-e", "SKETCH_MODEL_URL="+config.ModelURL)
 	}
 	if config.SketchPubKey != "" {
 		cmdArgs = append(cmdArgs, "-e", "SKETCH_PUB_KEY="+config.SketchPubKey)
@@ -675,6 +675,7 @@
 		if model == "gemini" {
 			if strings.HasSuffix(modelURL, "/gemmsgs") {
 				// Horrible hack! Switch back to anthropic for container building.
+				// We can do this because we are talking to skaband and know the address.
 				modelURL = strings.Replace(modelURL, "/gemmsgs", "/antmsgs", 1)
 			} else {
 				return "", fmt.Errorf("building docker image with gemini model is not supported yet; start with -model=anthropic first then use gemini")
diff --git a/dockerimg/dockerimg_test.go b/dockerimg/dockerimg_test.go
index 7e41742..c48e96b 100644
--- a/dockerimg/dockerimg_test.go
+++ b/dockerimg/dockerimg_test.go
@@ -89,7 +89,7 @@
 			if err != nil {
 				t.Fatal(err)
 			}
-			apiKey := cmp.Or(os.Getenv("OUTER_SKETCH_ANTHROPIC_API_KEY"), os.Getenv("ANTHROPIC_API_KEY"))
+			apiKey := cmp.Or(os.Getenv("OUTER_SKETCH_MODEL_API_KEY"), os.Getenv("ANTHROPIC_API_KEY"))
 			srv := &ant.Service{
 				APIKey: apiKey,
 				HTTPC:  rr.Client(),
diff --git a/llm/conversation/convo_test.go b/llm/conversation/convo_test.go
index 3fb1750..af8a904 100644
--- a/llm/conversation/convo_test.go
+++ b/llm/conversation/convo_test.go
@@ -23,7 +23,7 @@
 		return nil
 	})
 
-	apiKey := cmp.Or(os.Getenv("OUTER_SKETCH_ANTHROPIC_API_KEY"), os.Getenv("ANTHROPIC_API_KEY"))
+	apiKey := cmp.Or(os.Getenv("OUTER_SKETCH_MODEL_API_KEY"), os.Getenv("ANTHROPIC_API_KEY"))
 	srv := &ant.Service{
 		APIKey: apiKey,
 		HTTPC:  rr.Client(),
diff --git a/llm/gem/gem.go b/llm/gem/gem.go
index 4327123..fa9f3b6 100644
--- a/llm/gem/gem.go
+++ b/llm/gem/gem.go
@@ -25,6 +25,7 @@
 // Fields should not be altered concurrently with calling any method on Service.
 type Service struct {
 	HTTPC     *http.Client // defaults to http.DefaultClient if nil
+	URL       string       // Gemini API URL, uses the gemini package default if empty
 	APIKey    string       // must be non-empty
 	Model     string       // defaults to DefaultModel if empty
 	MaxTokens int          // defaults to DefaultMaxTokens if zero
@@ -486,9 +487,10 @@
 
 	// Create a Gemini model instance
 	model := gemini.Model{
-		Model:  "models/" + cmp.Or(s.Model, DefaultModel),
-		APIKey: s.APIKey,
-		HTTPC:  cmp.Or(s.HTTPC, http.DefaultClient),
+		Model:    "models/" + cmp.Or(s.Model, DefaultModel),
+		Endpoint: s.URL,
+		APIKey:   s.APIKey,
+		HTTPC:    cmp.Or(s.HTTPC, http.DefaultClient),
 	}
 
 	// Send the request to Gemini with retry logic
diff --git a/loop/agent_test.go b/loop/agent_test.go
index 56708e3..918088d 100644
--- a/loop/agent_test.go
+++ b/loop/agent_test.go
@@ -66,7 +66,7 @@
 		t.Fatal(err)
 	}
 
-	apiKey := cmp.Or(os.Getenv("OUTER_SKETCH_ANTHROPIC_API_KEY"), os.Getenv("ANTHROPIC_API_KEY"))
+	apiKey := cmp.Or(os.Getenv("OUTER_SKETCH_MODEL_API_KEY"), os.Getenv("ANTHROPIC_API_KEY"))
 	cfg := AgentConfig{
 		Context: ctx,
 		Service: &ant.Service{