OpenAI's most capable model for coding and instruction following. Features a 1M token context window, 32K output tokens, and major improvements in coding, complex prompts, and long-context tasks. 20% cheaper than GPT-4o on output.
Copy usage instructions for Claude, ChatGPT, or other AI
| Token Type | Credits | USD Equivalent |
|---|---|---|
| Input Tokens | 2,000 | $2.00 |
| Output Tokens | 8,000 | $8.00 |
| Cached Tokens | 500 | $0.50 |
* 1 credit โ $0.001 (actual charges may vary based on usage)
curl -X POST "https://api.core.today/llm/openai/v1/chat/completions" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer cdt_your_api_key" \
-d '{
"model": "gpt-4.1",
"messages": [
{
"role": "system",
"content": "You are an expert code reviewer. Analyze the codebase and suggest improvements."
},
{
"role": "user",
"content": "Review this Python project and identify potential performance bottlenecks, security issues, and suggest refactoring opportunities."
}
],
"temperature": 0.3,
"max_tokens": 4000
}'| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
messages | array | Yes | - | Array of message objects with role and content |
model | string | Yes | gpt-4.1 | Model identifier |
temperature | float | No | 1.0 | Sampling temperature (0-2). Lower = more focused, higher = more creative |
max_tokens | integer | No | 4096 | Maximum tokens in response (up to 32768) |
stream | boolean | No | false | Enable Server-Sent Events streaming |
response_format | object | No | - | Format of response: { type: 'json_object' } for JSON mode |
tools | array | No | - | List of tools (functions) the model can call |
top_p | float | No | 1.0 | Nucleus sampling threshold (0-1) |
Analyze and refactor a large codebase with 1M context
curl -X POST "https://api.core.today/llm/openai/v1/chat/completions" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer cdt_your_api_key" \
-d '{
"model": "gpt-4.1",
"messages": [
{
"role": "system",
"content": "You are an expert code reviewer. Analyze the codebase and suggest improvements."
},
{
"role": "user",
"content": "Review this Python project and identify potential performance bottlenecks, security issues, and suggest refactoring opportunities."
}
],
"temperature": 0.3,
"max_tokens": 4000
}'Complex multi-step task with precise formatting
curl -X POST "https://api.core.today/llm/openai/v1/chat/completions" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer cdt_your_api_key" \
-d '{
"model": "gpt-4.1",
"messages": [
{
"role": "system",
"content": "Follow the user's instructions exactly. Format output as specified."
},
{
"role": "user",
"content": "Create a technical specification document with sections: Overview, Architecture, API Design, Security Considerations, and Deployment Plan. Use markdown headers and include code examples where relevant."
}
],
"temperature": 0.5,
"max_tokens": 8000
}'Extract structured data from unstructured text
curl -X POST "https://api.core.today/llm/openai/v1/chat/completions" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer cdt_your_api_key" \
-d '{
"model": "gpt-4.1",
"messages": [
{
"role": "system",
"content": "Extract structured data from the given text. Always respond with valid JSON."
},
{
"role": "user",
"content": "Parse this invoice: 'Invoice #2025-0342 from Acme Corp to Beta LLC, dated March 1 2025. Items: 10x Widget A at $25.00, 5x Widget B at $50.00. Tax: 10%. Shipping: $15.00'"
}
],
"response_format": {
"type": "json_object"
},
"max_tokens": 1000
}'POST /llm/openai/v1/chat/completions