Skip to main content
OpenAIFastUltra

GPT-4.1

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.

3 credits
per 1K tokens (avg)
1M token context window
32K max output tokens
Best-in-class coding performance
Superior instruction following
Native vision (text + image)
Function calling & JSON mode
Structured outputs

Use with AI Assistant

Copy usage instructions for Claude, ChatGPT, or other AI

llms.txt

Model Specifications

Context Window
1.0M
tokens
Max Output
33K
tokens
Training Cutoff
2024-05
Compatible SDK
OpenAI

Capabilities

Vision
Function Calling
Streaming
JSON Mode
System Prompt

Token Pricing (per 1M tokens)

Token TypeCreditsUSD Equivalent
Input Tokens2,000$2.00
Output Tokens8,000$8.00
Cached Tokens500$0.50

* 1 credit โ‰ˆ $0.001 (actual charges may vary based on usage)

Quick Start

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
}'

Parameters

ParameterTypeRequiredDefaultDescription
messagesarrayYes-Array of message objects with role and content
modelstringYesgpt-4.1Model identifier
temperaturefloatNo1.0Sampling temperature (0-2). Lower = more focused, higher = more creative
max_tokensintegerNo4096Maximum tokens in response (up to 32768)
streambooleanNofalseEnable Server-Sent Events streaming
response_formatobjectNo-Format of response: { type: 'json_object' } for JSON mode
toolsarrayNo-List of tools (functions) the model can call
top_pfloatNo1.0Nucleus sampling threshold (0-1)

Examples

Long Code Analysis

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
}'

Instruction Following

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
}'

JSON Data Extraction

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
}'

Tips & Best Practices

1Excels at coding tasks โ€” use for code generation, review, and debugging
21M context window ideal for analyzing entire codebases or long documents
3Best instruction following among OpenAI models โ€” great for complex prompts
4Use lower temperature (0.1-0.3) for coding and factual tasks
520% cheaper than GPT-4o for output tokens
6Vision works with URLs or base64-encoded images
7Streaming reduces time-to-first-token significantly

Use Cases

Large codebase analysis and generation
Complex multi-step instruction following
Long document summarization and analysis
Data extraction from documents/images
Agentic workflows and tool use
Enterprise content processing

Model Info

ProviderOpenAI
Version2025-04-14
CategoryLLM
Price3 credits

API Endpoint

POST /llm/openai/v1/chat/completions
Try in PlaygroundBack to Docs