Access to IonQ's API requires an API key. This can be obtained on from the IonQ Console at cloud.ionq.com/settings/keys
For those accounts without console access, contact email@example.com to obtain a key.
An API key is required to access IonQ via Cirq. You will pass this key to an
instance of a
cirq_ionq.Service, which can then be used to interact
with IonQ computers.
Here is an example of this pattern:
import cirq_ionq as ionq service = ionq.Service(api_key='tomyheart')
Alternatively, you can use environment variables to set this value. This
environment variable for the API key is
IONQ_API_KEY. Details of how to set
environment variables vary by operating system. For example, in
Once this variable is set, the
ionq.Service() will look for it automatically
in the environment:
import cirq_ionq as ionq service = ionq.Service()
The advantage of doing things this way is that you do not have to store the API key in source code, which might accidentally get uploaded to a version control system, and hence leak the API key.