{
  "openapi": "3.1.0",
  "info": {
    "title": "Responses API",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://api.cometapi.com"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "paths": {
    "/v1/responses": {
      "post": {
        "summary": "Create Response",
        "operationId": "createResponse",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "model",
                  "input"
                ],
                "properties": {
                  "model": {
                    "type": "string",
                    "description": "Model ID to use for this request. See the [Models page](/overview/models) for current options.",
                    "example": "gpt-5.6-sol"
                  },
                  "input": {
                    "oneOf": [
                      {
                        "type": "string",
                        "description": "A plain text string as input."
                      },
                      {
                        "type": "array",
                        "description": "An array of input items with roles and multimodal content.",
                        "items": {
                          "type": "object"
                        }
                      }
                    ],
                    "description": "Text, image, or file inputs to the model, used to generate a response. Can be a simple string for text-only input, or an array of input items for multimodal content (images, files) and multi-turn conversations."
                  },
                  "instructions": {
                    "type": "string",
                    "description": "A system (or developer) message inserted into the model's context. When used with `previous_response_id`, instructions from the previous response are not carried over — this makes it easy to swap system messages between turns."
                  },
                  "background": {
                    "type": "boolean",
                    "description": "Whether to run the model response in the background. Background responses do not return output directly — you retrieve the result later via the response ID.",
                    "default": false
                  },
                  "context_management": {
                    "type": "array",
                    "description": "Context management configuration for this request. Controls how the model manages context when the conversation exceeds the context window.",
                    "items": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "The type of context management."
                        },
                        "compact_threshold": {
                          "type": "number",
                          "description": "The threshold at which context compaction is triggered."
                        }
                      }
                    }
                  },
                  "conversation": {
                    "type": [
                      "string",
                      "object",
                      "null"
                    ],
                    "description": "The conversation this response belongs to. Items from the conversation are prepended to `input` for context. Input and output items are automatically added to the conversation after the response completes. Cannot be used with `previous_response_id`.",
                    "default": null
                  },
                  "include": {
                    "type": "array",
                    "description": "Additional output data to include in the response. Use this to request extra information that is not included by default.",
                    "items": {
                      "type": "string",
                      "enum": [
                        "web_search_call.action.sources",
                        "code_interpreter_call.outputs",
                        "computer_call_output.output.image_url",
                        "file_search_call.results",
                        "message.input_image.image_url",
                        "message.output_text.logprobs",
                        "reasoning.encrypted_content"
                      ]
                    }
                  },
                  "max_output_tokens": {
                    "type": "integer",
                    "description": "An upper bound for the number of tokens that can be generated for a response, including visible output tokens and reasoning tokens."
                  },
                  "max_tool_calls": {
                    "type": "integer",
                    "description": "The maximum number of total calls to built-in tools that can be processed in a response. This limit applies across all built-in tool calls, not per individual tool. Any further tool call attempts by the model will be ignored."
                  },
                  "metadata": {
                    "type": "object",
                    "description": "Set of up to 16 key-value pairs that can be attached to the response. Useful for storing additional information in a structured format. Keys have a maximum length of 64 characters; values have a maximum length of 512 characters.",
                    "additionalProperties": {
                      "type": "string"
                    }
                  },
                  "parallel_tool_calls": {
                    "type": "boolean",
                    "description": "Whether to allow the model to run tool calls in parallel.",
                    "default": true
                  },
                  "previous_response_id": {
                    "type": "string",
                    "description": "The unique ID of a previous response. Use this to create multi-turn conversations without manually managing conversation state. Cannot be used with `conversation`."
                  },
                  "prompt": {
                    "type": "object",
                    "description": "Reference to a prompt template and its variables.",
                    "properties": {
                      "id": {
                        "type": "string",
                        "description": "The ID of the prompt template."
                      },
                      "variables": {
                        "type": "object",
                        "description": "Key-value pairs for template variables.",
                        "additionalProperties": {
                          "type": "string"
                        }
                      },
                      "version": {
                        "type": "string",
                        "description": "The version of the prompt template to use."
                      }
                    }
                  },
                  "prompt_cache_key": {
                    "type": "string",
                    "description": "A key used to cache responses for similar requests, helping optimize cache hit rates. Replaces the deprecated `user` field for caching purposes."
                  },
                  "prompt_cache_retention": {
                    "type": "string",
                    "description": "The retention policy for the prompt cache. Set to `24h` to keep cached prefixes active for up to 24 hours.",
                    "enum": [
                      "in-memory",
                      "24h"
                    ]
                  },
                  "reasoning": {
                    "type": "object",
                    "description": "Configuration options for reasoning models (o-series and gpt-5). Controls the depth of reasoning before generating a response.",
                    "properties": {
                      "effort": {
                        "type": "string",
                        "description": "Constrains effort on reasoning. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning.",
                        "enum": [
                          "none",
                          "minimal",
                          "low",
                          "medium",
                          "high"
                        ]
                      },
                      "generate_summary": {
                        "type": "string",
                        "description": "Whether to generate a summary of the reasoning process.",
                        "enum": [
                          "auto",
                          "concise",
                          "detailed"
                        ]
                      },
                      "summary": {
                        "type": "string",
                        "description": "Deprecated. Use `generate_summary` instead.",
                        "enum": [
                          "auto",
                          "concise",
                          "detailed"
                        ],
                        "deprecated": true
                      }
                    }
                  },
                  "safety_identifier": {
                    "type": "string",
                    "description": "A stable identifier for your end-users, used to help detect policy violations. Should be a hashed username or email — do not send identifying information directly.",
                    "maxLength": 64
                  },
                  "service_tier": {
                    "type": "string",
                    "description": "Specifies the processing tier for the request. When set, the response will include the actual `service_tier` used.\n\n- `auto`: Uses the tier configured in project settings (default behavior).\n- `default`: Standard pricing and performance.\n- `flex`: Flexible processing with potential cost savings.\n- `priority`: Priority processing with faster response times.",
                    "enum": [
                      "auto",
                      "default",
                      "flex",
                      "priority"
                    ]
                  },
                  "store": {
                    "type": "boolean",
                    "description": "Whether to store the generated response for later retrieval via API.",
                    "default": true
                  },
                  "stream": {
                    "type": "boolean",
                    "description": "If set to `true`, the response data will be streamed to the client as it is generated using server-sent events (SSE). Events include `response.created`, `response.output_text.delta`, `response.completed`, and more.",
                    "default": false
                  },
                  "stream_options": {
                    "type": "object",
                    "description": "Options for streaming responses. Only set this when `stream` is `true`.",
                    "properties": {
                      "include_obfuscation": {
                        "type": "boolean",
                        "description": "Whether to include obfuscation data in streaming events."
                      }
                    }
                  },
                  "temperature": {
                    "type": "number",
                    "description": "Sampling temperature between 0 and 2. Higher values (e.g., 0.8) increase randomness; lower values (e.g., 0.2) make output more focused and deterministic. We recommend adjusting either this or `top_p`, but not both.",
                    "default": 1,
                    "minimum": 0,
                    "maximum": 2
                  },
                  "text": {
                    "type": "object",
                    "description": "Configuration for text output. Use this to request structured JSON output via JSON mode or JSON Schema.",
                    "properties": {
                      "format": {
                        "type": "object",
                        "description": "The format of the text output.",
                        "properties": {
                          "type": {
                            "type": "string",
                            "description": "The output format type. `text` returns plain text, `json_object` returns valid JSON, `json_schema` returns JSON conforming to a provided schema.",
                            "enum": [
                              "text",
                              "json_object",
                              "json_schema"
                            ]
                          },
                          "json_schema": {
                            "type": "object",
                            "description": "The JSON Schema to use when `type` is `json_schema`. Required when using structured outputs."
                          }
                        }
                      },
                      "verbosity": {
                        "type": "string",
                        "description": "Controls the verbosity of the text output.",
                        "enum": [
                          "low",
                          "medium",
                          "high"
                        ]
                      }
                    }
                  },
                  "tool_choice": {
                    "type": [
                      "string",
                      "object"
                    ],
                    "description": "Controls how the model selects which tool(s) to call.\n\n- `auto` (default): The model decides whether and which tools to call.\n- `none`: The model will not call any tools.\n- `required`: The model must call at least one tool.\n- An object specifying a particular tool to use.",
                    "default": "auto"
                  },
                  "tools": {
                    "type": "array",
                    "description": "An array of tools the model may call while generating a response. CometAPI supports three categories:\n\n- **Built-in tools**: Platform-provided tools like `web_search_preview` and `file_search`.\n- **Function calls**: Custom functions you define, enabling the model to call your own code with structured arguments.\n- **MCP tools**: Integrations with third-party systems via MCP servers.",
                    "items": {
                      "type": "object"
                    }
                  },
                  "top_logprobs": {
                    "type": "integer",
                    "description": "Number of most likely tokens to return at each position (0–20), each with an associated log probability. Must include `message.output_text.logprobs` in the `include` parameter to receive logprobs.",
                    "minimum": 0,
                    "maximum": 20
                  },
                  "top_p": {
                    "type": "number",
                    "description": "Nucleus sampling parameter. The model considers tokens with `top_p` cumulative probability mass. For example, 0.1 means only the top 10% probability tokens are considered. We recommend adjusting either this or `temperature`, but not both.",
                    "default": 1,
                    "minimum": 0,
                    "maximum": 1
                  },
                  "truncation": {
                    "type": "string",
                    "description": "The truncation strategy for handling inputs that exceed the model's context window.\n\n- `auto`: The model truncates the input by dropping items from the beginning of the conversation to fit.\n- `disabled` (default): The request fails with a 400 error if the input exceeds the context window.",
                    "enum": [
                      "auto",
                      "disabled"
                    ],
                    "default": "disabled"
                  },
                  "user": {
                    "type": "string",
                    "description": "Deprecated. Use `safety_identifier` and `prompt_cache_key` instead. A stable identifier for your end-user.",
                    "deprecated": true
                  }
                }
              },
              "examples": {
                "Text Input": {
                  "summary": "Text Input",
                  "value": {
                    "model": "gpt-5.6-sol",
                    "input": "Tell me a three sentence bedtime story about a unicorn."
                  }
                },
                "Image Input": {
                  "summary": "Image Input",
                  "value": {
                    "model": "gpt-5.6-sol",
                    "input": [
                      {
                        "role": "user",
                        "content": [
                          {
                            "type": "input_text",
                            "text": "What is in this image?"
                          },
                          {
                            "type": "input_image",
                            "image_url": "https://images.unsplash.com/photo-1500530855697-b586d89ba3ee?w=1200"
                          }
                        ]
                      }
                    ]
                  }
                },
                "File Input": {
                  "summary": "File Input",
                  "value": {
                    "model": "gpt-5.6-sol",
                    "input": [
                      {
                        "role": "user",
                        "content": [
                          {
                            "type": "input_text",
                            "text": "What is in this file?"
                          },
                          {
                            "type": "input_file",
                            "file_url": "https://www.berkshirehathaway.com/letters/2024ltr.pdf"
                          }
                        ]
                      }
                    ]
                  }
                },
                "Function Calling": {
                  "summary": "Function Calling",
                  "value": {
                    "model": "gpt-5.6-sol",
                    "input": "What is the weather like in Boston today?",
                    "tools": [
                      {
                        "type": "function",
                        "name": "get_current_weather",
                        "description": "Get the current weather in a given location",
                        "parameters": {
                          "type": "object",
                          "properties": {
                            "location": {
                              "type": "string",
                              "description": "The city and state, e.g. San Francisco, CA"
                            },
                            "unit": {
                              "type": "string",
                              "enum": [
                                "celsius",
                                "fahrenheit"
                              ],
                              "description": "Temperature unit."
                            }
                          },
                          "required": [
                            "location",
                            "unit"
                          ]
                        }
                      }
                    ]
                  }
                },
                "Reasoning": {
                  "summary": "Reasoning",
                  "value": {
                    "model": "o4-mini",
                    "input": "Solve step by step: What is 15% of 240?",
                    "reasoning": {
                      "effort": "high"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The generated Response object.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "Unique identifier for the response.",
                      "example": "resp_0a153ae8201f73bc0069a7e8044cc481"
                    },
                    "object": {
                      "type": "string",
                      "description": "The object type, always `response`.",
                      "enum": [
                        "response"
                      ],
                      "example": "response"
                    },
                    "created_at": {
                      "type": "integer",
                      "description": "Unix timestamp (in seconds) of when the response was created.",
                      "example": 1772611588
                    },
                    "status": {
                      "type": "string",
                      "description": "The status of the response.",
                      "enum": [
                        "completed",
                        "in_progress",
                        "failed",
                        "cancelled",
                        "queued"
                      ],
                      "example": "completed"
                    },
                    "background": {
                      "type": "boolean",
                      "description": "Whether the response was run in the background.",
                      "example": false
                    },
                    "completed_at": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "description": "Unix timestamp of when the response was completed, or `null` if still in progress.",
                      "example": 1772611589
                    },
                    "error": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "description": "Error information if the response failed, or `null` on success.",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "The error code."
                        },
                        "message": {
                          "type": "string",
                          "description": "A human-readable error message."
                        }
                      }
                    },
                    "incomplete_details": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "description": "Details about why the response is incomplete, if applicable.",
                      "properties": {
                        "reason": {
                          "type": "string",
                          "description": "The reason the response is incomplete.",
                          "enum": [
                            "max_output_tokens",
                            "content_filter"
                          ]
                        }
                      }
                    },
                    "instructions": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "The system instructions used for this response."
                    },
                    "max_output_tokens": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "description": "The maximum output token limit that was applied."
                    },
                    "model": {
                      "type": "string",
                      "description": "The model used for the response.",
                      "example": "gpt-4.1-nano"
                    },
                    "output": {
                      "type": "array",
                      "description": "An array of output items generated by the model. Each item can be a message, function call, or other output type.",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "Unique identifier for the output item."
                          },
                          "type": {
                            "type": "string",
                            "description": "The type of output item.",
                            "enum": [
                              "message",
                              "function_call",
                              "web_search_call",
                              "file_search_call",
                              "code_interpreter_call",
                              "computer_call",
                              "reasoning"
                            ]
                          },
                          "status": {
                            "type": "string",
                            "description": "The status of this output item.",
                            "enum": [
                              "completed",
                              "in_progress"
                            ]
                          },
                          "role": {
                            "type": "string",
                            "description": "The role of the message (present when `type` is `message`).",
                            "enum": [
                              "assistant"
                            ]
                          },
                          "content": {
                            "type": "array",
                            "description": "The content parts of the message (present when `type` is `message`).",
                            "items": {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string",
                                  "description": "The content type.",
                                  "enum": [
                                    "output_text"
                                  ]
                                },
                                "text": {
                                  "type": "string",
                                  "description": "The generated text content."
                                },
                                "annotations": {
                                  "type": "array",
                                  "description": "Annotations such as file citations or URL citations.",
                                  "items": {
                                    "type": "object"
                                  }
                                },
                                "logprobs": {
                                  "type": "array",
                                  "description": "Log probability information (when requested via `include`).",
                                  "items": {
                                    "type": "object"
                                  }
                                }
                              }
                            }
                          },
                          "name": {
                            "type": "string",
                            "description": "The name of the function being called (present when `type` is `function_call`)."
                          },
                          "arguments": {
                            "type": "string",
                            "description": "The JSON-encoded arguments for the function call (present when `type` is `function_call`)."
                          },
                          "call_id": {
                            "type": "string",
                            "description": "The unique call identifier (present when `type` is `function_call`)."
                          }
                        }
                      }
                    },
                    "output_text": {
                      "type": "string",
                      "description": "A convenience field containing the concatenated text output from all output message items."
                    },
                    "parallel_tool_calls": {
                      "type": "boolean",
                      "description": "Whether parallel tool calls were enabled."
                    },
                    "previous_response_id": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "The ID of the previous response, if this is a multi-turn conversation."
                    },
                    "reasoning": {
                      "type": "object",
                      "description": "The reasoning configuration that was used.",
                      "properties": {
                        "effort": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "The reasoning effort level."
                        },
                        "summary": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "The reasoning summary setting."
                        }
                      }
                    },
                    "service_tier": {
                      "type": "string",
                      "description": "The service tier actually used to process the request.",
                      "example": "default"
                    },
                    "store": {
                      "type": "boolean",
                      "description": "Whether the response was stored."
                    },
                    "temperature": {
                      "type": "number",
                      "description": "The temperature value used.",
                      "example": 1
                    },
                    "text": {
                      "type": "object",
                      "description": "The text configuration used.",
                      "properties": {
                        "format": {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "description": "Format type: `text` (default), `json_object`, or `json_schema`."
                            }
                          },
                          "description": "Output text format configuration."
                        },
                        "verbosity": {
                          "type": "string",
                          "description": "The verbosity level used."
                        }
                      }
                    },
                    "tool_choice": {
                      "type": [
                        "string",
                        "object"
                      ],
                      "description": "The tool choice setting used."
                    },
                    "tools": {
                      "type": "array",
                      "description": "The tools that were available for this response.",
                      "items": {
                        "type": "object"
                      }
                    },
                    "top_p": {
                      "type": "number",
                      "description": "The `top_p` value used.",
                      "example": 1
                    },
                    "truncation": {
                      "type": "string",
                      "description": "The truncation strategy used."
                    },
                    "usage": {
                      "type": "object",
                      "description": "Token usage statistics for this response.",
                      "properties": {
                        "input_tokens": {
                          "type": "integer",
                          "description": "Number of input tokens consumed.",
                          "example": 19
                        },
                        "input_tokens_details": {
                          "type": "object",
                          "description": "Breakdown of input token usage.",
                          "properties": {
                            "cached_tokens": {
                              "type": "integer",
                              "description": "Number of input tokens that were cached.",
                              "example": 0
                            }
                          }
                        },
                        "output_tokens": {
                          "type": "integer",
                          "description": "Number of output tokens generated.",
                          "example": 9
                        },
                        "output_tokens_details": {
                          "type": "object",
                          "description": "Breakdown of output token usage.",
                          "properties": {
                            "reasoning_tokens": {
                              "type": "integer",
                              "description": "Number of tokens used for reasoning.",
                              "example": 0
                            }
                          }
                        },
                        "total_tokens": {
                          "type": "integer",
                          "description": "Total number of tokens (input + output).",
                          "example": 28
                        }
                      }
                    },
                    "user": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "The user identifier, if provided."
                    },
                    "metadata": {
                      "type": "object",
                      "description": "The metadata attached to this response.",
                      "additionalProperties": {
                        "type": "string"
                      }
                    },
                    "content_filters": {
                      "type": [
                        "array",
                        "null"
                      ],
                      "description": "Content filter results applied to the response, if any.",
                      "nullable": true
                    },
                    "frequency_penalty": {
                      "type": "number",
                      "description": "The frequency penalty applied to the request.",
                      "default": 0
                    },
                    "max_tool_calls": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "description": "Maximum number of tool calls allowed, if set.",
                      "nullable": true
                    },
                    "presence_penalty": {
                      "type": "number",
                      "description": "The presence penalty applied to the request.",
                      "default": 0
                    },
                    "prompt_cache_key": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Cache key for prompt caching, if applicable.",
                      "nullable": true
                    },
                    "prompt_cache_retention": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Prompt cache retention policy, if applicable.",
                      "nullable": true
                    },
                    "safety_identifier": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Safety system identifier for the response, if applicable.",
                      "nullable": true
                    },
                    "top_logprobs": {
                      "type": "integer",
                      "description": "Number of top log probabilities returned per token position.",
                      "default": 0
                    }
                  }
                },
                "example": {
                  "id": "resp_0a153ae8201f73bc0069a7e8044cc481",
                  "object": "response",
                  "created_at": 1772611588,
                  "status": "completed",
                  "background": false,
                  "completed_at": 1772611589,
                  "error": null,
                  "incomplete_details": null,
                  "instructions": null,
                  "max_output_tokens": null,
                  "model": "gpt-4.1-nano",
                  "output": [
                    {
                      "id": "msg_0a153ae8201f73bc0069a7e8049a8881",
                      "type": "message",
                      "status": "completed",
                      "content": [
                        {
                          "type": "output_text",
                          "annotations": [],
                          "text": "Four."
                        }
                      ],
                      "role": "assistant"
                    }
                  ],
                  "parallel_tool_calls": true,
                  "previous_response_id": null,
                  "prompt_cache_key": null,
                  "prompt_cache_retention": null,
                  "reasoning": {
                    "effort": null,
                    "summary": null
                  },
                  "safety_identifier": null,
                  "service_tier": "auto",
                  "store": true,
                  "temperature": 1,
                  "text": {
                    "format": {
                      "type": "text"
                    },
                    "verbosity": "medium"
                  },
                  "tool_choice": "auto",
                  "tools": [],
                  "top_p": 1,
                  "truncation": "disabled",
                  "usage": {
                    "input_tokens": 19,
                    "input_tokens_details": {
                      "cached_tokens": 0
                    },
                    "output_tokens": 9,
                    "output_tokens_details": {
                      "reasoning_tokens": 0
                    },
                    "total_tokens": 28
                  },
                  "user": null,
                  "metadata": {}
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "Python",
            "label": "Text Input",
            "source": "import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n    base_url=\"https://api.cometapi.com/v1\",\n    api_key=os.environ[\"COMETAPI_KEY\"],\n)\n\nresponse = client.responses.create(\n    model=\"gpt-5.6-sol\",\n    input=\"Tell me a three sentence bedtime story about a unicorn.\",\n)\n\nprint(response.output_text)\n"
          },
          {
            "lang": "Python",
            "label": "Image Input",
            "source": "import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n    base_url=\"https://api.cometapi.com/v1\",\n    api_key=os.environ[\"COMETAPI_KEY\"],\n)\n\nresponse = client.responses.create(\n    model=\"gpt-5.6-sol\",\n    input=[\n        {\n            \"role\": \"user\",\n            \"content\": [\n                {\"type\": \"input_text\", \"text\": \"What is in this image?\"},\n                {\n                    \"type\": \"input_image\",\n                    \"image_url\": \"https://images.unsplash.com/photo-1500530855697-b586d89ba3ee?w=1200\",\n                },\n            ],\n        }\n    ],\n)\n\nprint(response.output_text)\n"
          },
          {
            "lang": "Python",
            "label": "File Input",
            "source": "import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n    base_url=\"https://api.cometapi.com/v1\",\n    api_key=os.environ[\"COMETAPI_KEY\"],\n)\n\nresponse = client.responses.create(\n    model=\"gpt-5.6-sol\",\n    input=[\n        {\n            \"role\": \"user\",\n            \"content\": [\n                {\"type\": \"input_text\", \"text\": \"What is in this file?\"},\n                {\n                    \"type\": \"input_file\",\n                    \"file_url\": \"https://www.berkshirehathaway.com/letters/2024ltr.pdf\",\n                },\n            ],\n        }\n    ],\n)\n\nprint(response.output_text)\n"
          },
          {
            "lang": "Python",
            "label": "Web Search",
            "source": "import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n    base_url=\"https://api.cometapi.com/v1\",\n    api_key=os.environ[\"COMETAPI_KEY\"],\n)\n\nresponse = client.responses.create(\n    model=\"gpt-5.6-sol\",\n    tools=[{\"type\": \"web_search_preview\"}],\n    input=\"What was a positive news story from today?\",\n)\n\nprint(response.output_text)\n"
          },
          {
            "lang": "Python",
            "label": "Streaming",
            "source": "import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n    base_url=\"https://api.cometapi.com/v1\",\n    api_key=os.environ[\"COMETAPI_KEY\"],\n)\n\nstream = client.responses.create(\n    model=\"gpt-5.6-sol\",\n    input=\"Tell me a three sentence bedtime story about a unicorn.\",\n    stream=True,\n)\n\nfor event in stream:\n    print(event)\n"
          },
          {
            "lang": "Python",
            "label": "Functions",
            "source": "import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n    base_url=\"https://api.cometapi.com/v1\",\n    api_key=os.environ[\"COMETAPI_KEY\"],\n)\n\nresponse = client.responses.create(\n    model=\"gpt-5.6-sol\",\n    input=\"What is the weather like in Boston today?\",\n    tools=[\n        {\n            \"type\": \"function\",\n            \"name\": \"get_current_weather\",\n            \"description\": \"Get the current weather in a given location\",\n            \"parameters\": {\n                \"type\": \"object\",\n                \"properties\": {\n                    \"location\": {\n                        \"type\": \"string\",\n                        \"description\": \"The city and state, e.g. San Francisco, CA\",\n                    },\n                    \"unit\": {\"type\": \"string\", \"enum\": [\"celsius\", \"fahrenheit\"]},\n                },\n                \"required\": [\"location\", \"unit\"],\n            },\n        }\n    ],\n)\n\nprint(response.output)\n"
          },
          {
            "lang": "Python",
            "label": "Reasoning",
            "source": "import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n    base_url=\"https://api.cometapi.com/v1\",\n    api_key=os.environ[\"COMETAPI_KEY\"],\n)\n\nresponse = client.responses.create(\n    model=\"o4-mini\",\n    input=\"How much wood would a woodchuck chuck?\",\n    reasoning={\"effort\": \"high\"},\n)\n\nprint(response.output_text)\n"
          },
          {
            "lang": "JavaScript",
            "label": "Text Input",
            "source": "import OpenAI from \"openai\";\n\nconst client = new OpenAI({\n    baseURL: \"https://api.cometapi.com/v1\",\n    apiKey: process.env.COMETAPI_KEY,\n});\n\nconst response = await client.responses.create({\n    model: \"gpt-5.6-sol\",\n    input: \"Tell me a three sentence bedtime story about a unicorn.\",\n});\n\nconsole.log(response.output_text);\n"
          },
          {
            "lang": "JavaScript",
            "label": "Image Input",
            "source": "import OpenAI from \"openai\";\n\nconst client = new OpenAI({\n    baseURL: \"https://api.cometapi.com/v1\",\n    apiKey: process.env.COMETAPI_KEY,\n});\n\nconst response = await client.responses.create({\n    model: \"gpt-5.6-sol\",\n    input: [\n        {\n            role: \"user\",\n            content: [\n                { type: \"input_text\", text: \"What is in this image?\" },\n                {\n                    type: \"input_image\",\n                    image_url: \"https://images.unsplash.com/photo-1500530855697-b586d89ba3ee?w=1200\",\n                },\n            ],\n        },\n    ],\n});\n\nconsole.log(response.output_text);\n"
          },
          {
            "lang": "JavaScript",
            "label": "File Input",
            "source": "import OpenAI from \"openai\";\n\nconst client = new OpenAI({\n    baseURL: \"https://api.cometapi.com/v1\",\n    apiKey: process.env.COMETAPI_KEY,\n});\n\nconst response = await client.responses.create({\n    model: \"gpt-5.6-sol\",\n    input: [\n        {\n            role: \"user\",\n            content: [\n                { type: \"input_text\", text: \"What is in this file?\" },\n                {\n                    type: \"input_file\",\n                    file_url: \"https://www.berkshirehathaway.com/letters/2024ltr.pdf\",\n                },\n            ],\n        },\n    ],\n});\n\nconsole.log(response.output_text);\n"
          },
          {
            "lang": "JavaScript",
            "label": "Web Search",
            "source": "import OpenAI from \"openai\";\n\nconst client = new OpenAI({\n    baseURL: \"https://api.cometapi.com/v1\",\n    apiKey: process.env.COMETAPI_KEY,\n});\n\nconst response = await client.responses.create({\n    model: \"gpt-5.6-sol\",\n    tools: [{ type: \"web_search_preview\" }],\n    input: \"What was a positive news story from today?\",\n});\n\nconsole.log(response.output_text);\n"
          },
          {
            "lang": "JavaScript",
            "label": "Streaming",
            "source": "import OpenAI from \"openai\";\n\nconst client = new OpenAI({\n    baseURL: \"https://api.cometapi.com/v1\",\n    apiKey: process.env.COMETAPI_KEY,\n});\n\nconst stream = await client.responses.create({\n    model: \"gpt-5.6-sol\",\n    input: \"Tell me a three sentence bedtime story about a unicorn.\",\n    stream: true,\n});\n\nfor await (const event of stream) {\n    if (event.type === \"response.output_text.delta\") {\n        process.stdout.write(event.delta);\n    }\n}\n"
          },
          {
            "lang": "JavaScript",
            "label": "Functions",
            "source": "import OpenAI from \"openai\";\n\nconst client = new OpenAI({\n    baseURL: \"https://api.cometapi.com/v1\",\n    apiKey: process.env.COMETAPI_KEY,\n});\n\nconst response = await client.responses.create({\n    model: \"gpt-5.6-sol\",\n    input: \"What is the weather like in Boston today?\",\n    tools: [\n        {\n            type: \"function\",\n            name: \"get_current_weather\",\n            description: \"Get the current weather in a given location\",\n            parameters: {\n                type: \"object\",\n                properties: {\n                    location: { type: \"string\", description: \"The city and state\" },\n                    unit: { type: \"string\", enum: [\"celsius\", \"fahrenheit\"] },\n                },\n                required: [\"location\", \"unit\"],\n            },\n        },\n    ],\n});\n\nconsole.log(response.output);\n"
          },
          {
            "lang": "JavaScript",
            "label": "Reasoning",
            "source": "import OpenAI from \"openai\";\n\nconst client = new OpenAI({\n    baseURL: \"https://api.cometapi.com/v1\",\n    apiKey: process.env.COMETAPI_KEY,\n});\n\nconst response = await client.responses.create({\n    model: \"o4-mini\",\n    input: \"How much wood would a woodchuck chuck?\",\n    reasoning: { effort: \"high\" },\n});\n\nconsole.log(response.output_text);\n"
          },
          {
            "lang": "Shell",
            "label": "Text Input",
            "source": "curl https://api.cometapi.com/v1/responses \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer $COMETAPI_KEY\" \\\n  -d '{\n    \"model\": \"gpt-5.6-sol\",\n    \"input\": \"Tell me a three sentence bedtime story about a unicorn.\"\n  }'\n"
          },
          {
            "lang": "Shell",
            "label": "Image Input",
            "source": "curl https://api.cometapi.com/v1/responses \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer $COMETAPI_KEY\" \\\n  -d '{\n    \"model\": \"gpt-5.6-sol\",\n    \"input\": [\n      {\n        \"role\": \"user\",\n        \"content\": [\n          {\"type\": \"input_text\", \"text\": \"What is in this image?\"},\n          {\"type\": \"input_image\", \"image_url\": \"https://images.unsplash.com/photo-1500530855697-b586d89ba3ee?w=1200\"}\n        ]\n      }\n    ]\n  }'\n"
          },
          {
            "lang": "Shell",
            "label": "File Input",
            "source": "curl https://api.cometapi.com/v1/responses \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer $COMETAPI_KEY\" \\\n  -d '{\n    \"model\": \"gpt-5.6-sol\",\n    \"input\": [\n      {\n        \"role\": \"user\",\n        \"content\": [\n          {\"type\": \"input_text\", \"text\": \"What is in this file?\"},\n          {\"type\": \"input_file\", \"file_url\": \"https://www.berkshirehathaway.com/letters/2024ltr.pdf\"}\n        ]\n      }\n    ]\n  }'\n"
          },
          {
            "lang": "Shell",
            "label": "Web Search",
            "source": "curl https://api.cometapi.com/v1/responses \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer $COMETAPI_KEY\" \\\n  -d '{\n    \"model\": \"gpt-5.6-sol\",\n    \"tools\": [{\"type\": \"web_search_preview\"}],\n    \"input\": \"What was a positive news story from today?\"\n  }'\n"
          },
          {
            "lang": "Shell",
            "label": "Streaming",
            "source": "curl https://api.cometapi.com/v1/responses \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer $COMETAPI_KEY\" \\\n  -d '{\n    \"model\": \"gpt-5.6-sol\",\n    \"input\": \"Tell me a three sentence bedtime story about a unicorn.\",\n    \"stream\": true\n  }'\n"
          },
          {
            "lang": "Shell",
            "label": "Functions",
            "source": "curl https://api.cometapi.com/v1/responses \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer $COMETAPI_KEY\" \\\n  -d '{\n    \"model\": \"gpt-5.6-sol\",\n    \"input\": \"What is the weather like in Boston today?\",\n    \"tools\": [\n      {\n        \"type\": \"function\",\n        \"name\": \"get_current_weather\",\n        \"description\": \"Get the current weather in a given location\",\n        \"parameters\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"location\": {\"type\": \"string\", \"description\": \"The city and state\"},\n            \"unit\": {\"type\": \"string\", \"enum\": [\"celsius\", \"fahrenheit\"]}\n          },\n          \"required\": [\"location\", \"unit\"]\n        }\n      }\n    ]\n  }'\n"
          },
          {
            "lang": "Shell",
            "label": "Reasoning",
            "source": "curl https://api.cometapi.com/v1/responses \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer $COMETAPI_KEY\" \\\n  -d '{\n    \"model\": \"o4-mini\",\n    \"input\": \"How much wood would a woodchuck chuck?\",\n    \"reasoning\": {\"effort\": \"high\"}\n  }'\n"
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "Bearer token authentication. Use your CometAPI key."
      }
    }
  }
}