### Install OpenAI SDK and Make API Call (JavaScript) Source: https://docs.hicap.ai/quickstart Install the OpenAI SDK for Node.js, Deno, or Bun using npm. Then, use the SDK to make a chat completion API call to HICAP with a 'Hello World' message. The response content is then logged to the console. ```bash npm install openai ``` ```javascript import OpenAI from "openai"; const apiKey = "YOUR-API-KEY"; const client = new OpenAI({ baseURL: "https://api.hicap.ai/v1", apiKey: apiKey, defaultHeaders: { "api-key": apiKey }, }); const response = await client.chat.completions.create({ model: "gpt-5", messages: [{ role: "user", content: "Hello World", name: "developer" }], }); console.log(response.choices[0].message.content); ``` -------------------------------- ### Install OpenAI SDK and Make API Call (Python) Source: https://docs.hicap.ai/quickstart Install the OpenAI SDK for Python using pip. Subsequently, utilize the SDK to execute a chat completion API request to HICAP, sending a 'Hello World' message. The content of the response is then printed. ```bash pip install openai ``` ```python from openai import OpenAI api_key = "YOUR-API-KEY" client = OpenAI( base_url="https://api.hicap.ai/v1", api_key=api_key, default_headers={ "api-key": api_key }, ) response = client.chat.completions.create( model="gpt-5", messages=[{ "role": "user", "content": "Hello World", "name": "developer" }], ) print(response.choices[0].message.content); ``` -------------------------------- ### Make API Call using cURL Source: https://docs.hicap.ai/quickstart This snippet demonstrates how to make a POST request to the HICAP API's chat completions endpoint using cURL. It includes the necessary headers and a JSON payload with a 'Hello World' message. ```bash curl --request POST \ --url https://api.hicap.ai/v1/chat/completions \ --header 'Content-Type: application/json' \ --header 'api-key: YOUR-API-KEY' \ --data '{ \ "model": "gpt-5", \ "messages": [ \ { \ "content": "Hello World", \ "role": "user", \ "name": "developer" \ } \ ] \ }' ``` -------------------------------- ### Anthropic Models Configuration (JavaScript) Source: https://docs.hicap.ai/providers/table-comparison Defines an array of Anthropic model configurations. Each object specifies the model name, its best use cases, input modalities, and code. This snippet is a starting point for integrating Anthropic models, similar to the OpenAI configuration. ```javascript export const anthropicModels = [{"model": "claude-sonnet-4.5", "best": "Enterprise copilots, advanced coding and debugging, legal/financial document analysis, product and design QA, structured reasoning tasks. Ideal when you want high intelligence at practical scale.", "input": "Text, Image, Code"}]; ``` -------------------------------- ### OpenAI Models Configuration (JavaScript) Source: https://docs.hicap.ai/providers/table-comparison Defines an array of OpenAI model configurations. Each object specifies the model name, its best use cases, input and output modalities, context window size, maximum output tokens, and knowledge cutoff date. This data structure is useful for dynamically selecting and configuring OpenAI models in an application. ```javascript export const openAIModels = [{"model": "gpt-5.2", "best": "Complex reasoning, long-form generation, decision support, and multimodal chat experiences where accuracy, consistency, and instruction adherence are critical.", "input": "Text, image", "output": "Text", "contextWindow": "400,000", "maxOutputTokens": "128,000", "knowledgeCutoff": "August 31, 2025"}, {"model": "gpt-5.2-chat-latest", "best": "Interactive chat applications, assistants, customer support, and real-time conversational experiences where responsiveness, conversational flow, and contextual continuity are essential.", "input": "Text, image", "output": "Text", "contextWindow": "128,000", "maxOutputTokens": "16,384", "knowledgeCutoff": "August 31, 2025"}, {"model": "gpt-5.1", "best": "General-purpose text generation, summarization, content drafting, and standard chat or assistant workloads where reliability and efficiency are more important than maximum reasoning depth.", "input": "Text, image", "output": "Text", "contextWindow": "400,000", "maxOutputTokens": "128,000", "knowledgeCutoff": "September 30, 2024"}, {"model": "gpt-5.1-chat-latest", "best": "Everyday chat assistants, customer support, guided interactions, and conversational interfaces where speed, clarity, and reliability are the primary requirements.", "input": "Text, image", "output": "Text", "contextWindow": "128,000", "maxOutputTokens": "16,384", "knowledgeCutoff": "September 30, 2024"}, {"model": "gpt-5", "best": "Enterprise-grade copilots, advanced software development, strategic research, product/financial/legal analysis, high-quality multimodal content generation. Best when you need maximum depth and reliability.", "input": "Text, image", "output": "Text", "contextWindow": "400,000", "maxOutputTokens": "128,000", "knowledgeCutoff": "September 30, 2024"}, {"model": "gpt-5-chat", "best": "General conversational interaction and multimodal reasoning. Ideal for answering questions, generating creative and explanatory content, summarizing documents, translating languages, analyzing images, and serving as a versatile virtual assistant across a wide range of non-specialized tasks.", "input": "Text, image", "output": "Text, Image, Code", "contextWindow": "400,000", "maxOutputTokens": "128,000", "knowledgeCutoff": "September 30, 2024"}, {"model": "gpt-5-mini", "best": "A lighter and faster variant of GPT-5. Preserves strong reasoning and coding ability, but optimized for lower latency and cost. Good balance between performance and efficiency.", "input": "Text, Image", "output": "Text", "contextWindow": "400,000", "maxOutputTokens": "128,000", "knowledgeCutoff": "May 30, 2024"}, {"model": "gpt-5-nano", "best": "Real-time assistants, mobile/edge use cases, autocomplete, customer service chat, high-volume RAG queries. Best when cost + speed > deep reasoning.", "input": "Text, Image", "output": "Text", "contextWindow": "400,000", "maxOutputTokens": "128,000", "knowledgeCutoff": "May 30, 2024"}, {"model": "gpt-4o", "best": "Multimodal copilots (voice, image, video), real-time assistants, design/code reviews, customer-facing apps, and enterprise agents that require both contextual reasoning + speed.", "input": "Text, Image, Audio, Video, Code", "output": "Text, Audio, Image (limited)", "contextWindow": "128,000", "maxOutputTokens": "16,384", "knowledgeCutoff": "October 1, 2023"}, {"model": "gpt-4o-mini", "best": "Scalable chatbots, QA systems, RAG pipelines, lightweight coding assistants, and UX/product copilots where cost efficiency + responsiveness matter.", "input": "Text, Image, Code", "output": "Text", "contextWindow": "128,000", "maxOutputTokens": "16,384", "knowledgeCutoff": "October 1, 2023"}, {"model": "gpt-4.1", "best": "Advanced data analysis, high-fidelity content creation, software architecture design, and analytical copilots requiring maximum reliability and depth.", "input": "Text, Code", "output": "Text", "contextWindow": "1,000,000", "maxOutputTokens": "32,000", "knowledgeCutoff": "June 1, 2024"}, {"model": "gpt-4.1-mini", "best": "Mid-complexity workflows: documentation QA, data summarization, low-latency coding copilots, or iterative product feedback systems.", "input": "Text, Code", "output": "Text", "contextWindow": "1,000,000", "maxOutputTokens": "32,000", "knowledgeCutoff": "June 1, 2024"}, {"model": "gpt-4.1-nano", "best": "Autocomplete, message classification, semantic search ranking, basic natural-language logic tasks, and embedded AI tools. Ideal for speed-critical micro-agents.", "input": "Text", "output": "Text", "contextWindow": "1,000,000", "maxOutputTokens": "32,000", "knowledgeCutoff": "June 1, 2024"}]; ``` -------------------------------- ### POST /chat/completions Configuration Source: https://docs.hicap.ai/api-reference/endpoints/openAI/creates-a-completion-for-the-chat-message Endpoints and schemas for managing tool selection, function definitions, and service tier processing for chat completions. ```APIDOC ## POST /chat/completions ### Description Configures how the model interacts with tools and functions, and selects the service tier for request processing. ### Method POST ### Endpoint /chat/completions ### Parameters #### Request Body - **tool_choice** (string/object) - Optional - Defines how the model calls tools. Options: `none`, `auto`, `required`, or a specific tool object. - **service_tier** (string) - Optional - Specifies processing tier: `auto`, `default`, `flex`, or `priority`. - **functions** (array) - Optional - Deprecated list of function definitions for the model to use. ### Request Example { "tool_choice": "auto", "service_tier": "default" } ### Response #### Success Response (200) - **role** (string) - The role of the message author. - **content** (string) - The text content of the response. - **tool_calls** (array) - List of tool calls generated by the model. - **service_tier** (string) - The actual service tier used for the request. #### Response Example { "role": "assistant", "content": "Hello! How can I help you?", "service_tier": "default" } ``` -------------------------------- ### Chat Completion Configuration Source: https://docs.hicap.ai/api-reference/endpoints/openAI/creates-a-completion-for-the-chat-message This section details the configuration options available for chat completions, including function calling, maximum tokens, parallel tool calls, prompt caching, service tier, verbosity, and web search options. ```APIDOC ## Chat Completion Configuration ### Description Configuration options for chat completions, including parameters that control model behavior, tool usage, and response generation. ### Method N/A (Configuration parameters) ### Endpoint N/A (Configuration parameters) ### Parameters #### Query Parameters - **functions** (array) - Deprecated - A list of functions the model may generate JSON inputs for. - **max_tokens** (integer) - Deprecated - The maximum number of tokens that can be generated in the chat completion. - **parallel_tool_calls** (boolean) - Whether to enable parallel function calling during tool use. - **prompt_cache_retention** (string) - The retention policy for the prompt cache. Set to `24h` to enable extended prompt caching. - **service_tier** (object) - Reference to the service tier schema. - **verbosity** (string) - Constrains the verbosity of the model's response. Supported values: `low`, `medium`, `high`. Default: `medium`. #### Request Body - **function_call_option** (string or object) - Controls function calling behavior. Can be `none`, `auto`, or a schema reference to `chatCompletionFunctionCallOption`. ### Request Example ```json { "function_call_option": "auto", "functions": [ { "name": "get_weather", "description": "Get weather information", "parameters": { "type": "object", "properties": { "location": { "type": "string", "description": "The city and state, e.g. San Francisco, CA" }, "unit": { "type": "string", "enum": ["celsius", "fahrenheit"] } }, "required": ["location"] } } ], "max_tokens": 100, "parallel_tool_calls": true, "prompt_cache_retention": "24h", "service_tier": { "tier": "premium" }, "verbosity": "high", "web_search_options": { "search_context_size": "medium", "user_location": { "approximate": { "city": "San Francisco", "region": "CA", "country": "US", "timezone": "America/Los_Angeles" }, "type": "approximate" } } } ``` ### Response #### Success Response (200) - **N/A** (The response structure depends on the specific API call using these configurations.) #### Response Example ```json { "message": "Configuration applied successfully." } ``` ``` -------------------------------- ### Claude Model Specifications Source: https://docs.hicap.ai/providers/table-comparison This snippet details the specifications for various Claude AI models. It includes information on the model name, its primary use cases ('best'), supported input and output modalities, context window size, maximum output tokens, and knowledge cut-off date. This data is useful for understanding the capabilities and limitations of each Claude model for different applications. ```javascript export const claudeModels = [{ model: 'claude-3-opus-20240229', best: 'Deep reasoning, complex analysis, long-form writing, policy-heavy workflows, and high-stakes tasks where precision, context awareness, and thoughtful responses are essential.', input: 'Text, Image', output: 'Text', contextWindow: '200,000', maxOutputTokens: '64,000', knowledgeCutoff: 'May 2025' }, { model: 'claude-3-sonnet-20240229', best: 'Deep document analysis (legal, technical, research) with embedded visuals, large-scale design system validation, long historical chat/session review, and knowledge-base copilots that need persistent memory across massive inputs.', input: 'Text, Image, Code', output: 'Text', contextWindow: '', maxOutputTokens: '', knowledgeCutoff: '' }, { model: 'claude-3-haiku-20240307', best: 'High-throughput chatbots, customer support automation, RAG summarizers, quick document Q&A, or embedded assistants where speed and affordability matter most.', input: 'Text, image', output: 'Text', contextWindow: '200,000', maxOutputTokens: '64,000', knowledgeCutoff: 'February 1, 2025' }, { model: 'claude-3-opus-20240229-v1.1', best: 'Strategic decision-making, in-depth research, advanced coding and debugging, legal/financial/technical analysis, high-stakes content generation (contracts, reports, product strategy docs). Best when quality > cost/latency.', input: 'Text, Image, Code', output: 'Text', contextWindow: '200,000', maxOutputTokens: '32,000', knowledgeCutoff: 'March 1, 2025' }, { model: 'claude-3-opus-20240229-v1.0', best: 'Strategic and analytical tasks where precision, reasoning depth, and interpretability matter most — e.g., legal or financial analysis, multi-step research, technical documentation, and advanced coding/debugging workflows.', input: 'Text, Image, Code', output: 'Text', contextWindow: '200,000', maxOutputTokens: '32,000', knowledgeCutoff: 'March 1, 2025' }, { model: 'claude-3.5-sonnet-20240620', best: 'General enterprise copilots, technical writing, product documentation, Figma/UI reviews, code explanation and debugging. Ideal when you need smart but affordable reasoning.', input: 'Text, Image, Code', output: 'Text', contextWindow: '200,000', maxOutputTokens: '8,192', knowledgeCutoff: 'April 1, 2024' }, { model: 'claude-3.5-haiku-20240620', best: 'Real-time assistants, chatbots, RAG queries, customer support, lightweight summarization, or any latency-sensitive app.', input: 'Text, Image', output: 'Text', contextWindow: '200,000', maxOutputTokens: '8,192', knowledgeCutoff: 'July 1, 2024' }]; ``` -------------------------------- ### POST /chat/completions Configuration Source: https://docs.hicap.ai/api-reference/endpoints/openAI/creates-a-completion-for-the-chat-message Defines the request parameters for configuring chat completion behavior, including token constraints, penalties, and user safety identifiers. ```APIDOC ## POST /chat/completions ### Description Configures the parameters for a chat completion request, allowing fine-tuning of model output, token usage, and safety tracking. ### Method POST ### Endpoint /chat/completions ### Parameters #### Request Body - **max_completion_tokens** (integer) - Optional - Upper bound for generated tokens. - **presence_penalty** (number) - Optional - Penalizes tokens based on appearance (range: -2.0 to 2.0). - **frequency_penalty** (number) - Optional - Penalizes tokens based on frequency (range: -2.0 to 2.0). - **logit_bias** (object) - Optional - Maps token IDs to bias values (-100 to 100). - **store** (boolean) - Optional - Whether to store output for distillation/evals. - **metadata** (object) - Optional - Key-value pairs (max 16) for object tracking. - **safety_identifier** (string) - Required - Unique ID for detecting policy violations. - **prompt_cache_key** (string) - Required - Identifier for cache optimization. ### Request Example { "max_completion_tokens": 500, "presence_penalty": 0.5, "safety_identifier": "user_hash_123", "prompt_cache_key": "cache_key_abc" } ### Response #### Success Response (200) - **id** (string) - Unique completion ID. - **choices** (array) - List of generated completions. #### Response Example { "id": "chatcmpl-123", "choices": [{"message": {"role": "assistant", "content": "Hello!"}}] } ``` -------------------------------- ### POST /chat/completions Source: https://docs.hicap.ai/api-reference/endpoints/openAI/creates-a-completion-for-the-chat-message Creates a model response for a given chat conversation. Supports multi-modal inputs and configurable reasoning efforts. ```APIDOC ## POST /chat/completions ### Description Creates a model response for the given chat conversation. This endpoint supports text-based messaging and optional audio output configurations. ### Method POST ### Endpoint https://api.hicap.ai/v1/chat/completions ### Request Body - **messages** (array) - Required - A list of messages comprising the conversation so far. - **modalities** (array) - Optional - The modalities to use for the response (e.g., text, audio). - **audio** (object) - Optional - Parameters for audio output (voice, format). Required when modalities include 'audio'. - **reasoning_effort** (string) - Optional - Constrains reasoning effort for supported models (none, minimal, low, medium, high, xhigh). ### Request Example { "messages": [{"role": "user", "content": "Hello!"}], "modalities": ["text"] } ### Response #### Success Response (200) - **id** (string) - Unique identifier for the chat completion. - **choices** (array) - The list of completion choices generated by the model. #### Response Example { "id": "chatcmpl-123", "object": "chat.completion", "choices": [{ "message": { "role": "assistant", "content": "Hello! How can I help you today?" } }] } ``` -------------------------------- ### Google Gemini Model Specifications Source: https://docs.hicap.ai/providers/table-comparison This snippet lists the specifications for various Google Gemini AI models. It includes model names, their intended applications ('best'), supported input and output types, context window size, maximum output tokens, and knowledge cut-off dates. This information is crucial for selecting the right Gemini model for diverse tasks, from advanced reasoning to low-latency chat applications. ```javascript export const googleModels = [{ model: 'gemini-3-pro-preview', best: 'Advanced reasoning, complex multimodal workflows, research-oriented tasks, and early adoption scenarios where maximum capability and depth are prioritized over cost or latency.', input: 'Text, Image, Audio, Video, PDF', output: 'Text', contextWindow: '1,000,000', maxOutputTokens: '64,000', knowledgeCutoff: '' }, { model: 'gemini-3-flash-preview', best: 'Low-latency, high-throughput chat, summarization, and multimodal extraction in production environments where speed and cost efficiency are critical.', input: 'Text, Image', output: 'Text', contextWindow: '', maxOutputTokens: '', knowledgeCutoff: '' }, { model: 'gemini-2.5-pro', best: 'Long-context processing: legal contracts spanning thousands of pages, large codebases, academic research, reviewing historical chat/log data. Ideal for copilots that need to “remember” or reason over very large corpora.', input: 'Text, Image, Audio, Video, Code', output: 'Text', contextWindow: '', maxOutputTokens: '', knowledgeCutoff: '' }, { model: 'gemini-2.5-flash', best: 'Low latency/high throughput for chat, summarization, and multimodal extraction at a lower cost.', input: 'Text, Image, Audio, Video, Code', output: 'Text, Image, Audio, Video, Code', contextWindow: '1,048,576', maxOutputTokens: '65,536', knowledgeCutoff: 'January 1, 2025' }, { model: 'gemini-2.5-flash-image', best: 'Fast and cost-effective text-to-image generation, iterative image editing, and visual asset creation for marketing, design, and creative workflows.', input: 'Text, Image', output: 'Image', contextWindow: '', maxOutputTokens: '', knowledgeCutoff: '' }, { model: 'gemini-2.5-flash-lite', best: 'High-throughput, latency-sensitive tasks: chatbots with large user volumes, quick autocomplete, real-time customer support, fast retrieval-augmented generation (RAG), and mobile/embedded use cases where cost and speed matter more than depth.', input: 'Text, Image, Audio', output: 'Text', contextWindow: '', maxOutputTokens: '', knowledgeCutoff: '' }]; ``` -------------------------------- ### POST /v1/chat/completions Source: https://docs.hicap.ai/api-reference/endpoints/openAI/creates-a-completion-for-the-chat-message Creates a chat completion request and returns a response. This endpoint is suitable for non-streaming use cases. ```APIDOC ## POST /v1/chat/completions ### Description Creates a chat completion request and returns a response. This endpoint is suitable for non-streaming use cases. ### Method POST ### Endpoint /v1/chat/completions ### Parameters #### Query Parameters - **model** (string) - Required - The ID of the model to use for this request. - **messages** (array) - Required - The messages to send to the model. - **role** (string) - Required - The role of the author of the message. One of `system`, `user`, or `assistant`. - **content** (string) - Required - The content of the message. - **temperature** (number) - Optional - Controls randomness. Lower values make the output more focused and deterministic. - **top_p** (number) - Optional - Controls diversity via nucleus sampling. The model considers only tokens comprising the top p probability mass. - **n** (integer) - Optional - How many chat completion choices to generate for each input message. - **stream** (boolean) - Optional - Whether to stream back partial message deltas as they are generated, ending with a "stop event". - **stop** (string or array) - Optional - Up to 4 sequences where the API will stop generating further tokens. - **max_tokens** (integer) - Optional - The maximum number of tokens to generate in the completion. - **presence_penalty** (number) - Optional - Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics. - **frequency_penalty** (number) - Optional - Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the completion so far, decreasing the model's likelihood to repeat the same line. - **logit_bias** (object) - Optional - A map of token IDs to an associated bias value from -100 to 100. - **user** (string) - Optional - A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. - **seed** (integer) - Optional - A seed for reproducible results. ### Request Example ```json { "model": "gpt-3.5-turbo", "messages": [ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Who won the world series in 2020?"} ] } ``` ### Response #### Success Response (200) - **id** (string) - A unique identifier for the chat completion. - **choices** (array) - A list of chat completion choices. - **finish_reason** (string) - The reason the model stopped generating tokens. - **index** (integer) - The index of the choice. - **message** (object) - The message content. - **role** (string) - The role of the author. - **content** (string) - The content of the message. - **logprobs** (object) - Log probability information for the choice. - **created** (integer) - The Unix timestamp of when the chat completion was created. - **model** (string) - The model used for the chat completion. - **system_fingerprint** (string) - Backend configuration fingerprint. - **object** (string) - The object type, always `chat.completion`. - **service_tier** (string) - The service tier used. - **usage** (object) - Usage statistics for the completion. #### Response Example ```json { "id": "chatcmpl-123", "object": "chat.completion", "created": 1677652288, "model": "gpt-3.5-turbo-0613", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "The Los Angeles Dodgers won the World Series in 2020." }, "logprobs": null, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 10, "completion_tokens": 15, "total_tokens": 25 }, "system_fingerprint": "fp_abc123" } ``` ``` -------------------------------- ### POST /chat/completions Configuration Source: https://docs.hicap.ai/api-reference/endpoints/openAI/creates-a-completion-for-the-chat-message Defines the optional parameters for the Chat Completion request body, allowing for fine-tuned control over model output, format, and behavior. ```APIDOC ## POST /chat/completions ### Description Configures the behavior of the chat completion model, including output format, sampling determinism, and tool integration. ### Method POST ### Endpoint /chat/completions ### Request Body - **logit_bias** (object) - Optional - Map of token IDs to bias values. - **logprobs** (boolean) - Optional - Whether to return log probabilities of output tokens. - **top_logprobs** (integer) - Optional - Number of most likely tokens to return at each position (0-20). - **n** (integer) - Optional - Number of chat completion choices to generate. - **prediction** (object) - Optional - Configuration for predicted outputs to improve response times. - **response_format** (object) - Optional - Specifies the output format (e.g., json_object, json_schema). - **seed** (integer) - Optional - Beta feature for deterministic sampling. - **stream_options** (object) - Optional - Options for streaming responses. - **tools** (array) - Optional - List of tools the model may call. - **tool_choice** (object) - Optional - Controls which tool the model calls. ### Request Example { "n": 1, "logprobs": false, "response_format": { "type": "json_object" } } ### Response #### Success Response (200) - **choices** (array) - The generated completions. - **system_fingerprint** (string) - Identifier for the backend configuration used. #### Response Example { "id": "chatcmpl-123", "choices": [{"message": {"content": "Hello!"}}], "system_fingerprint": "fp_44709d6fcb" } ``` -------------------------------- ### POST /v1/chat/completions (Streaming) Source: https://docs.hicap.ai/api-reference/endpoints/openAI/creates-a-completion-for-the-chat-message Creates a chat completion request and streams back partial message deltas as they are generated. This endpoint is suitable for real-time applications. ```APIDOC ## POST /v1/chat/completions (Streaming) ### Description Creates a chat completion request and streams back partial message deltas as they are generated. This endpoint is suitable for real-time applications. ### Method POST ### Endpoint /v1/chat/completions ### Parameters #### Query Parameters - **model** (string) - Required - The ID of the model to use for this request. - **messages** (array) - Required - The messages to send to the model. - **role** (string) - Required - The role of the author of the message. One of `system`, `user`, or `assistant`. - **content** (string) - Required - The content of the message. - **temperature** (number) - Optional - Controls randomness. Lower values make the output more focused and deterministic. - **top_p** (number) - Optional - Controls diversity via nucleus sampling. The model considers only tokens comprising the top p probability mass. - **n** (integer) - Optional - How many chat completion choices to generate for each input message. - **stream** (boolean) - Required - Must be set to `true` to enable streaming. - **stop** (string or array) - Optional - Up to 4 sequences where the API will stop generating further tokens. - **max_tokens** (integer) - Optional - The maximum number of tokens to generate in the completion. - **presence_penalty** (number) - Optional - Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics. - **frequency_penalty** (number) - Optional - Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the completion so far, decreasing the model's likelihood to repeat the same line. - **logit_bias** (object) - Optional - A map of token IDs to an associated bias value from -100 to 100. - **user** (string) - Optional - A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. - **seed** (integer) - Optional - A seed for reproducible results. ### Request Example ```json { "model": "gpt-3.5-turbo", "messages": [ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Explain the concept of recursion."} ], "stream": true } ``` ### Response #### Success Response (200) - **id** (string) - A unique identifier for the chat completion. Each chunk has the same ID. - **choices** (array) - A list of chat completion choices. Can contain more than one element if `n` is greater than 1. - **delta** (object) - The delta content of the message. - **role** (string) - The role of the author (only present in the first chunk). - **content** (string) - The content of the message chunk. - **logprobs** (object) - Log probability information for the choice. - **finish_reason** (string) - The reason the model stopped generating tokens. - **index** (integer) - The index of the choice. #### Response Example ```json { "id": "chatcmpl-123", "object": "chat.completion.chunk", "created": 1677652288, "model": "gpt-3.5-turbo-0613", "choices": [ { "index": 0, "delta": { "role": "assistant", "content": "Recursion is a method of solving a problem where" }, "logprobs": null, "finish_reason": null } ] } ``` ```json { "id": "chatcmpl-123", "object": "chat.completion.chunk", "created": 1677652289, "model": "gpt-3.5-turbo-0613", "choices": [ { "index": 0, "delta": { "content": " the solution depends on smaller instances of the same problem." }, "logprobs": null, "finish_reason": null } ] } ``` ```json { "id": "chatcmpl-123", "object": "chat.completion.chunk", "created": 1677652290, "model": "gpt-3.5-turbo-0613", "choices": [ { "index": 0, "delta": { }, "logprobs": null, "finish_reason": "stop" } ] } ``` ``` -------------------------------- ### POST /chat/completions Source: https://docs.hicap.ai/api-reference/endpoints/openAI/creates-a-completion-for-the-chat-message Endpoint to generate chat completions based on provided model parameters and input configurations. ```APIDOC ## POST /chat/completions ### Description Generates a chat completion response using the specified model. Supports streaming, temperature control, and nucleus sampling. ### Method POST ### Endpoint /chat/completions ### Parameters #### Request Body - **model** (string) - Optional - Model ID used to generate the response. Default: gpt-5.2 - **temperature** (number) - Optional - Sampling temperature between 0 and 2. Default: 1 - **top_p** (number) - Optional - Nucleus sampling probability mass between 0 and 1. - **stream** (boolean) - Optional - If true, enables server-sent events for streaming responses. Default: false - **stop** (string/array) - Optional - Up to 4 sequences where the API will stop generating tokens. ### Request Example { "model": "gpt-5.2", "temperature": 1, "stream": false } ### Response #### Success Response (200) - **id** (string) - Unique identifier for the completion. - **choices** (array) - List of generated completion choices. - **created** (integer) - Unix timestamp of creation. - **model** (string) - The model used for generation. #### Response Example { "id": "chatcmpl-123", "object": "chat.completion.chunk", "created": 1677652288, "model": "gpt-5.2", "choices": [ { "index": 0, "finish_reason": "stop" } ] } ``` -------------------------------- ### Chat Completion Options Source: https://docs.hicap.ai/api-reference/endpoints/openAI/creates-a-completion-for-the-chat-message Configuration options for chat completion requests, including stream obfuscation and usage reporting. ```APIDOC ## Chat Completion Options ### Description Configuration options for chat completion requests, including stream obfuscation and usage reporting. ### Parameters #### Request Body - **include_obfuscation** (boolean) - Optional - When true, stream obfuscation will be enabled. Stream obfuscation adds random characters to an `obfuscation` field on streaming delta events to normalize payload sizes as a mitigation to certain side-channel attacks. These obfuscation fields are included by default, but add a small amount of overhead to the data stream. You can set `include_obfuscation` to false to optimize for bandwidth if you trust the network links between your application and the OpenAI API. - **include_usage** (boolean) - Optional - If set, an additional chunk will be streamed before the `data: [DONE]` message. The `usage` field on this chunk shows the token usage statistics for the entire request, and the `choices` field will always be an empty array. All other chunks will also include a `usage` field, but with a null value. NOTE: If the stream is interrupted, you may not receive the final usage chunk which contains the total token usage for the request. ### Request Example ```json { "include_obfuscation": true, "include_usage": true } ``` ### Response #### Success Response (200) (No specific response fields detailed in the provided text for these options) #### Response Example (No specific response example provided for these options) ``` -------------------------------- ### Chat Completion Data Models Source: https://docs.hicap.ai/api-reference/endpoints/openAI/creates-a-completion-for-the-chat-message Definitions for URL citations, token log probabilities, and usage statistics returned by the chat completion engine. ```APIDOC ## Data Structures ### URL Citation Object Represents a web search citation within a message. - **type** (string) - Required - Must be `url_citation` - **url_citation** (object) - Required - Contains citation metadata: - **end_index** (integer) - Required - Last character index of the citation - **start_index** (integer) - Required - First character index of the citation - **title** (string) - Optional - Title of the web resource - **url** (string) - Required - URL of the web resource ### Token Logprob Object Contains probability information for generated tokens. - **token** (string) - Required - The generated token - **logprob** (number) - Required - Log probability of the token - **bytes** (array) - Required - UTF-8 byte representation - **top_logprobs** (array) - Required - List of alternative likely tokens ### Completion Usage Object Statistics regarding token consumption. - **prompt_tokens** (integer) - Total tokens in the prompt - **completion_tokens** (integer) - Total tokens generated - **total_tokens** (integer) - Sum of prompt and completion tokens - **prompt_tokens_details** (object) - Breakdown including `audio_tokens` and `cached_tokens` - **completion_tokens_details** (object) - Breakdown including `reasoning_tokens` and prediction statistics ### Response Example { "usage": { "prompt_tokens": 10, "completion_tokens": 5, "total_tokens": 15 }, "logprobs": [ { "token": "hello", "logprob": -0.1, "bytes": [104, 101, 108, 108, 111], "top_logprobs": [] } ] } ``` -------------------------------- ### Tool Calls and Types Source: https://docs.hicap.ai/api-reference/endpoints/openAI/creates-a-completion-for-the-chat-message Defines the structure for tool calls, including function calls and custom tool calls, along with their respective types and descriptions. ```APIDOC ## Tool Calls and Types ### Description This section describes the structure for tool calls generated by the model, specifically function calls and custom tool calls. It outlines the types and associated descriptions for each. ### Method N/A (Schema Definition) ### Endpoint N/A (Schema Definition) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **chatCompletionMessageToolCalls** (array) - The tool calls generated by the model, such as function calls. - `items` (object) - Represents a single tool call. - `oneOf` (array) - Contains possible tool call structures, referencing `chatCompletionMessageToolCall` or `chatCompletionMessageCustomToolCall`. - **toolCallType** (string) - Enum: `function`. The type of the tool call, in this case `function`. - `x-ms-enum` (object) - Metadata for the enum. - `name` (string) - `ToolCallType` - `modelAsString` (boolean) - `true` - `values` (array) - `value` (string) - `function` - `description` (string) - The tool call type is function. - **customToolCallType** (string) - Enum: `custom`. The type of the tool. Always `custom`. - `x-ms-enum` (object) - Metadata for the enum. - `name` (string) - `CustomToolCallType` - `modelAsString` (boolean) - `true` - `values` (array) - `value` (string) - `custom` - `description` (string) - The tool call type is custom. ### Request Example ```json { "tool_calls": [ { "id": "call_abc123", "type": "function", "function": { "name": "get_weather", "arguments": "{\"location\": \"San Francisco\"}" } } ] } ``` ### Response #### Success Response (200) N/A (Schema Definition) #### Response Example N/A (Schema Definition) ``` -------------------------------- ### Chat Completion Tool Choice Option Source: https://docs.hicap.ai/api-reference/endpoints/openAI/creates-a-completion-for-the-chat-message Controls which tool, if any, is called by the model during chat completion. ```APIDOC ## Chat Completion Tool Choice Option ### Description Controls which tool, if any, is called by the model during chat completion. Options include `none` (model generates a message) and `auto` (model can choose between generating a message or calling a tool). ### Parameters #### Request Body - **chatCompletionToolChoiceOption** (string) - Optional - Controls which (if any) tool is called by the model. `none` means the model will not call any tool and instead generates a message. `auto` means the model can pick between generating a message or calling one or more tools. ### Request Example ```json { "chatCompletionToolChoiceOption": "auto" } ``` ### Response #### Success Response (200) (No specific response fields detailed in the provided text for tool choice options) #### Response Example (No specific response example provided for tool choice options) ``` -------------------------------- ### Render AI Model Comparison Table with React Source: https://docs.hicap.ai/providers/table-comparison This component renders a table displaying AI model specifications. It iterates through three distinct data sources (openAIModels, anthropicModels, and googleModels) to populate rows with model details and styling. ```jsx
| Model | Best For | Input | Output | Context Window | Max output tokens | Knowledge cutoff |
|---|---|---|---|---|---|---|
| {model.model} | {model.best} | {model.input} | {model.output} | {model.contextWindow} tokens | {model.maxOutputTokens} tokens | {model.knowledgeCutoff} |