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 Name | Type | Supported Value | Description | Required |
|---|---|---|---|---|
| type | text | CODE_GENERATOR | Feature name | ✔️ |
| model | text | See available models | Model identifier | ✔️ |
| conversationId | text | A conversation uuid | Conversation to continue. Omit it for a one-off request | ❌ |
| promptObject.prompt | string | Any text | Code generation prompt | ✔️ |
| promptObject.webSearch | boolean | true, false | Enable web search for additional context | ❌ |
| promptObject.numOfSite | number | 1-10 | Number of websites to search | ❌* |
| promptObject.maxWord | number | 100-10000 | Maximum words per website | ❌* |
Endpoint
Request Headers
| Field | Value |
|---|---|
| API-KEY | <api-key> |
| Content-Type | application/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.
| Parameter | Type | Required | Description |
|---|---|---|---|
type | string | ✔️ | Conversation type. Must be CODE_GENERATOR |
title | string | ✔️ | Conversation title |
Code Example
- cURL
- JavaScript
- Python
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
}
}'
fetch('https://api.1min.ai/api/features', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'API-KEY': 'YOUR_API_KEY'
},
body: JSON.stringify({
type: 'CODE_GENERATOR',
model: 'gpt-4o',
promptObject: {
prompt: 'Create a Python function to calculate the factorial of a number recursively',
webSearch: false
}
})
})
import requests
url = "https://api.1min.ai/api/features"
headers = {
"Content-Type": "application/json",
"API-KEY": "YOUR_API_KEY"
}
data = {
"type": "CODE_GENERATOR",
"model": "gpt-4o",
"promptObject": {
"prompt": "Create a Python function to calculate the factorial of a number recursively",
"webSearch": False
}
}
response = requests.post(url, headers=headers, json=data)
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": ""
}
}