It's probably unbalanced.
Let's take a look at what other things allow you to gain hit points at first level:
- Cure Wounds (requires a spell slot and action, restores 1d8 + change).
- Healing Potion (costs 50 gp, requires an action, restores 2d4+2).
- Goodberry (requires a spell slot and action, restores 1 hp per action for 10 additional actions).
- Healing Word (requires a bonus action and spell slot, restores 1d4 + change).
- False Life (requires an action and spell slot, gives you 1d4 + change temporary hit points).
- A short rest (requires an hour of inactivity, costs your only hit die, restores about half your HP).
A cantrip that lets you use the same action to both make an attack and also heal up to 4 hp is certainly more powerful than any of these options for 1st level characters.
A cantrip that lets you heal for even 1 hp would be strictly superior to a Short Rest, so probably even that would unbalance the game a little.
As you've written this spell, it should be at least a 1st level spell.
As is, it is overpowered.
Replacing dice is a very strong feature, and the divination wizard signature.
Making this a 2nd level spell means any wizard can use it... and many will be able to abuse it.
Divination wizards can abuse it, starting level 6.
As wizards of the Divination School recover spell slots when casting divination spells, a 6th level wizard can spam this 9 times each day - and still get plenty of level 1 slots to keep casting.
It becomes even more silly at higher level ; at level 17, it means 46 uses per day, not even considering arcane recovery.
It gets worse at level 18, with Spell Mastery
Any wizard will be able to cast this at will. If you don't like the roll you just made, cast it again. You'll eventually roll high / low enough to auto-succeed any ability check, or ensure the guy you intend to charm to auto-fail.
Some solutions?
Option 1: don't homebrew a spell
Making this diviner unique feature a spell makes it available to anybody. It will feel less unique, and remove the spotlight from that subclass. You may prefer to homebrew a feat to allow more portent dice (1 or 2), or short rest recoveries (probably too much). It may be the good way to see it used more often.
Option 2: make it higher level
Bluemoon's 5th level is probably a good start - but depending on the class restrictions you have in mind, level 6 would be a good way to ensure no warlock ever gets to spam this on short rests, or diviners can't use recycled spell slots to cast it again.
Following that path, I'd advise you to change the upcasting ability to add more dice, instead of changing their results. A +3/-3 probably does not justify the use of a ninth-level slot, but 4 dice might.
The problem with this option, as pointed out by @Ben Barden, is that it removes access to the spell to low-level casters. You should probably look for other options.
Option 3: 1-round duration
If you like the idea of wizards spamming this (I do!) - limiting its duration is probably the way to go. If a PC wants to spend the entire fight predicting rolls for his allies - let him spend all his actions doing it.
If you choose this solution keeping it a 2nd level spell, you'll probably want to limit its use to combat rolls - barring ability checks, to avoid Spell Mastery out-of-combat shenanigans.
Best Answer
Elementals are immune to exhaustion.
Circle of the Moon druids can turn into elementals at level 10. Elementals have immunity to the effects of exhaustion.
The Beast Spells feature of Druids at level 18 allows casters to cast spells while in wild shape.
Example
Druid turns into a fire elemental. Being immune to the effects of exhaustion, the druid could cast extremely high level spells every single turn with no negative side effect. Before the druid leaves elemental form, an ally casts Greater Restoration on the druid, to lower the level of exhaustion from 6 to 5, so that the druid doesn't instantly die.