The code models are a ngspice entity. Currently they are not actively supported by KiCad. So you have to take care about them yourself.
The code models are not descriptions of readily available ICs, but are circuit blocks to create simple or complex circuits. So there will be no direct support via footprints or designing them into PCBs (the main task of KiCad). But code models migt be used for example to describe the venerable digital series of 74… ICs. These models of course then will support using real devices with footprints etc. This has already been discussed here somewhere, but nobody yet has taken the job.
You may also use KiCad/Eeschema to develop new circuits by simulation and thus use Eeschema as an schematic entry tool for ngspice. Here you might very well use code models, as circuit block with their own symbol per code model, but also combined as a larger circuit under the hood of a more complex symbol.
A typical way to do so would need the following steps:
Put the code model instance (the a… line) and its associated .model line into a ngspice subcircuit.
Save this subcircuit in a file (e.g. mycm.lib).
Create a symbol with appropriate pins. The symbol pins have to comply with the subcircuit nodes (quantity and sequence). The subcircuit nodes have to be connected to the code model nodes inside of the subcircuit.
Place the symbol onto your Eeschema drawing sheet. Link the model (the mycm.lib file) to the symbol via the ‘Edit Spice Model’ page.
You may start with one of the existing code models, e.g. the gain block, which has 2 pins (in and out) only. A subcircuit may look like this (not tested, see ngspice manual 2.4 and 12.2.1):
.subckt gain1 in out
a1 in out amp
.model amp gain (in_offset=0.1 gain=5.0 out_offset=-0.01)
To make use of this gain block, you will need to use (or make) an eeschema symbol with 2 pins (pin 1 for in, pin 2 for out). When you then add a (ngspice) voltage source at the input and a load resistor at the output, you may start your simulations.
Finally the subcircuit may contain your own code models, or a more complex circuit assmbly. The following example is an up-down counter, made from a digital state-machine code model (manual 12.4.18), but having analog inputs and outputs. It stems from Is binary counter Spice model available?, modified a little bit. However, I have never created a symbol for this circuit, but the colleagues at the other thread did. You may run this circuit with standard ngspice by calling ‘ngspice state-machine3b-count2.cir’. Or create a symbol and attach the subciruit model via counter.lib.
counter.lib (816 Bytes) state-3bit-count.in (537 Bytes) state-machine-3b-count2.cir (449 Bytes)