PromptRails

Credentials

Manage credentials for LLM providers, media providers, data warehouses, and external tools securely.

Credentials

Credentials store the API keys, connection strings, and secrets needed to connect to LLM providers, databases, and external services. All credential values are encrypted at rest and are never exposed in API responses.

Credential Categories

Credentials are organized into six categories:

LLM Credentials

Connect to LLM providers for prompt execution and agent orchestration.

ProviderType IdentifierDescription
OpenAIopenaiGPT-4, GPT-4o, GPT-3.5, etc.
AnthropicanthropicClaude 3.5, Claude 3, etc.
Google GeminigeminiGemini Pro, Gemini Ultra, etc.
DeepSeekdeepseekDeepSeek chat and code models
FireworksfireworksFireworks AI hosted models
xAIxaiGrok models
OpenRouteropenrouterMulti-provider routing
Together AItogether_aiTogether AI hosted models
MistralmistralMistral AI models
CoherecohereCohere command and embed models
GroqgroqGroq high-speed inference
PerplexityperplexitySearch-augmented Sonar models

Speech Credentials

Connect to speech providers for text-to-speech and speech-to-text.

ProviderType IdentifierDescription
ElevenLabselevenlabsHigh-quality TTS voices
DeepgramdeepgramTTS and STT with Nova models
OpenAI Audioopenai_audioOpenAI TTS (tts-1) and Whisper STT

Image Credentials

Connect to image generation and editing providers.

ProviderType IdentifierDescription
FalfalFast image generation (FLUX, SD)
ReplicatereplicateRun open-source models
Stability AIstabilityStable Diffusion models
OpenAI Imageopenai_imageDALL-E 3 and DALL-E 2

Video Credentials

Connect to video generation providers.

ProviderType IdentifierDescription
RunwayrunwayGen-3 Alpha video generation
PikapikaAI video generation
LumalumaDream Machine video generation

Data Warehouse Credentials

Connect to databases for data source queries.

DatabaseType IdentifierDescription
PostgreSQLpostgresqlPostgreSQL connection string
MySQLmysqlMySQL connection string
BigQuerybigqueryGoogle BigQuery service account
SnowflakesnowflakeSnowflake account credentials
RedshiftredshiftAmazon Redshift connection
MSSQLmssqlMicrosoft SQL Server
ClickHouseclickhouseClickHouse connection
Static Filestatic_fileFile-based data access

Tool Credentials

Credentials for external APIs and services used by MCP tools.

TypeDescription
api_keyGeneric API key authentication
oauthOAuth token-based authentication
databaseGeneric database connection (with schema_type required)
smtpSMTP server credentials

Creating Credentials

Python SDK

# LLM credential
credential = client.credentials.create(
    name="OpenAI Production",
    category="llm",
    type="openai",
    value="sk-proj-your-openai-api-key",
    description="Production OpenAI API key"
)
 
# Data warehouse credential
db_credential = client.credentials.create(
    name="Analytics Database",
    category="data_warehouse",
    type="postgresql",
    value="postgresql://user:password@host:5432/analytics",
    description="Read-only analytics database"
)
 
# Speech credential
speech_credential = client.credentials.create(
    name="ElevenLabs Production",
    category="speech",
    type="elevenlabs",
    value="your-elevenlabs-api-key",
    description="ElevenLabs TTS API key"
)
 
# Tool credential
tool_credential = client.credentials.create(
    name="Slack Bot Token",
    category="tools",
    type="api_key",
    value="xoxb-your-slack-bot-token",
    description="Slack bot for notifications"
)

JavaScript SDK

const credential = await client.credentials.create({
  name: 'OpenAI Production',
  category: 'llm',
  type: 'openai',
  value: 'sk-proj-your-openai-api-key',
  description: 'Production OpenAI API key',
})

Default Credentials

You can mark one credential per type as the default. Default credentials are automatically used when no specific credential is specified:

client.credentials.set_default(credential_id="your-credential-id")

When an agent or prompt references a model from a provider (e.g., OpenAI), PromptRails uses the default credential for that provider type unless overridden.

Connection Validation

Validate that a credential can successfully connect to its target service:

result = client.credentials.validate(credential_id="your-credential-id")
print(f"Valid: {result['data']['is_valid']}")

Validation checks vary by credential type:

  • LLM credentials: Makes a lightweight API call to verify the key
  • Database credentials: Attempts a connection and basic query
  • Tool credentials: Depends on the tool configuration

Schema Discovery

For data warehouse credentials, PromptRails can discover the database schema (tables, columns, types):

# Trigger schema discovery
client.credentials.discover_schema(credential_id="your-credential-id")
 
# Get the discovered schema
credential = client.credentials.get(credential_id="your-credential-id")
if credential["data"]["has_schema"]:
    print(f"Schema updated: {credential['data']['schema_updated_at']}")

The discovered schema includes:

  • Table names
  • Column names and data types
  • Nullability
  • Default values
  • Descriptions (where available)

This schema information helps agents understand the database structure when constructing queries.

Credential Response

API responses include a safe representation of credentials (never the raw value):

FieldDescription
idUnique credential identifier
nameDisplay name
typeProvider or database type
categoryllm, speech, image, video, data_warehouse, or tools
descriptionOptional description
masked_contentMasked credential value (e.g., sk-pr...abcd)
is_defaultWhether this is the default for its type
is_validWhether the last validation check passed
has_schemaWhether schema information is available
schema_updated_atWhen the schema was last discovered
created_atCreation timestamp
updated_atLast update timestamp

Updating Credentials

When you update a credential, the new value is encrypted and stored. The previous value cannot be recovered.

client.credentials.update(
    credential_id="your-credential-id",
    value="new-api-key-value",
    name="Updated Name"
)

Deleting Credentials

Credentials are soft-deleted. Deleting a credential does not affect historical execution traces but will prevent future use.

client.credentials.delete(credential_id="your-credential-id")