user128655: When a user sets up their Trezor hardware wallet to store bitcoin, does the wallet always create the first account at index 0? Is it possible for a user to generate an account at subsequent indices if there are no funds at the previous index? (i.e. a user creates an account at index 1 without having created an account at index 0)
For context, I'm working on a project that integrates with the Trezor Connect API and I want the user to be able to query their bitcoin balance from the accounts on their hardware wallet.
EDIT: For clarity, I'm referring to the account and not the addresses derived from that account. The Trezor Suite does not seem to allow subsequent accounts to be generated if a previous one is empty as shown in this screenshot but my goal is to be able to calculate the balance of all or some of a user's bitcoin accounts so I would need to know at which point to stop looking for new accounts.

user26873: 
does the wallet always create the first account at index 0?

Yes, the wallet derivation path defaults are declared in the trezor suite wallet source code. https://github.com/trezor/trezor-suite/blob/5377ec9e20d5e37951db2ad4a8bbeca437ed8d69/packages/suite/src/utils/wallet/coinmarket/coinmarketUtils.ts#L115
{
    name: 'Bitcoin (legacy)',
    networkType: 'bitcoin',
    accountType: 'legacy',
    symbol: 'btc',
    bip44: "m/44'/0'/i'",
    decimals: 8,
    explorer: {
        tx: 'https://btc1.trezor.io/tx/',
        account: 'https://btc1.trezor.io/xpub/',
    },
    features: ['rbf', 'sign-verify'],
},
    

const result = await TrezorConnect.getAddress({
    device,
    coin: legacy.symbol,
    path: `${legacy.bip44.replace('i', '0')}/0/0`,
    useEmptyPassphrase: device.useEmptyPassphrase,
    showOnTrezor: false,
});
if (result.success) {
    return result.payload.address;
}


Is it possible for a user to generate an account at subsequent indices
if there are no funds at the previous index?

Yes, under the receive tab of the wallet. Although it shows index 0 by default, there's a "+ More Addresses" button the users could click on and send BTC to a higher index prior to receiving anything at index 0. A user going too far ahead of the index on their own doing can complicate the way an HD wallet works due to look-ahead gaps. See https://bitcoin.stackexchange.com/a/54664/26873

128655: <p>When a user sets up their Trezor hardware wallet to store bitcoin, does the wallet always create the first account at index 0? Is it possible for a user to generate an account at subsequent indices if there are no funds at the previous index? (i.e. a user creates an account at index 1 without having created an account at index 0)</p>
<p>For context, I'm working on a project that integrates with the Trezor Connect API and I want the user to be able to query their bitcoin balance from the accounts on their hardware wallet.</p>
<p>EDIT: For clarity, I'm referring to the <strong>account</strong> and not the addresses derived from that account. The Trezor Suite does not seem to allow subsequent accounts to be generated if a previous one is empty as shown in <a href="https://imgur.com/a/6aGi9aU" rel="nofollow noreferrer">this screenshot</a> but my goal is to be able to calculate the balance of all or some of a user's bitcoin accounts so I would need to know at which point to stop looking for new accounts.</p>
 26873: <blockquote>
<p>does the wallet always create the first account at index 0?</p>
</blockquote>
<p>Yes, the wallet derivation path defaults are declared in the trezor suite wallet source code. <a href="https://github.com/trezor/trezor-suite/blob/5377ec9e20d5e37951db2ad4a8bbeca437ed8d69/packages/suite/src/utils/wallet/coinmarket/coinmarketUtils.ts#L115" rel="nofollow noreferrer">https://github.com/trezor/trezor-suite/blob/5377ec9e20d5e37951db2ad4a8bbeca437ed8d69/packages/suite/src/utils/wallet/coinmarket/coinmarketUtils.ts#L115</a></p>
<pre><code>{
    name: 'Bitcoin (legacy)',
    networkType: 'bitcoin',
    accountType: 'legacy',
    symbol: 'btc',
    bip44: &quot;m/44'/0'/i'&quot;,
    decimals: 8,
    explorer: {
        tx: 'https://btc1.trezor.io/tx/',
        account: 'https://btc1.trezor.io/xpub/',
    },
    features: ['rbf', 'sign-verify'],
},
    

const result = await TrezorConnect.getAddress({
    device,
    coin: legacy.symbol,
    path: `${legacy.bip44.replace('i', '0')}/0/0`,
    useEmptyPassphrase: device.useEmptyPassphrase,
    showOnTrezor: false,
});
if (result.success) {
    return result.payload.address;
}
</code></pre>
<blockquote>
<p>Is it possible for a user to generate an account at subsequent indices
if there are no funds at the previous index?</p>
</blockquote>
<p>Yes, under the receive tab of the wallet. Although it shows index 0 by default, there's a &quot;+ More Addresses&quot; button the users could click on and send BTC to a higher index prior to receiving anything at index 0. A user going too far ahead of the index on their own doing can complicate the way an HD wallet works due to look-ahead gaps. See <a href="https://bitcoin.stackexchange.com/a/54664/26873">https://bitcoin.stackexchange.com/a/54664/26873</a></p>
