Inserting Fcurves & keyframes with python; sharp handles?

I’m inserting a two keyframes to modify the influence of a “copy location” modifier from 0 to 1. If I do it manually, it all works as expected and I get a nice smooth ‘s’ shaped curve. However, if I insert it with the following code:

bpy.data.objects['Sphere.100'].animation_data.action.fcurves.new(data_path='constraints["Copy Location"].influence', index = 0)

bpy.data.objects['Sphere.100'].animation_data.action.fcurves[6].keyframe_points.add(2)

bpy.data.objects['Sphere.100'].animation_data.action.fcurves[6].keyframe_points[0].co = 1516, 0

bpy.data.objects['Sphere.100'].animation_data.action.fcurves[6].keyframe_points[1].co = 1698, .5

The curve has a sharp elbow at my first keyframe which causes the curve to bend backwards, so that when I hit the selected frame, my object “jumps”:

However, if I right-click the keyframe and drag a single frame and then back, the curve snaps correctly into shape like so:

Unfortunately can’t just right click and drag since I’m dealing with a few thousand o

[EDIT]

Found the API call I was looking for:

bpy.data.collections['My Collection'].objects[i].keyframe_points.insert(frame, value, options = set(), keyframe_type='KEYFRAME')

I can’t find the available options to set (or the syntax to do so, really the tougher one) but generally speaking this works and spawns a keyframe where I want it with sane handles.
[OLD POST]

Okay I dug a little deeper and realized I could adjust the handles through the api (duh) and that they were all ‘spawing’ at 0,0. The “semi-solution” I’m using is to manually move them to sane locations:

#keyframe at 1516, 0
bpy.data.objects['Sphere.100'].animation_data.action.fcurves[6].keyframe_points[0].handle_left[0] = 1500

bpy.data.objects['Sphere.100'].animation_data.action.fcurves[6].keyframe_points[0].handle_left[1] = 0

bpy.data.objects['Sphere.100'].animation_data.action.fcurves[6].keyframe_points[0].handle_right[0] = 1530

bpy.data.objects['Sphere.100'].animation_data.action.fcurves[6].keyframe_points[0].handle_right[1] = 0

#keyframe at 1698, 1
bpy.data.objects['Sphere.100'].animation_data.action.fcurves[6].keyframe_points[1].handle_left[0] = 1670

bpy.data.objects['Sphere.100'].animation_data.action.fcurves[6].keyframe_points[1].handle_left[1] = 1

bpy.data.objects['Sphere.100'].animation_data.action.fcurves[6].keyframe_points[1].handle_right[0] = 1710

bpy.data.objects['Sphere.100'].animation_data.action.fcurves[6].keyframe_points[1].handle_right[1] = 1

This solves the main issue and now my sphere moves as expected, but dang it’s ugly. It would be much nicer if the keyframes would spawn in with sane handles and I didn’t need 8 lines of code for it.