Skip to content

Use Symfony with InferFoundry

Symfony is a Symfony bundle that configures your InferFoundry LLM and vector database credentials with a single console command. It handles email-based authentication against the InferFoundry 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


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

composer require amazeeio/symfony-amazeeai-configure

3. Register the bundle

If you're using Symfony Flex, the bundle registers itself automatically. Otherwise add it to config/bundles.php:

return [
    // ...
    AmazeeIo\AmazeeAiConfigure\AmazeeAiConfigureBundle::class => ['all' => true],
];

Configure

Run the configure command with your InferFoundry 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://gateway.dev.if-service.ai

AMAZEEAI_VDB_HOST=vectordb.dev.if-service.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:

php bin/console secrets:set AMAZEEAI_LLM_KEY
php bin/console secrets:set AMAZEEAI_VDB_PASSWORD

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 require fails — package not found
Confirm the repositories entry is in your root composer.json (not a nested package). Run composer clear-cache and try again.
Bundle not loading
If Symfony Flex didn't auto-register it, add AmazeeAiConfigureBundle to config/bundles.php manually (see step 3 above).
Wrong region in the written URL
The region is determined by your InferFoundry account. To change region, update your account at portal.dev.if-service.ai and re-run the configure command.
Auth errors on LLM requests
Verify AMAZEEAI_LLM_KEY is loaded in the current environment. For containerised apps, confirm the secret is injected at runtime rather than build time.

Resources