.. _usage:

===========
Basic Usage
===========


Instantiating a Client for Optimization Work
============================================

Without Environment Variables
-----------------------------

Instantiate a :class:`qci_client.QciClient` for QCi's production server with your
secret API token string as follows---

.. code-block:: python

  # An alias for `from qci_client.optimization.client import OptimizationClient as QciClient`.
  from qci_client import QciClient

  client = QciClient(url="https://api.qci-prod.com", api_token="<secret_token>")

.. warning::
  Be careful not to accidentally share your secret API token when sharing code.

With Environment Variables
---------------------------

To access the API using environment variables, set the following---

- QCI_API_URL - URL string for the Qatalyst API. Example: "https://api.qci-prod.com"
- QCI_TOKEN - Secret API token string for securely accessing the Qatalyst API.

then instantiate a :class:`qci_client.QciClient` as follows---

.. code-block:: python

  # An alias for `from qci_client.optimization.client import OptimizationClient as QciClient`.
  from qci_client import QciClient

  client = QciClient()
