Skip to main content

AWS credentials management

static Haiqu.save_aws_credentials(aws_access_key_id, aws_secret_access_key, aws_default_region=‘us-east-1’, aws_session_token=None)

Save AWS credentials in the environment variables:
  • “AWS_ACCESS_KEY_ID”
  • “AWS_SECRET_ACCESS_KEY”
  • “AWS_DEFAULT_REGION”
  • “AWS_SESSION_TOKEN” (optional; required for temporary/STS credentials)
NOTE: overwrites existing environment variables with the same names.
  • Parameters:
    • aws_access_key_id (str) — AWS access key ID.
    • aws_secret_access_key (str) — AWS secret access key.
    • aws_default_region (str) — AWS default region. Defaults to “us-east-1”.
    • aws_session_token (Optional *[*str ]) — AWS session token for temporary/STS credentials. Defaults to None.

IBM Quantum credentials management

static Haiqu.save_ibm_credentials(ibm_quantum_token, ibm_quantum_instance)

Save IBM Quantum API token and instance using QiskitRuntimeService with the name “haiqu_ibm_account”. NOTE: overwrites existing account with the name “haiqu_ibm_account”.
  • Parameters:
    • ibm_quantum_token (str) — IBM Quantum API token.
    • ibm_quantum_instance (str) — IBM Quantum instance name.

Haiqu.verify_ibm_credentials(ibm_quantum_token=None, ibm_quantum_instance=None)

Check with IBM Quantum that the API token and instance are accepted. Arguments that are not passed are taken from the account saved with save_ibm_credentials(), so calling it with no arguments checks the saved credentials. The check is a read-only request that runs nothing on a QPU. run() and flow() make it before submitting a job to an IBM Quantum device, so invalid credentials are reported before any circuit is uploaded. Credentials that pass are remembered for the rest of the session, so they are checked once.
  • Parameters:
    • ibm_quantum_token (str | None) — IBM Quantum API token. Defaults to the saved account’s token.
    • ibm_quantum_instance (str | None) — IBM Quantum instance name. Defaults to the saved account’s instance, or no instance when none is saved.
  • Raises: ValueError — If no token is passed or saved, or if IBM Quantum rejects the credentials or cannot be reached.
  • Return type: None

IQM Resonance credentials management

static Haiqu.save_iqm_credentials(iqm_token, iqm_server_url=‘https://resonance.iqm.tech’)

Save IQM Resonance credentials in the environment variables:
  • “IQM_TOKEN”
  • “IQM_SERVER_URL”
NOTE: overwrites existing environment variables with the same names.
  • Parameters:
    • iqm_token (str) — IQM Resonance API token.
    • iqm_server_url (str) — IQM Resonance server URL. Defaults to the Resonance production URL.