### Create Project User Response Example Source: https://developers.openai.com/api/reference/resources/admin/subresources/organization/subresources/projects/subresources/users/methods/create This is an example of the JSON response received after successfully creating a project user. ```json { "object": "organization.project.user", "id": "user_abc", "email": "user@example.com", "role": "owner", "added_at": 1711471533 } ``` -------------------------------- ### Create Upload Part Response Example Source: https://developers.openai.com/api/reference/resources/uploads/subresources/parts/methods/create This example shows the JSON response received after successfully creating an upload part. ```json { "id": "part_def456", "object": "upload.part", "created_at": 1719185911, "upload_id": "upload_abc123" } ``` -------------------------------- ### Compact response example Source: https://developers.openai.com/api/reference/resources/responses/methods/compact This is an example of a successful response from the compact endpoint. It includes the original input and the compacted output. ```json { "id": "resp_001", "object": "response.compaction", "created_at": 1764967971, "output": [ { "id": "msg_000", "type": "message", "status": "completed", "content": [ { "type": "input_text", "text": "Create a simple landing page for a dog petting cafe." } ], "role": "user" }, { "id": "cmp_001", "type": "compaction", "encrypted_content": "gAAAAABpM0Yj-...=" } ], "usage": { "input_tokens": 139, "input_tokens_details": { "cached_tokens": 0 }, "output_tokens": 438, "output_tokens_details": { "reasoning_tokens": 64 }, "total_tokens": 577 } } ``` -------------------------------- ### List Skill Versions Response Example Source: https://developers.openai.com/api/reference/resources/skills/subresources/versions/methods/list This is an example of a successful response when listing skill versions. It includes a list of skill version objects. ```json { "data": [ { "id": "id", "created_at": 0, "description": "description", "name": "name", "object": "skill.version", "skill_id": "skill_id", "version": "version" } ], "first_id": "first_id", "has_more": true, "last_id": "last_id", "object": "list" } ``` -------------------------------- ### Example Run Response Source: https://developers.openai.com/api/reference/resources/evals/subresources/runs/methods/retrieve This is an example of a successful response when retrieving run data. It includes details about the model, sampling parameters, and error status. ```json { "id": "run_abc123", "thread_id": "thread_xyz789", "model": "gpt-4o-mini", "created_at": 1677652000, "expires_at": 1677655600, "started_at": 1677652005, "completed_at": 1677652010, "failed_at": null, "cancelled_at": null, "last_error": null, "model_version": "02272024", "usage_tokens": { "prompt_tokens": 100, "completion_tokens": 50, "total_tokens": 150 }, "status": "completed", "optimizer_options": { "optimizer_type": "PROBABILISTIC_CODE_INTERPRETER", "temperature": 1.0, "top_p": 1.0, "seed": 42 }, "required_action": null, "incomplete_details": null, "run_steps": { "object": "list", "data": [ { "id": "step_abc123", "object": "thread.run.step", "created_at": 1677652005, "run_id": "run_abc123", "assistant_id": "asst_abc123", "thread_id": "thread_xyz789", "type": "message_creation", "status": "succeeded", "started_at": 1677652005, "completed_at": 1677652008, "step_details": { "type": "message_creation", "message_creation": { "message_id": "msg_abc123" } }, "usage": { "prompt_tokens": 10, "completion_tokens": 20, "total_tokens": 30 }, "next_step_details": null } ], "first_id": "step_abc123", "last_id": "step_abc123", "has_more": false }, "messages": { "object": "list", "data": [ { "id": "msg_abc123", "object": "thread.message", "created_at": 1677652008, "thread_id": "thread_xyz789", "role": "assistant", "content": [ { "type": "text", "text": { "value": "Hello! How can I help you today?", "annotations": [] } } ], "file_ids": [], "assistant_id": "asst_abc123", "run_id": "run_abc123", "add_tool_code_interpreter_outputs": null } ], "first_id": "msg_abc123", "last_id": "msg_abc123", "has_more": false } } ``` -------------------------------- ### List Batches Response Example Source: https://developers.openai.com/api/reference/resources/batches/methods/list This is an example of the JSON response when listing batches. It includes details for each batch, such as ID, status, and file IDs. ```json { "object": "list", "data": [ { "id": "batch_abc123", "object": "batch", "endpoint": "/v1/chat/completions", "errors": null, "input_file_id": "file-abc123", "completion_window": "24h", "status": "completed", "output_file_id": "file-cvaTdG", "error_file_id": "file-HOWS94", "created_at": 1711471533, "in_progress_at": 1711471538, "expires_at": 1711557933, "finalizing_at": 1711493133, "completed_at": 1711493163, "failed_at": null, "expired_at": null, "cancelling_at": null, "cancelled_at": null, "request_counts": { "total": 100, "completed": 95, "failed": 5 }, "metadata": { "customer_id": "user_123456789", "batch_description": "Nightly job", } }, { ... }, ], "first_id": "batch_abc123", "last_id": "batch_abc456", "has_more": true } ``` -------------------------------- ### List Invites Response Example Source: https://developers.openai.com/api/reference/resources/admin/subresources/organization/subresources/invites/methods/list This is an example of the JSON response when listing organization invites. It includes details about the invite, its status, and pagination information. ```json { "object": "list", "data": [ { "object": "organization.invite", "id": "invite-abc", "email": "user@example.com", "role": "owner", "status": "accepted", "created_at": 1711471533, "expires_at": 1711471533, "accepted_at": 1711471533 } ], "first_id": "invite-abc", "last_id": "invite-abc", "has_more": false } ``` -------------------------------- ### Example Tool Definitions for Chat Completions Source: https://developers.openai.com/api/reference/resources/chat/subresources/completions This snippet shows how to define tools for the Chat Completions API. It includes examples for function calls. ```json [ { "type": "function", "function": { "name": "get_weather" } }, { "type": "function", "function": { "name": "get_time" } } ] ``` -------------------------------- ### Get Chat Completion Source: https://developers.openai.com/api/reference/resources/chat/subresources/completions/methods/retrieve This endpoint retrieves a chat completion. It requires an Authorization header and accepts a JSON content type. The example shows a basic GET request and its successful JSON response. ```APIDOC ## GET /v1/chat/completions/{chatcmpl-abc123} ### Description Retrieves a specific chat completion using its ID. ### Method GET ### Endpoint /v1/chat/completions/{chatcmpl-abc123} ### Parameters #### Path Parameters - **chatcmpl-abc123** (string) - Required - The ID of the chat completion to retrieve. ### Request Example ```curl curl https://api.openai.com/v1/chat/completions/chatcmpl-abc123 \ -H "Authorization: Bearer $OPENAI_API_KEY" \ -H "Content-Type: application/json" ``` ### Response #### Success Response (200) - **object** (string) - The type of object returned, e.g., "chat.completion". - **id** (string) - The unique identifier for the completion. - **model** (string) - The model used for the completion. - **created** (integer) - The Unix timestamp of when the completion was created. - **request_id** (string) - The ID of the request. - **tool_choice** (any) - Information about tool choices, if any. - **usage** (object) - Token usage statistics. - **total_tokens** (integer) - Total tokens used. - **completion_tokens** (integer) - Tokens used for the completion. - **prompt_tokens** (integer) - Tokens used for the prompt. - **seed** (integer) - The seed used for generation. - **top_p** (number) - The nucleus sampling parameter. - **temperature** (number) - The temperature parameter for sampling. - **presence_penalty** (number) - The presence penalty parameter. - **frequency_penalty** (number) - The frequency penalty parameter. - **system_fingerprint** (string) - A fingerprint for the system configuration. - **input_user** (any) - User-provided input, if any. - **service_tier** (string) - The service tier used. - **tools** (any) - Information about tools, if any. - **metadata** (object) - Additional metadata. - **choices** (array) - A list of completion choices. - **index** (integer) - The index of the choice. - **message** (object) - The message content. - **content** (string) - The text content of the message. - **role** (string) - The role of the message sender (e.g., "assistant"). - **tool_calls** (any) - Information about tool calls, if any. - **function_call** (any) - Information about function calls, if any. - **finish_reason** (string) - The reason the generation finished (e.g., "stop"). - **logprobs** (any) - Log probabilities, if available. - **response_format** (any) - Information about the response format, if specified. #### Response Example ```json { "object": "chat.completion", "id": "chatcmpl-abc123", "model": "gpt-4o-2024-08-06", "created": 1738960610, "request_id": "req_ded8ab984ec4bf840f37566c1011c417", "tool_choice": null, "usage": { "total_tokens": 31, "completion_tokens": 18, "prompt_tokens": 13 }, "seed": 4944116822809979520, "top_p": 1.0, "temperature": 1.0, "presence_penalty": 0.0, "frequency_penalty": 0.0, "system_fingerprint": "fp_50cad350e4", "input_user": null, "service_tier": "default", "tools": null, "metadata": {}, "choices": [ { "index": 0, "message": { "content": "Mind of circuits hum, \nLearning patterns in silence— \nFuture's quiet spark.", "role": "assistant", "tool_calls": null, "function_call": null }, "finish_reason": "stop", "logprobs": null } ], "response_format": null } ``` ``` -------------------------------- ### Create a Container with Skills and Network Policy Source: https://developers.openai.com/api/reference/resources/containers/methods/create This example demonstrates how to create a container with specified memory limits, referenced skills, and an allowlist network policy. Ensure you have your OpenAI API key set as an environment variable. ```curl curl https://api.openai.com/v1/containers \ -H "Authorization: Bearer $OPENAI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "name": "My Container", "memory_limit": "4g", "skills": [ { "type": "skill_reference", "skill_id": "skill_4db6f1a2c9e73508b41f9da06e2c7b5f" }, { "type": "skill_reference", "skill_id": "openai-spreadsheets", "version": "latest" } ], "network_policy": { "type": "allowlist", "allowed_domains": ["api.buildkite.com"] } }' ``` -------------------------------- ### Audio Speeches Usage Response Example Source: https://developers.openai.com/api/reference/resources/admin/subresources/organization/subresources/usage/methods/audio_speeches This is an example of the JSON response when requesting audio speech usage data. It outlines the structure, including buckets of usage data, start and end times, and detailed results per request. ```json { "object": "page", "data": [ { "object": "bucket", "start_time": 1730419200, "end_time": 1730505600, "results": [ { "object": "organization.usage.audio_speeches.result", "characters": 45, "num_model_requests": 1, "project_id": null, "user_id": null, "api_key_id": null, "model": null } ] } ], "has_more": false, "next_page": null } ``` -------------------------------- ### Get Moderation Usage Source: https://developers.openai.com/api/reference/resources/admin/subresources/organization/subresources/usage/methods/moderations Fetches moderation usage data for the organization. You can filter by start time and limit the number of results. ```APIDOC ## GET /v1/organization/usage/moderations ### Description Retrieves moderation usage statistics for the organization. ### Method GET ### Endpoint /v1/organization/usage/moderations ### Parameters #### Query Parameters - **start_time** (integer) - Required - The Unix timestamp to start fetching data from. - **limit** (integer) - Optional - The maximum number of results to return. ### Request Example ```curl curl "https://api.openai.com/v1/organization/usage/moderations?start_time=1730419200&limit=1" \ -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ -H "Content-Type: application/json" ``` ### Response #### Success Response (200) - **object** (string) - The type of the returned object, usually "page". - **data** (array) - An array of usage buckets. - **object** (string) - The type of the bucket, usually "bucket". - **start_time** (integer) - The start timestamp of the bucket. - **end_time** (integer) - The end timestamp of the bucket. - **results** (array) - An array of moderation results within the bucket. - **object** (string) - The type of the result, usually "organization.usage.moderations.result". - **input_tokens** (integer) - The number of input tokens used. - **num_model_requests** (integer) - The number of model requests made. - **project_id** (null) - Placeholder for project ID. - **user_id** (null) - Placeholder for user ID. - **api_key_id** (null) - Placeholder for API key ID. - **model** (null) - Placeholder for model name. - **has_more** (boolean) - Indicates if there are more results available. - **next_page** (null) - Placeholder for the next page cursor. #### Response Example ```json { "object": "page", "data": [ { "object": "bucket", "start_time": 1730419200, "end_time": 1730505600, "results": [ { "object": "organization.usage.moderations.result", "input_tokens": 16, "num_model_requests": 2, "project_id": null, "user_id": null, "api_key_id": null, "model": null } ] } ], "has_more": false, "next_page": null } ``` ``` -------------------------------- ### Create Run with Tool Configurations Source: https://developers.openai.com/api/reference/resources/evals/subresources/runs/methods/create This snippet demonstrates the structure for creating a run, including the definition of various tools that can be utilized. It covers tool_search with execution options, web_search_preview with content types and context size, and apply_patch for file manipulation. ```APIDOC ## POST /runs ### Description Creates a new run with specified tools and configurations. ### Method POST ### Endpoint /runs ### Request Body - **name** (string) - Optional - The name of the run. - **metadata** (object) - Optional - Set of 16 key-value pairs that can be attached to an object. - Keys are strings with a maximum length of 64 characters. - Values are strings with a maximum length of 512 characters. - **tools** (array) - Optional - A list of tools to be used in the run. - **tool_search** (object) - Configuration for a tool search. - **type** (string) - Required - Always `tool_search`. - **description** (string) - Optional - Description shown to the model for a client-executed tool search tool. - **execution** (string) - Optional - Whether tool search is executed by the server or by the client. One of: `server`, `client`. - **parameters** (object) - Optional - Parameter schema for a client-executed tool search tool. - **web_search_preview** (object) - Configuration for a web search tool. - **type** (string) - Required - One of `web_search_preview` or `web_search_preview_2025_03_11`. - **search_content_types** (array) - Optional - Content types to search for. One of: `text`, `image`. - **search_context_size** (string) - Optional - Guidance for context window space. One of: `low`, `medium`, `high`. `medium` is the default. - **user_location** (object) - Optional - The user’s location. - **type** (string) - Required - Always `approximate`. - **city** (string) - Optional - Free text input for the city. - **country** (string) - Optional - The two-letter ISO country code. - **region** (string) - Optional - Free text input for the region. - **timezone** (string) - Optional - The IANA timezone. - **apply_patch** (object) - Configuration for applying patches. - **type** (string) - Required - Always `apply_patch`. ### Response #### Success Response (200) - **run_id** (string) - The ID of the created run. - **status** (string) - The status of the run. #### Response Example { "run_id": "run_abc123", "status": "queued" } ``` -------------------------------- ### Example Response: Binary File Content Source: https://developers.openai.com/api/reference/resources/containers/subresources/files/subresources/content/methods/retrieve This example shows the expected output when retrieving binary file content. The actual content will vary based on the file. ```text ``` -------------------------------- ### Get Organization Costs Source: https://developers.openai.com/api/reference/resources/admin/subresources/organization/subresources/usage/methods/costs Retrieves cost data for your organization, optionally filtered by start time and a limit for the number of results. ```APIDOC ## GET /v1/organization/costs ### Description Retrieves cost data for your organization, optionally filtered by start time and a limit for the number of results. ### Method GET ### Endpoint /v1/organization/costs ### Parameters #### Query Parameters - **start_time** (integer) - Required - The Unix timestamp to start fetching costs from. - **limit** (integer) - Optional - The maximum number of results to return. ### Response #### Success Response (200) - **object** (string) - The type of object returned, e.g., "page". - **data** (array) - An array of cost data buckets. - **object** (string) - The type of object within the data array, e.g., "bucket". - **start_time** (integer) - The start time of the cost bucket. - **end_time** (integer) - The end time of the cost bucket. - **results** (array) - An array of individual cost results within the bucket. - **object** (string) - The type of object within the results array, e.g., "organization.costs.result". - **amount** (object) - The cost amount. - **value** (number) - The numerical value of the cost. - **currency** (string) - The currency of the cost (e.g., "usd"). - **line_item** (null) - Placeholder for line item details (currently null). - **project_id** (null) - Placeholder for project ID (currently null). - **api_key_id** (null) - Placeholder for API key ID (currently null). - **quantity** (null) - Placeholder for quantity (currently null). - **has_more** (boolean) - Indicates if there are more results available. - **next_page** (null) - Placeholder for the next page token (currently null). #### Response Example ```json { "object": "page", "data": [ { "object": "bucket", "start_time": 1730419200, "end_time": 1730505600, "results": [ { "object": "organization.costs.result", "amount": { "value": 0.06, "currency": "usd" }, "line_item": null, "project_id": null, "api_key_id": null, "quantity": null } ] } ], "has_more": false, "next_page": null } ``` ``` -------------------------------- ### Create container Source: https://developers.openai.com/api/reference/resources/containers/methods/create This example demonstrates how to create a container with a specified name, memory limit, skills, and network policy. ```APIDOC ## POST /v1/containers ### Description Creates a new container with specified configurations. ### Method POST ### Endpoint https://api.openai.com/v1/containers ### Parameters #### Request Body - **name** (string) - Required - Name of the container to create. - **expires_after** (object) - Optional - Container expiration time in seconds relative to the ‘anchor’ time. - **anchor** (string) - Optional - Time anchor for the expiration time. Currently only ‘last_active_at’ is supported. - **minutes** (number) - Optional - Container expiration time in minutes relative to the anchor. - **file_ids** (array of string) - Optional - IDs of files to copy to the container. - **memory_limit** (string) - Optional - Optional memory limit for the container. Defaults to “1g”. One of: "1g", "4g", "16g", "64g". - **network_policy** (object) - Optional - Network access policy for the container. - **type** (string) - Required - Type of network policy. Can be "disabled" or "allowlist". - **allowed_domains** (array of string) - Optional - A list of allowed domains when type is `allowlist`. - **domain_secrets** (array of object) - Optional - Optional domain-scoped secrets for allowlisted domains. - **domain** (string) - Required - The domain associated with the secret. - **name** (string) - Required - The name of the secret to inject for the domain. - **value** (string) - Required - The secret value to inject for the domain. - **skills** (array of object) - Optional - An optional list of skills referenced by id or inline data. - **type** (string) - Required - Type of skill. Can be "skill_reference" or "inline". - **skill_id** (string) - Required if type is "skill_reference" - The ID of the referenced skill. - **version** (string) - Optional - Optional skill version. Use a positive integer or ‘latest’. Omit for default. - **description** (string) - Required if type is "inline" - The description of the skill. - **name** (string) - Required if type is "inline" - The name of the skill. - **source** (object) - Required if type is "inline" - Inline skill payload. - **type** (string) - Required - The type of the inline skill source. Must be `base64`. - **data** (string) - Required - Base64-encoded skill zip bundle. - **media_type** (string) - Required - The media type of the inline skill payload. Must be `application/zip`. ### Request Example ```json { "name": "My Container", "memory_limit": "4g", "skills": [ { "type": "skill_reference", "skill_id": "skill_4db6f1a2c9e73508b41f9da06e2c7b5f" }, { "type": "skill_reference", "skill_id": "openai-spreadsheets", "version": "latest" } ], "network_policy": { "type": "allowlist", "allowed_domains": ["api.buildkite.com"] } } ``` ### Response #### Success Response (200) - **id** (string) - Unique identifier for the container. - **created_at** (number) - Unix timestamp (in seconds) when the container was created. - **name** (string) - Name of the container. - **object** (string) - The type of this object. - **status** (string) - Status of the container (e.g., active, deleted). - **expires_after** (object) - The container will expire after this time period. - **anchor** (string) - The reference point for the expiration. - **minutes** (number) - The number of minutes after the anchor before the container expires. - **last_active_at** (number) - Unix timestamp (in seconds) when the container was last active. - **memory_limit** (string) - The memory limit configured for the container. - **network_policy** (object) - Network access policy for the container. - **type** (string) - The network policy mode. Can be "allowlist" or "disabled". - **allowed_domains** (array of string) - Allowed outbound domains when `type` is `allowlist`. #### Response Example ```json { "id": "cntr_682e30645a488191b6363a0cbefc0f0a025ec61b66250591", "object": "container", "created_at": 1747857508, "status": "running", "expires_after": { "anchor": "last_active_at", "minutes": 20 }, "last_active_at": 1747857508, "network_policy": { "type": "allowlist", "allowed_domains": ["api.buildkite.com"] }, "memory_limit": "4g", "name": "My Container" } ``` ``` -------------------------------- ### Get Organization Usage Completions Source: https://developers.openai.com/api/reference/resources/admin/subresources/organization/subresources/usage/methods/completions Fetches organization usage data for completions, allowing filtering by start time and limiting the number of results. ```APIDOC ## GET /v1/organization/usage/completions ### Description Retrieves organization usage statistics for completions. This endpoint can be used to monitor token consumption and request counts. ### Method GET ### Endpoint /v1/organization/usage/completions ### Parameters #### Query Parameters - **start_time** (integer) - Required - The start of the period to return usage for (Unix timestamp). - **limit** (integer) - Optional - The maximum number of buckets to return. ### Request Example ```curl curl "https://api.openai.com/v1/organization/usage/completions?start_time=1730419200&limit=1" \ -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ -H "Content-Type: application/json" ``` ### Response #### Success Response (200) - **object** (string) - The type of object returned, should be "page". - **data** (array) - An array of usage buckets. - **object** (string) - The type of object in the data array, should be "bucket". - **start_time** (integer) - The start time of the usage bucket. - **end_time** (integer) - The end time of the usage bucket. - **results** (array) - An array of completion usage results within the bucket. - **object** (string) - The type of object in the results array, should be "organization.usage.completions.result". - **input_tokens** (integer) - The number of input tokens used. - **output_tokens** (integer) - The number of output tokens used. - **input_cached_tokens** (integer) - The number of cached input tokens used. - **input_audio_tokens** (integer) - The number of input audio tokens used. - **output_audio_tokens** (integer) - The number of output audio tokens used. - **num_model_requests** (integer) - The number of model requests made. - **project_id** (string or null) - The ID of the project, if applicable. - **user_id** (string or null) - The ID of the user, if applicable. - **api_key_id** (string or null) - The ID of the API key used, if applicable. - **model** (string or null) - The model used for the completions. - **batch** (string or null) - The batch identifier, if applicable. - **service_tier** (string or null) - The service tier used. - **has_more** (boolean) - Indicates if there are more pages of results. - **next_page** (string) - A token to retrieve the next page of results. #### Response Example ```json { "object": "page", "data": [ { "object": "bucket", "start_time": 1730419200, "end_time": 1730505600, "results": [ { "object": "organization.usage.completions.result", "input_tokens": 1000, "output_tokens": 500, "input_cached_tokens": 800, "input_audio_tokens": 0, "output_audio_tokens": 0, "num_model_requests": 5, "project_id": null, "user_id": null, "api_key_id": null, "model": null, "batch": null, "service_tier": null } ] } ], "has_more": true, "next_page": "page_AAAAAGdGxdEiJdKOAAAAAGcqsYA=" } ``` ``` -------------------------------- ### Example Tool Definitions Source: https://developers.openai.com/api/reference/resources/chat/subresources/completions/methods/create This snippet shows how to define tools that the model can call. It includes both function tools and custom tools with different input formats. ```json [ { "type": "function", "function": { "name": "get_weather" } }, { "type": "function", "function": { "name": "get_time" } } ] ``` ```json [ { "type": "function", "function": { "name": "get_weather", "description": "Get the current weather", "parameters": { "type": "object", "properties": { "location": { "type": "string", "description": "The city and state, e.g. San Francisco, CA" }, "unit": { "type": "string", "enum": ["celsius", "fahrenheit"], "description": "The temperature unit to use. Infer this from the users location." } }, "required": ["location", "unit"] } } } ] ``` ```json [ { "type": "custom", "custom": { "name": "my_custom_tool", "description": "A custom tool that processes text input.", "format": {"type": "text"} } }, { "type": "custom", "custom": { "name": "my_grammar_tool", "description": "A custom tool that processes input based on a grammar.", "format": {"type": "grammar", "grammar": "#ABNF v1.0; "} } } ] ``` -------------------------------- ### Retrieve Organization Data Retention Source: https://developers.openai.com/api/reference/resources/admin/subresources/organization/subresources/data_retention Use this endpoint to get the current data retention settings for an organization. No specific setup is required beyond authentication. ```bash GET/organization/data_retention ``` -------------------------------- ### Get Web Search Calls Usage Source: https://developers.openai.com/api/reference/resources/admin/subresources/organization/subresources/usage/methods/web_search_calls Retrieves a paginated list of web search call usage data for an organization, filterable by start time and limit. ```APIDOC ## GET /v1/organization/usage/web_search_calls ### Description Retrieves usage data for web search calls within an organization. This endpoint allows you to query historical usage based on a specified start time and a limit for the number of results. ### Method GET ### Endpoint /v1/organization/usage/web_search_calls ### Parameters #### Query Parameters - **start_time** (integer) - Required - The Unix timestamp for the start of the time range to retrieve usage data. - **limit** (integer) - Optional - The maximum number of results to return per page. ### Request Example ```curl curl "https://api.openai.com/v1/organization/usage/web_search_calls?start_time=1730419200&limit=1" \ -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ -H "Content-Type: application/json" ``` ### Response #### Success Response (200) - **object** (string) - The type of the returned object, typically "page". - **data** (array) - An array of usage data buckets. - **object** (string) - The type of the bucket, typically "bucket". - **start_time** (integer) - The start timestamp of the bucket. - **end_time** (integer) - The end timestamp of the bucket. - **results** (array) - An array of usage results within the bucket. - **object** (string) - The type of the result, typically "organization.usage.web_searches.result". - **num_model_requests** (integer) - The number of model requests made. - **num_requests** (integer) - The total number of requests made. - **project_id** (null) - Placeholder for project ID. - **user_id** (null) - Placeholder for user ID. - **api_key_id** (null) - Placeholder for API key ID. - **model** (null) - Placeholder for model information. - **context_level** (null) - Placeholder for context level. - **has_more** (boolean) - Indicates if there are more pages of results. - **next_page** (null) - Placeholder for the next page cursor. #### Response Example ```json { "object": "page", "data": [ { "object": "bucket", "start_time": 1730419200, "end_time": 1730505600, "results": [ { "object": "organization.usage.web_searches.result", "num_model_requests": 2, "num_requests": 2, "project_id": null, "user_id": null, "api_key_id": null, "model": null, "context_level": null } ] } ], "has_more": false, "next_page": null } ``` ``` -------------------------------- ### Create Fine-Tuning Job (Basic) Source: https://developers.openai.com/api/reference/resources/fine_tuning/subresources/jobs/methods/create This example shows a basic creation of a fine-tuning job with only the required training file and model specified. ```APIDOC ## POST /v1/fine_tuning/jobs ### Description Creates a basic fine-tuning job with minimal required parameters. ### Method POST ### Endpoint https://api.openai.com/v1/fine_tuning/jobs ### Parameters #### Request Body - **training_file** (string) - Required - The ID of the training file. - **validation_file** (string) - Optional - The ID of the validation file. - **model** (string) - Required - The base model to fine-tune. ### Request Example ```json { "training_file": "file-abc123", "validation_file": "file-abc123", "model": "gpt-4o-mini" } ``` ### Response #### Success Response (200) - **object** (string) - The type of object returned. - **id** (string) - The ID of the fine-tuning job. - **model** (string) - The base model used for fine-tuning. - **created_at** (integer) - The Unix timestamp of when the job was created. - **fine_tuned_model** (null) - The ID of the fine-tuned model (null if not available). - **organization_id** (string) - The ID of the organization. - **result_files** (array) - A list of file IDs for the results. - **status** (string) - The current status of the job. - **validation_file** (string) - The ID of the validation file. - **training_file** (string) - The ID of the training file. - **method** (object) - Configuration of the fine-tuning method. - **type** (string) - The type of method, defaults to "supervised". - **supervised** (object) - Supervised learning specific configuration. - **hyperparameters** (object) - Hyperparameters for supervised learning. - **batch_size** (string) - Batch size, defaults to "auto". - **learning_rate_multiplier** (string) - Learning rate multiplier, defaults to "auto". - **n_epochs** (string) - Number of epochs, defaults to "auto". - **metadata** (null) - Custom metadata. #### Response Example ```json { "object": "fine_tuning.job", "id": "ftjob-abc123", "model": "gpt-4o-mini-2024-07-18", "created_at": 1721764800, "fine_tuned_model": null, "organization_id": "org-123", "result_files": [], "status": "queued", "validation_file": "file-abc123", "training_file": "file-abc123", "method": { "type": "supervised", "supervised": { "hyperparameters": { "batch_size": "auto", "learning_rate_multiplier": "auto", "n_epochs": "auto" } } }, "metadata": null } ``` ``` -------------------------------- ### Get Organization Image Usage Source: https://developers.openai.com/api/reference/resources/admin/subresources/organization/subresources/usage/methods/images Retrieves image usage statistics for a specified time range. You can filter results by start time and limit the number of returned records. ```APIDOC ## GET /v1/organization/usage/images ### Description Retrieves image usage statistics for a specified time range. You can filter results by start time and limit the number of returned records. ### Method GET ### Endpoint /v1/organization/usage/images ### Parameters #### Query Parameters - **start_time** (integer) - Required - The Unix timestamp for the start of the time range. - **limit** (integer) - Optional - The maximum number of records to return. ### Request Example ```curl curl "https://api.openai.com/v1/organization/usage/images?start_time=1730419200&limit=1" \ -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ -H "Content-Type: application/json" ``` ### Response #### Success Response (200) - **object** (string) - The type of object returned, e.g., "page". - **data** (array) - An array of usage buckets. - **object** (string) - The type of object within the data array, e.g., "bucket". - **start_time** (integer) - The start time of the usage bucket. - **end_time** (integer) - The end time of the usage bucket. - **results** (array) - An array of usage results within the bucket. - **object** (string) - The type of object within the results array, e.g., "organization.usage.images.result". - **images** (integer) - The number of images generated. - **num_model_requests** (integer) - The number of model requests made. - **size** (null) - Placeholder for size information (currently null). - **source** (null) - Placeholder for source information (currently null). - **project_id** (null) - Placeholder for project ID (currently null). - **user_id** (null) - Placeholder for user ID (currently null). - **api_key_id** (null) - Placeholder for API key ID (currently null). - **model** (null) - Placeholder for model information (currently null). - **has_more** (boolean) - Indicates if there are more pages of results. - **next_page** (null) - URL for the next page of results, or null if none. #### Response Example ```json { "object": "page", "data": [ { "object": "bucket", "start_time": 1730419200, "end_time": 1730505600, "results": [ { "object": "organization.usage.images.result", "images": 2, "num_model_requests": 2, "size": null, "source": null, "project_id": null, "user_id": null, "api_key_id": null, "model": null } ] } ], "has_more": false, "next_page": null } ``` ``` -------------------------------- ### Create Project Response Source: https://developers.openai.com/api/reference/resources/admin/subresources/organization/subresources/projects/methods/create This is an example of the JSON response received after successfully creating a project. It includes the project's ID, name, creation timestamp, and status. ```json { "id": "proj_abc", "object": "organization.project", "name": "Project ABC", "created_at": 1711471533, "archived_at": null, "status": "active" } ``` -------------------------------- ### Reasoning Text Example Source: https://developers.openai.com/api/reference/resources/responses/methods/compact Example of detailed reasoning text content, using the 'reasoning_text' type. ```json [ { "type": "reasoning_text", "text": "First, I need to understand the user's intent..." } ] ``` -------------------------------- ### Reasoning Summary Text Example Source: https://developers.openai.com/api/reference/resources/responses/methods/compact Example of reasoning summary content, using the 'summary_text' type. ```json [ { "type": "summary_text", "text": "The model decided to search for relevant information." } ] ``` -------------------------------- ### Translation Response Example Source: https://developers.openai.com/api/reference/resources/audio/subresources/translations/methods/create This is an example of the JSON response received after a successful audio translation request. ```json { "text": "Hello, my name is Wolfgang and I come from Germany. Where are you heading today?" } ``` -------------------------------- ### Full Image Response Example Source: https://developers.openai.com/api/reference/resources/images/methods/generate This example displays a comprehensive response object for image generation, detailing all possible fields including background, revised prompt, URL, and detailed token usage. ```json { "created": 0, "background": "transparent", "data": [ { "b64_json": "b64_json", "revised_prompt": "revised_prompt", "url": "https://example.com" } ], "output_format": "png", "quality": "low", "size": "1024x1024", "usage": { "input_tokens": 0, "input_tokens_details": { "image_tokens": 0, "text_tokens": 0 }, "output_tokens": 0, "total_tokens": 0, "output_tokens_details": { "image_tokens": 0, "text_tokens": 0 } } } ```