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.
Using the Burger Menu at the top left of the Azure Portal, Click on 'Create a resource' as highlighted in the screenshot below:
Choose the Create A Resource option from the Azure Portal Burger Menu
Next, select 'AI + Machine Learning'
Select AI + Machine Learning
and then select the Create option under 'Computer Vision':
Select the Create option under Computer Vision
This will display a new window where you enter the details to create the Computer Vision service:
Enter details to create the Computer Vision Service
Fill in each of the fields as directed below:
  • Subscription - Select 'Azure for Students' or 'Free Trial'.
  • 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.
  • Region - YOU MUST SELECT 'West Europe'. Our server is located in West Europe and this will give the fastest response time.
  • 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. 'matchgame'.
  • Pricing tier - Select 'S1 (10 calls per second)'
Check the Terms box and click on the Review + Create button that is at the very bottom of the screen to create the service.
Create the service
This will verify that the options you have chosen are valid. Another Create button will be displayed at the bottom of the screen to create the service.
Click the final Create button
The resource will be created and after a short time you will see a Deployment Is Complete message. Click on the button to Go To Resource
Click on the 'Keys and Endpoint' link under the Resource Management section. This will take you to the Manage Keys window as shown below:
Now you can copy either one of the keys. Use the Show Keys button to reveal the keys and use the Copy icon to copy one of the keys to the clipboard.
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.
Copy the Computer Vision API key

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 = ""