Use Symfony with amazee.ai¶
Symfony is a Symfony bundle that configures your amazee.ai LLM and vector database credentials with a single console command. It handles email-based authentication against the amazee.ai API and writes the resulting environment variables to .env.local, so your Symfony AI integration is ready to use in minutes.
Pre-release
Symfony is not yet published on Packagist. Follow the Composer VCS setup below.
Prerequisites¶
- PHP 8.4+
- Symfony 8.0+
- An amazee.ai account — create one at my.amazee.io
Install¶
1. Add the repository to composer.json¶
Because the package is not yet on Packagist, add the VCS source first:
{
"repositories": [
{
"type": "vcs",
"url": "https://github.com/amazeeio/symfony-amazeeai-configure.git"
}
]
}
2. Require the bundle¶
3. Register the bundle¶
If you're using Symfony Flex, the bundle registers itself automatically. Otherwise add it to config/bundles.php:
Configure¶
Run the configure command with your amazee.ai account email:
php bin/console ai:amazee:configure user@example.com
# or with Symfony CLI:
symfony console ai:amazee:configure user@example.com
The command sends a PIN to your email. Enter it when prompted. On success, it writes the following to .env.local:
AMAZEEAI_LLM_KEY=sk-...
AMAZEEAI_LLM_API_URL=https://llm.[region].amazee.ai
AMAZEEAI_VDB_HOST=vectordb1.[region].amazee.ai
AMAZEEAI_VDB_PORT=5432
AMAZEEAI_VDB_NAME=db_abcd1234
AMAZEEAI_VDB_USER=user_abcd1234
AMAZEEAI_VDB_PASSWORD=...
AMAZEEAI_VDB_DSN="pgsql:host=${AMAZEEAI_VDB_HOST};port=${AMAZEEAI_VDB_PORT};dbname=${AMAZEEAI_VDB_NAME}"
Use the credentials¶
LLM requests¶
Point any OpenAI-compatible client at AMAZEEAI_LLM_API_URL/v1 with AMAZEEAI_LLM_KEY as the bearer token. For example, with Symfony's HTTP client:
$response = $httpClient->request('POST', $_ENV['AMAZEEAI_LLM_API_URL'] . '/v1/chat/completions', [
'auth_bearer' => $_ENV['AMAZEEAI_LLM_KEY'],
'json' => [
'model' => 'claude-sonnet-4-5',
'messages' => [['role' => 'user', 'content' => 'Hello']],
],
]);
See Available Models for the full model list.
Vector database¶
The AMAZEEAI_VDB_* variables connect to a managed pgvector instance provisioned with your account. Use them anywhere you'd configure a Postgres DSN — Doctrine, a vector search library, or direct PDO.
Secure credentials for production¶
AMAZEEAI_LLM_KEY and AMAZEEAI_VDB_PASSWORD are sensitive. Store them in Symfony secrets rather than committing .env.local:
Then reference them in .env:
AMAZEEAI_LLM_KEY=%env(secret:AMAZEEAI_LLM_KEY)%
AMAZEEAI_VDB_PASSWORD=%env(secret:AMAZEEAI_VDB_PASSWORD)%
Troubleshooting¶
- PIN email not received
- Check your spam folder. The PIN expires after a short window — re-run the configure command to request a new one.
composer requirefails — package not found- Confirm the
repositoriesentry is in your rootcomposer.json(not a nested package). Runcomposer clear-cacheand try again. - Bundle not loading
- If Symfony Flex didn't auto-register it, add
AmazeeAiConfigureBundletoconfig/bundles.phpmanually (see step 3 above). - Wrong region in the written URL
- The region is determined by your amazee.ai account. To change region, update your account at my.amazee.io and re-run the configure command.
- Auth errors on LLM requests
- Verify
AMAZEEAI_LLM_KEYis loaded in the current environment. For containerised apps, confirm the secret is injected at runtime rather than build time.