Authentication

Authenticate with Metaphori to start compressing documents and managing your API keys.

Register and Login

Interactive Registration

The easiest way to get started is with interactive registration:

metaphori register

This will guide you through the process of creating an account or logging in with your existing credentials.

Non-Interactive Registration

For CI/CD environments or automated setups:

metaphori register --email user@example.com --api-key mph-sk-xxxxx

Note: You'll need to create an API key first. Visit metaphori.ai/dashboard to generate one.

API Key Management

Update Existing API Key

If you need to update your API key (e.g., after rotation):

metaphori register --update-key

Creating API Keys

You can create API keys through the web dashboard or CLI:

Via Web Dashboard:

  1. Visit metaphori.ai/dashboard
  2. Navigate to API Keys section
  3. Click "Create New Key"
  4. Copy the generated key (starts with mph-sk-)

Via CLI (after initial auth):

metaphori auth api-key create

Environment Variables

You can set authentication credentials using environment variables:

API Key

export METAPHORI_API_KEY=mph-sk-xxxxx

This takes precedence over stored credentials.

Custom API URL

export METAPHORI_API_URL=https://custom.api.url

For enterprise or self-hosted deployments.

All Available Environment Variables

export METAPHORI_API_KEY=mph-sk-xxxxx
export METAPHORI_DEFAULT_MODEL=claude-3-5-sonnet
export METAPHORI_API_URL=https://custom.api.url
export METAPHORI_VERBOSE=true

Verifying Authentication

Check if you're properly authenticated:

metaphori config show api_key

Or check your usage to verify the connection:

metaphori usage

Security Best Practices

๐Ÿ” Keep Your API Key Secret

Never commit your API key to version control. Use environment variables or secure secret management.

๐Ÿ”„ Rotate Keys Regularly

Rotate your API keys periodically. You can create new keys and delete old ones from the dashboard.

๐ŸŽฏ Use Scoped Keys

For CI/CD, create keys with limited permissions specific to the operations needed.

Troubleshooting

Invalid API Key Error

Ensure your API key starts with mph-sk- and hasn't been revoked.

Authentication Failed

Try re-registering with metaphori register --update-key

Environment Variable Not Working

Ensure you've exported the variable (not just set it) and that there are no trailing spaces.

Ready to compress your first document?

Now that you're authenticated, let's create your first compression.

Continue to Compression Management โ†’