Skip to main content

Code Generator

Generate code and programming solutions using various AI models through the 1min.AI API. This endpoint helps you create code snippets, complete functions, and get programming solutions for different languages and frameworks.

Available Models

Loading available models...

Request Parameters

All models share the same request structure:

Field NameTypeSupported ValueDescriptionRequired
typetextCODE_GENERATORFeature name✔️
modeltextSee available modelsModel identifier✔️
conversationIdtextA conversation uuidConversation to continue. Omit it for a one-off request
promptObject.promptstringAny textCode generation prompt✔️
promptObject.webSearchbooleantrue, falseEnable web search for additional context
promptObject.numOfSitenumber1-10Number of websites to search❌*
promptObject.maxWordnumber100-10000Maximum words per website❌*

Endpoint

Request Headers

FieldValue
API-KEY<api-key>
Content-Typeapplication/json

Create a Conversation for History

conversationId is optional. Leave it out and each request is answered on its own, with no memory of earlier ones.

To carry context across several requests, create a conversation first and pass the returned uuid as conversationId. It must be that uuid — the feature name is not a conversation ID.

ParameterTypeRequiredDescription
typestring✔️Conversation type. Must be CODE_GENERATOR
titlestring✔️Conversation title

Code Example

curl --location 'https://api.1min.ai/api/features' \
--header 'API-KEY: <api-key>' \
--header 'Content-Type: application/json' \
--data '{
"type": "CODE_GENERATOR",
"model": "gpt-4o",
"promptObject": {
"prompt": "Create a Python function to calculate the factorial of a number recursively",
"webSearch": false
}
}'

Interactive Playground

Try the API directly in your browser:

Loading interactive playground...

Response Format

{
"aiRecord": {
"uuid": "29a3d3f4-ef1e-4a16-abd9-7353c8e67339",
"userId": "713799b5-99a2-48fe-a65c-a1931b0fe65c",
"teamId": "611ebc65-af0a-4c6b-840f-ec799e1dd59b",
"teamUser": {
"teamId": "611ebc65-af0a-4c6b-840f-ec799e1dd59b",
"userId": "713799b5-99a2-48fe-a65c-a1931b0fe65c",
"userName": "1minAI",
"userAvatar": "images/2025_11_08_10_11_10_062_-422A-922E-280DEBAD7645-13404-00000366E99213C1.jpg",
"status": "ACTIVE",
"role": "ADMIN",
"creditLimit": 100000000,
"usedCredit": 25651707,
"createdAt": "2025-07-09T00:56:06.932Z",
"createdBy": "SYSTEM",
"updatedAt": "2025-12-19T07:31:07.931Z",
"updatedBy": "SYSTEM"
},
"model": "gpt-4o",
"type": "CODE_GENERATOR",
"metadata": null,
"rating": null,
"feedback": null,
"conversationId": null,
"status": "SUCCESS",
"createdAt": "2025-12-19T07:51:59.860Z",
"aiRecordDetail": {
"promptObject": {
"prompt": "User query: Create a Python function to calculate the factorial of a number recursively",
"maxWord": 1000,
"numOfSite": 3,
"webSearch": false,
"originalContent": "Create a Python function to calculate the factorial of a number recursively"
},
"resultObject": [
"Here's a Python function to calculate the factorial of a number recursively:..."
],
"responseObject": {}
},
"additionalData": null,
"temporaryUrl": ""
}
}