opendunes
Your account
Copy page ▾

Prompt and answer

GET /v1/generation/content answers the prompt and the answer of one request, where they were kept.

Request

Send it with an API keyAPI keyThe key you create and send with every request that calls a model.More on API keys →. The one field goes in the address, after ?. Only what was kept comes back: a key with storage off keeps nothing, and Files and storage says what each kind of request keeps. Receipt answers the same request's model, tokens and charge.

FieldNeededYou send
idyesthe receipt handle the answer carried in its X-Generation-Id header

You read only your own account's requests: any other id is a 404. The handle in each sample is an example of the shape; put the one your answer carried in its place.

A customer tells Souk Bot the picture it made of a kaftan came out wrong. Yacine reads that request back by its handle to see what was sent and what came out.

import json
import os
import urllib.request

API_KEY = os.environ["OPENDUNES_API_KEY"]
GENERATION_ID = "gen-3bhGkxlo4XFrqiabUM7NDtwDzWwG"
ADDRESS = "https://opendunes.com/v1/generation/content?id=" + GENERATION_ID

request = urllib.request.Request(
    ADDRESS,
    headers={"Authorization": "Bearer " + API_KEY},
)
with urllib.request.urlopen(request) as response:
    content = json.load(response)["data"]

print(content["output"]["files"])

Response

200 OK.

FieldHolds
datawhat was kept of the request
inputthe prompt: the text sent, or the list of messages; null where it was not kept
outputwhat came back
completionin output: the answer's text, or null where it was not kept
reasoningin output: the thinking the model wrote before it answered, or null
filesin output: the id of each file the request made and kept, a picture, a voice or a clip, read with GET /v1/files/{id}
errorwhy the request failed, where it failed and the failure was kept: its status and message; null when it succeeded

What it cost

Free. Reading what a request kept is never charged.

Errors

error.code carries the status, and error.message says why.

StatusWhen
400id is missing
401the key is missing, wrong, disabled or expired
403the key answers only from the addresses set on it, and this request came from another
404no request of your account carries this handle, or nothing of it was kept

Last modified on