API keys

Every call to the Quicopt service carries your API key. The key tells the service whose allowance a solve counts against, so each account has its own.

Get a key

Sign up with your email address. We send you your key by email; it starts with qo_. Keys from before sign-up was introduced no longer work.

Give the key to the client

Set QUICOPT_API_KEY, and Client() picks the key up without any argument:

export QUICOPT_API_KEY=qo_your_key_here

On Windows (PowerShell): $env:QUICOPT_API_KEY = "qo_your_key_here". Add the line to your shell profile to keep it across sessions. The Julia, R and Ruby clients read the same variable; in R you can also put the line QUICOPT_API_KEY=qo_your_key_here into your .Renviron and restart R.

In code

You can pass the key directly:

from quicopt import Client

client = Client(api_key="qo_your_key_here")

The key then travels with your code, into repositories, notebooks and logs. Prefer the environment variable for anything you share.

When the key is missing or invalid

The call fails with a QuicoptError that says what is wrong. Without a key:

quicopt.client.QuicoptError: keys are no longer issued on a first call; register at https://quicopt.com/signup to receive one by mail, then send it as Authorization: Bearer <key>

With a key the service does not know, for example a mistyped one or one from before sign-up:

quicopt.client.QuicoptError: unknown or invalid API key. Keys from before sign-up was introduced no longer work; to get a new key, register at https://quicopt.com/signup to receive one by mail, then send it as Authorization: Bearer <key>

Check that QUICOPT_API_KEY is set in the shell that runs your code (echo $QUICOPT_API_KEY) and that it matches the key from your email.

Keep your key private

Treat the key like a password: keep it out of version control (a .env file belongs in .gitignore) and out of anything you publish. If a key has leaked, tell us right away.