--- /Users/James/Desktop/gmap/gmap.module
+++ gmap.module
@@ -174,7 +174,7 @@
   drupal_add_js(array('gmap_markermanager' => $mms[$mm]), 'setting');
 // @@@
 drupal_add_js($gmap_path .'/js/poly.js');
-  drupal_set_html_head('<script src="http://maps.google.com/maps?file=api&amp;v='. GMAP_API_V .'&amp;key='. variable_get('googlemap_api_key', '') .'" type="text/javascript"></script>');
+  drupal_set_html_head('<script src="http://maps.google.com/maps?file=api&amp;v='. GMAP_API_V .'&amp;key='. keys_api_get_key('Gmap',$_SERVER['HTTP_HOST']) .'" type="text/javascript"></script>');
   $gmap_initialized = TRUE;
 }
 
@@ -759,6 +759,30 @@
   return _gmap_admin_settings();
 }
 
+function gmap_admin_settings_validate($form_id, $form_values, $form) {
+  // form_set_error('googlemap_api_key', 'ERROR');
+	dprint_r($form_values);
+}
+
+function _gmap_admin_settings_submit($form_id, $form_values) {
+  $domain = $_SERVER['HTTP_HOST'];
+  $service = 'Gmap';
+  
+  keys_api_set_key($service, $domain, $form_values['googlemap_api_key']);
+}
+
+/**
+ * Implementation of hook_keys_service().
+ */
+function gmap_keys_service() {
+  return array(
+    'Gmap' => array(
+      'name' => t('Gmap'),
+      'description' => t('Google Maps API Key.')
+    )
+  );
+}
+
 /**
  * Implementation of hook_elements().
  */
@@ -1188,7 +1212,7 @@
  *  for a description of the possible status codes.
  */
 function gmap_geocode($address) {
-  $data = drupal_http_request('http://maps.google.com/maps/geo?q='. drupal_urlencode($address) .'&output=csv&key='. variable_get('googlemap_api_key', ''));
+  $data = drupal_http_request('http://maps.google.com/maps/geo?q='. drupal_urlencode($address) .'&output=csv&key='. keys_api_get_key('Gmap',$_SERVER['HTTP_HOST']));
   if ($data->code == 200) {
     $r = explode(',', $data->data);
     return array(
