# GPT-4o - Core.Today AI API > OpenAI's flagship multimodal model. Industry-leading performance in reasoning, coding, and creative tasks with native vision capabilities and structured output support. - **Provider**: OpenAI - **Model ID**: gpt-4o - **Category**: LLM - **Credits**: 3 per 1K tokens (avg) - **Speed**: Fast - **Quality**: Ultra ## Model Specifications - **Context Window**: 128K tokens - **Max Output**: 16K tokens - **Training Cutoff**: 2023-10 - **Supported Formats**: text, json, markdown - **Compatible SDK**: OpenAI ### Capabilities - Vision (image input) - Function Calling - Streaming - JSON Mode - System Prompt ### Token Pricing (per 1M tokens) - **Input Tokens**: 4,645 credits ($3.10) - **Output Tokens**: 18,580 credits ($12.39) - **Cached Tokens**: 2,322.5 credits ($1.55) ## Features - Native multimodal (text + vision + audio) - 128K context window - 16K max output tokens - Function calling & JSON mode - Structured outputs - Image understanding & analysis ## 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 ## API Endpoint Base URL: https://api.core.today Endpoint: POST /llm/openai/v1/chat/completions ## Authentication Header: Authorization: Bearer YOUR_API_KEY Note: LLM endpoints use OpenAI-compatible format with Authorization Bearer token. ## Input Parameters ### Required - **messages**: array - Array of message objects with role and content - **model**: string (default: gpt-4o) - Model identifier ### Optional - **temperature**: float (default: 1.0) - Sampling temperature (0-2). Lower = more focused, higher = more creative - **max_tokens**: integer (default: 4096) - Maximum tokens in response (up to 16384) - **stream**: boolean (default: false) - Enable Server-Sent Events streaming - **response_format**: object - Format of response: { type: 'json_object' } for JSON mode - **tools**: array - List of tools (functions) the model can call - **top_p**: float (default: 1.0) - Nucleus sampling threshold (0-1) ## Examples ### Basic Chat Simple conversation with the model ```json { "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 ```json { "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 ```json { "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 ```json { "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 ```json { "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" ] } } } ] } ``` ## Response Format ```json { "id": "chatcmpl-abc123", "object": "chat.completion", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "Response text here" }, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 100, "completion_tokens": 50, "total_tokens": 150 } } ``` ## Tips - Use system messages to set behavior and constraints - Lower temperature (0.1-0.3) for factual/coding tasks - Higher temperature (0.7-1.0) for creative writing - Enable JSON mode for structured data extraction - Use function calling for tool integration - Vision works with URLs or base64-encoded images - Streaming reduces time-to-first-token significantly ## Documentation https://platform.openai.com/docs/models/gpt-4o