Create an API key
Create an API key with the CLI to authenticate requests to a Managed Inference endpoint.
Create an API key from the CLI and use it to authenticate requests to a Managed Inference endpoint that requires an authorization header.
Prerequisites
You need the following before you start.
- A running CosmicAC deployment. See Installation.
- The CosmicAC CLI installed and configured. See Install the CLI.
Create the key
Create a key, replacing <name> with a display name for the key.
cosmicac api-keys create <name>CosmicAC shows the full key only once. Copy it and store it somewhere safe.
If you lose the key, you cannot recover it. Revoke the key and create a new one.
Confirm the key
List your keys.
cosmicac api-keys listThe new key appears in the table with its ID, name, and status.
Use the key with a Managed Inference endpoint
If your Managed Inference endpoint has Require Authorization header enabled, send this key as Authorization: Bearer <api-key> when you call it. See How to connect to a Managed Inference endpoint.