How to use upload thing with only OpenAPI Specs?
I have tryed using upload thing with my Elysia/react app, with uploadthing but I was not successful to set it up. So I decided to use the OpenAPI spec by it self instead.
This is my current fetch request, but I do not know why I keep getting an error:
'''
fetch('https://uploadthing.com/api/prepareUpload', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-Uploadthing-Api-Key': Bun.env.MySecret,
'X-Uploadthing-Version': '6.4.0'
},
body: JSON.stringify({
callbackUrl: 'http://localhost:3000/upload-image2',
callbackSlug: 'upload-image2',
files: [{
name: 'userID.'+type,
size: 1,
}],
"routeConfig": [ image: { maxFileSize: "4MB",maxFileCount: 1, } ] ,
metadata: null
})
})
'''
'''
error:
{
"error": "Invalid request input",
"data": [
{
"code": "invalid_type",
"expected": "object",
"received": "string",
"path": [],
"message": "Expected object, received string"
}
]
}
'''
3 Replies
Which spec are you trying to use exactly? I don't see any references to the open AI api
In this case, I was trying to use the /prepareUpload OpenAPI to upload my own image to uploadthing, since I was not able to use the SDK. If I need to use an OpenAI reference, I would like to use the https://api.openai.com/v1/images/edits endpoint, to use the user's image as a base, and then upload the output from DALL-E-2 to uploadTHing
It may be easier to accomplish this using the openAI node SDK
the
image
key on the object below supports ReadStreams, FileObjects, and an ImageResponse type that seems to be specific to the original generate function