AI Gaming
Creating a Computer Vision API key
In order to play the Match Game, you need to create a Computer Vision API key. A key is necessary as the Computer Vision API is a paid service. Microsoft Student Partners will be able to use their MSDN subscriptions to create API keys

Getting a Computer Vision API key

Once you have access to the Microsoft Azure Portal you can create a Computer Vision API service and get a Computer Vision API Key.
Click on 'Create a resource' as highlighted in the screen below:
From the Microsoft Azure Portal, select the option to Create A Resource
Next, select 'AI + Machine Learning'
Select the AI + Machine Learning menu option
and then 'Computer Vision':
Then select Computer Vision
This will display a new window where you enter the details to create the Computer Vision service:
Enter the details for the Computer Vision service
Fill in each of the fields as directed below:
  • Name - Enter a descriptive name for you to identify the service. It can be anything you like and will be the name that is listed on your Azure dashboard e.g. 'Vision_api'.
  • Subscription - Select 'Azure for Students' or 'Free Trial'.
  • Location - Select 'West Europe'.
  • Pricing tier - Select 'S1 (10 calls per second)'
  • Resource group - You can create groups to group together different Microsoft Azure resources that you create and use. Select the Create new option if you want to create a new group, or select an existing group if you have one.
Click on the Create button that is at the very bottom of the screen to create the service. After a few moments you will be directed to the services Quick Start screen as shown below:
The Computer Vision Service Quick Start Screen
Click on the 'Keys' link under the 'Grab your keys' section. This will take you to the Manage Keys window as shown below:
Get the Computer Vision API Keys from the Manage Keys window
Now you can copy either one of the keys. It does not matter which key you take, both work in exactly the same way. It is this key that you will paste into the "Microsoft API Template" code in the Editor on the site.
Note in the picture above part of the key is blanked out for security reasons.

Using the API Keys in our Demo Code

The API key you created through the above process can now be used in the template code supplied in the Online Code Editor on the site. We have highlighted where you need to use the API key in the code using the string "YOUR-MICROSOFT-COMPUTER-VISION-API-KEY-HERE" as shown below:
# See our help page to learn how to get a Microsoft API Key at
headers_vision = {'Ocp-Apim-Subscription-Key': 'YOUR-MICROSOFT-COMPUTER-VISION-API-KEY-HERE'}


When creating the Computer Vision service we noted that you must select the West Europe region. If you choose something other than Western Europe, you will need to tailor the URLs when calling the APIs from your code. In the examples below you can see that all our demo code API URLs expect API keys to be from the West Europe location:
vision_base_url = ""
Last modified 2yr ago