Skip to main content

Module api_keys_api

Module api_keys_api 

Source
Expand description

API Keys Management Endpoints

Provides REST endpoints for managing API keys:

  • Save/update HuggingFace and OpenRouter keys (encrypted with machine-specific key, stored in SQLite)
  • Retrieve keys (plaintext - decrypted using machine-specific key)
  • Delete keys
  • Mark keys as used with mode tracking

Encryption/decryption is handled entirely inside ApiKeysStore. This layer only deals with plain-text values.

Structs§

GetAllApiKeysResponse
Response carrying all API keys.
GetApiKeyResponse
Response carrying a single API key value + metadata.
MarkKeyUsedRequest
POST /api-keys/mark-used — record that a key was used with a given mode.
SaveApiKeyRequest
Request body for saving or updating an API key.
SaveApiKeyResponse
Confirmation after saving an API key.
VerifyApiKeyRequest
Request body for verifying an API key.
VerifyApiKeyResponse
Response for API key verification.

Functions§

delete_api_key
DELETE /api-keys?key_type=<type> — delete an API key from storage.
get_all_api_keys
GET /api-keys/all — retrieve all API keys with their plaintext values.
get_api_key
GET /api-keys?key_type=<type> — retrieve a single API key (plaintext).
mark_key_used
save_api_key
POST /api-keys — save or update an API key.
verify_api_key
POST /api-keys/verify — verify an API key by calling the provider’s API.