Configuring the API Client
To begin, initialize your OpenAI client to use the C1 Artifacts endpoint and your Thesys API key. Artifact API Endpoint:https://api.thesys.dev/v1/artifact
You can create a new API key from Developer Console.
Structuring the Request
The API call’s payload has two main parts:messagesarray for your promptmetadataobject for C1-specific instructions.
The messages Array
This is where you provide the prompt to generate the artifact. The content of the user message can include rich context, like data or a detailed description of the desired output.
You can also include a system prompt to provide high-level instructions.
The metadata Object
This object provides C1-specific instructions for the generation. It must contain a thesys key, whose value is a stringified JSON object.
Inside the thesys object, the c1_artifact_type property tells C1 what kind of artifact to generate, for example 'slides' or 'report'.
Full Example: Generating Slides
This example brings the concepts together to generate a slide deck from a prompt. Theartifact variable in the response will contain the C1 DSL string, which is ready to be sent to your frontend for rendering.
src/app/api/generate-slides/route.ts