HeyPuter/puter · error · HttpError

internal_error

internal_error

Error message

OpenAI API key not configured

What it means

The OpenAI provider's client #openai is null when no key was found across the openai-speech-to-text, openai-completion, and openai config shapes (readKey checks apiKey/secret_key/api_key/key in each). On a real (non-test_mode, non-stream) transcribe/translate the provider throws 500 / internal_error. The provider registers even without a key (so its model catalogue stays listable), so the failure surfaces only at call time.

Source

Thrown at src/backend/drivers/ai-speech2txt/providers/openai/OpenAISpeechToTextProvider.ts:158

        if (args.test_mode) {
            return {
                ...SAMPLE_TRANSCRIPT,
                model:
                    args.model ||
                    (translate
                        ? DEFAULT_TRANSLATE_MODEL
                        : DEFAULT_TRANSCRIBE_MODEL),
            };
        }
        if (args.stream) {
            throw new HttpError(
                400,
                'Streaming transcription is not yet supported',
                { legacyCode: 'bad_request' },
            );
        }
        if (!this.#openai)
            throw new HttpError(500, 'OpenAI API key not configured', {
                legacyCode: 'internal_error',
            });
        this.requireFile(args);

        const actor = this.requireActor();

        const loaded = await loadFileInput(
            this.deps.stores,
            this.deps.fs,
            actor,
            args.file,
            { maxBytes: MAX_AUDIO_FILE_SIZE, acceptWebInput: true },
        );

        const selectedModel =
            args.model ||
            (translate ? DEFAULT_TRANSLATE_MODEL : DEFAULT_TRANSCRIBE_MODEL);
        const caps = MODEL_CAPS[selectedModel];

View on GitHub (pinned to 908ec23eda)

Solutions

  1. Set providers.openai.apiKey (or openai-completion.apiKey / openai-speech-to-text.apiKey) and restart.
  2. Call with test_mode: true until configured to verify the path end-to-end.
  3. Route the call to a configured provider (e.g. xai) instead.

Example fix

// config.json
// before
"providers": { "openai": {} }
// after
"providers": { "openai": { "apiKey": "sk-..." } }
Defensive patterns

Strategy: validation

Validate before calling

// probe the path without spending credits
await driver.transcribe({ ...args, test_mode: true });
// a successful test call followed by a 500 on the real call means the key is missing

Try / catch

try {
  await driver.transcribe(args);
} catch (e) {
  if (e?.legacyCode === 'internal_error' && /OpenAI API key not configured/.test(e?.message ?? '')) {
    showProviderUnavailable('openai'); // or fall back to xai
  } else throw e;
}

Prevention

When it happens

Trigger: Any real STT call to the openai provider on a deployment with no OpenAI key in any of the three config shapes; a deployment whose only OpenAI config is under an unrecognized key name.

Common situations: Self-hosted Puter without OpenAI credentials; key under openai-completion.apiKey that is also missing; operator assumed listing models meant the provider was usable.

Related errors


AI-assisted analysis of HeyPuter/puter@908ec23eda (2026-08-12). Data as JSON: /api/errors/1a5c74821db24c4c. Report an issue: GitHub.