# CJam, 70 bytes, #Upvotes - 0.7

    {{_9%)A@9/#*}%}:M;rcrc),\i>:QlS-_@&{Qf#M:+}{i{Q,,M{1$)<},)Q@,=@@-}h;}?

This assumes that a valid input will be passed. Takes input from STDIN like the API spec says and prints result to STDOUT.

Examples:

    Input                Output
    
    A Z CODE GOLF        175
    a s 512              sssssjb
    A B 7                BBBA
    ≐ ⊐ ≤≫ ≥            1700

[Try it online here][1]

**Block wise explanation**:

    {{_9%)A@9/#*}%}:M;
    {             }:M;              "Define a function M which takes an input array of"
                                    "indeces and calculates the Gematri number for them";
     {          }%                  "Run this code block for each element of the array";
      _9%)                          "Copy the number, take modulus by 9 and increment it";
          A@                        "Put 10 on stack, and rotate to get the number on top";
            9/                      "Integer divide the number by 9";
              #                     "Calculate 10 to the power the above quotient";
               *                    "Multiply the above result by modulus 9";
    
    rcrc),\i>:QlS-_@&
    rcrc                            "Read the first two characters, representing the lower"
                                    "and upper end of the character list";
        ),                          "Increment the upper end and get a list of U to ASCII 0"
                                    "characters where U is the upper limit";
          \i                        "Swap and convert the lower limit to its ASCII number";
            >:Q                     "Slice the character list to get our desired character"
                                    "list range and store it in Q";
               lS-                  "Read the rest of the line as string and remove spaces";
                  _@&               "Take a copy, get Q on top of stack and take"
                                    "intersection with the input string. If the resulting"
                                    "string is empty, then the third input was a number";
                     {...}{...}?    "First code block is for string input and second for"
                                    "number input based on the above intersected string";
    
    {Qf#M:+}
     Qf#                            "For each character of input string, calculate its"
                                    "position in Q";
        M                           "Get the Gematri numbers for these inceces";
         :+                         "Sum them all to get the final Gematri number for the"
                                    "input string"
    
    {i{Q,,M{1$)<},)Q@,=@@-}h;}
     i                              "Convert the input number string to integer";
      {                   }h        "Run the code block till we get 0 on top of stack";
       Q,,M                         "Get the first length(Q) Gematri numbers";
           {1$)<},                  "Filter and take only which are less than input number";
                  )                 "Pop the last number from the filtered array. This is"
                                    "The maximum Gematri number that can be deducted";
                   Q@               "Put Q on stack and rotate the remaining filtered array"
                                    "to top of stack";
                     ,              "Calculate the length of that array, which is also the"
                                    "index of the Gematri number used.";
                      =             "Get the corresponding character to that Gematri number";
                       @@-          "Put the number and Gematri number on top and subtract."
                                    "The next loop runs on the above result now";
                            ;       "Pop the resedual 0 from stack. The remaining stack now"
                                    "contains just the Gematri characters."

  [1]: http://cjam.aditsu.net/