Skip to content

Code Preview

use this API to get a quick preview for AI Coding codes.

Get Preview URL

get preview url for given codes

Request Example

curl -X POST "https://x-api.trys.ai/v1/code-preview" \
-H "Authorization: Bearer <API_KEY>" \
-H "Content-Type: application/json" \
-d '{}'

Request Body Examples

  • react component preview
{
"project_template": "react",
"project_dependencies": {
"lucide-react": "0.475.0",
"react": "18.2.0"
},
"project_codes": [
{
"file_path": "/components/PodcastGenerator.jsx",
"file_content": "export default function PodcastGenerator() { return <div>Podcast Generator</div> }"
}
]
}
  • vue component preview
{
"project_template": "vue",
"project_dependencies": {
"moment": "2.29.4",
"zod": "3.22.4"
},
"project_codes": [
{
"file_path": "/components/Hero.vue",
"file_content": "<template> <div>Hero Component</div> </template>"
}
]
}
  • html preview
{
"project_template": "html",
"project_codes": [
{
"file_path": "/index.html",
"file_content": "<html> <body> <h1>Hello, World!</h1> </body> </html>"
},
{
"file_path": "/about.html",
"file_content": "<html> <body> <h1>About</h1> </body> </html>"
},
{
"file_path": "/styles.css",
"file_content": "h1 { color: red; }"
},
{
"file_path": "/script.js",
"file_content": "console.log('Hello, World!');"
}
]
}

Response Example

{
"preview_url": "https://xxx.shipany.codes"
}