Skip to main content
OpenAIFastUltra

GPT-4o

OpenAI's flagship multimodal model. Industry-leading performance in reasoning, coding, and creative tasks with native vision capabilities and structured output support.

3 credits
per 1K tokens (avg)
Native multimodal (text + vision + audio)
128K context window
16K max output tokens
Function calling & JSON mode
Structured outputs
Image understanding & analysis

Use with AI Assistant

Copy usage instructions for Claude, ChatGPT, or other AI

llms.txt

Model Specifications

Context Window
128K
tokens
Max Output
16K
tokens
Training Cutoff
2023-10
Compatible SDK
OpenAI

Capabilities

Vision
Function Calling
Streaming
JSON Mode
System Prompt

Token Pricing (per 1M tokens)

Token TypeCreditsUSD Equivalent
Input Tokens2,500$2.50
Output Tokens10,000$10.00
Cached Tokens1,250$1.25

* 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-4o",
  "messages": [
    {
      "role": "system",
      "content": "You are a helpful assistant."
    },
    {
      "role": "user",
      "content": "Explain quantum computing in simple terms."
    }
  ],
  "temperature": 0.7,
  "max_tokens": 1000
}'

Parameters

ParameterTypeRequiredDefaultDescription
messagesarrayYes-Array of message objects with role and content
modelstringYesgpt-4oModel identifier
temperaturefloatNo1.0Sampling temperature (0-2). Lower = more focused, higher = more creative
max_tokensintegerNo4096Maximum tokens in response (up to 16384)
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

Basic Chat

Simple conversation with the model

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-4o",
  "messages": [
    {
      "role": "system",
      "content": "You are a helpful assistant."
    },
    {
      "role": "user",
      "content": "Explain quantum computing in simple terms."
    }
  ],
  "temperature": 0.7,
  "max_tokens": 1000
}'

Code Generation

Generate Python code with explanation

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-4o",
  "messages": [
    {
      "role": "system",
      "content": "You are an expert Python developer. Write clean, well-documented code."
    },
    {
      "role": "user",
      "content": "Write a Python class for a binary search tree with insert, search, and delete methods."
    }
  ],
  "temperature": 0.3,
  "max_tokens": 2000
}'

JSON Mode

Get structured JSON output

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-4o",
  "messages": [
    {
      "role": "system",
      "content": "You are a data extraction assistant. Always respond with valid JSON."
    },
    {
      "role": "user",
      "content": "Extract the following info from this text: 'John Smith, 35 years old, software engineer at Google, living in San Francisco'. Return as JSON with fields: name, age, job, company, city"
    }
  ],
  "response_format": {
    "type": "json_object"
  },
  "max_tokens": 500
}'

Vision Analysis

Analyze images with GPT-4o

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-4o",
  "messages": [
    {
      "role": "user",
      "content": [
        {
          "type": "text",
          "text": "What's in this image? Describe it in detail."
        },
        {
          "type": "image_url",
          "image_url": {
            "url": "https://example.com/image.jpg"
          }
        }
      ]
    }
  ],
  "max_tokens": 1000
}'

Function Calling

Use tools/functions with the model

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-4o",
  "messages": [
    {
      "role": "user",
      "content": "What's the weather like in Seoul today?"
    }
  ],
  "tools": [
    {
      "type": "function",
      "function": {
        "name": "get_weather",
        "description": "Get current weather for a location",
        "parameters": {
          "type": "object",
          "properties": {
            "location": {
              "type": "string",
              "description": "City name"
            },
            "unit": {
              "type": "string",
              "enum": [
                "celsius",
                "fahrenheit"
              ]
            }
          },
          "required": [
            "location"
          ]
        }
      }
    }
  ]
}'

Tips & Best Practices

1Use system messages to set behavior and constraints
2Lower temperature (0.1-0.3) for factual/coding tasks
3Higher temperature (0.7-1.0) for creative writing
4Enable JSON mode for structured data extraction
5Use function calling for tool integration
6Vision works with URLs or base64-encoded images
7Streaming reduces time-to-first-token significantly

Use Cases

Complex reasoning and analysis
Code generation and debugging
Content creation and editing
Data extraction from documents/images
Multi-step task automation
Customer support chatbots

Model Info

ProviderOpenAI
Version2024-11-20
CategoryLLM
Price3 credits

API Endpoint

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