### Implement API Requests in Programming Languages Source: https://docs.concentrate.ai/getting-started/quickstart Provides implementation examples for interacting with the Concentrate AI API using Python, TypeScript, and Go. These examples demonstrate setting headers, sending JSON payloads, and parsing the response. ```python import requests response = requests.post( "https://api.concentrate.ai/v1/responses", headers={ "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json" }, json={ "model": "gpt-5.2", "input": "Explain quantum computing in simple terms" } ) data = response.json() print(data["output"][0]["content"][0]["text"]) ``` ```typescript interface ResponseRequest { model: string; input: string; } async function makeRequest() { const response = await fetch("https://api.concentrate.ai/v1/responses", { method: "POST", headers: { "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json" }, body: JSON.stringify({ model: "gpt-5.2", input: "Explain quantum computing in simple terms" } as ResponseRequest) }); const data = await response.json(); console.log(data.output[0].content[0].text); } makeRequest(); ``` ```go package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { reqBody := map[string]interface{}{ "model": "gpt-5.2", "input": "Explain quantum computing in simple terms", } jsonData, _ := json.Marshal(reqBody) req, _ := http.NewRequest("POST", "https://api.concentrate.ai/v1/responses", bytes.NewBuffer(jsonData)) req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") client := &http.Client{} resp, _ := client.Do(req) defer resp.Body.Close() body, _ := io.ReadAll(resp.Body) fmt.Println(string(body)) } ``` -------------------------------- ### Try Different Models with cURL Source: https://docs.concentrate.ai/getting-started/quickstart This section shows how to use cURL to interact with the Concentrate AI API and experiment with different AI models. Examples include Claude Opus 4.5, Gemini 2.5 Pro, and an auto-routing option for the cheapest model. ```bash curl https://api.concentrate.ai/v1/responses \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "claude-opus-4-5", "input": "Write a haiku about programming" }' ``` ```bash curl https://api.concentrate.ai/v1/responses \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "gemini-2.5-pro", "input": "Explain the theory of relativity" }' ``` ```bash curl https://api.concentrate.ai/v1/responses \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "auto", "input": "Summarize this text", "routing": { "strategy": "min", "metric": "cost" } }' ``` -------------------------------- ### Manage API Keys and Security Source: https://docs.concentrate.ai/getting-started/quickstart Demonstrates the best practice of retrieving API credentials from environment variables rather than hardcoding them in the source code. ```python import os api_key = os.environ.get("CONCENTRATE_API_KEY") ``` -------------------------------- ### Monitor Token Usage Source: https://docs.concentrate.ai/getting-started/quickstart Shows how to extract and log token usage statistics from the API response to track costs and performance. ```python response = requests.post(...) data = response.json() usage = data["usage"] print(f"Tokens used: {usage['total_tokens']}") ``` -------------------------------- ### Send Request to Concentrate AI API (Go) Source: https://docs.concentrate.ai/getting-started/quickstart This Go code snippet demonstrates how to send a POST request to the Concentrate AI API to get a response. It sets the necessary headers, makes the HTTP request, reads the response body, and parses the JSON output to print the content. ```go package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) func main() { url := "https://api.concentrate.ai/v1/responses" jsonData := []byte(`{"model": "gpt-5.2", "input": "Write a short story about a robot"}`) req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData)) req.Header.Set("Content-Type", "application/json") req.Header.Set("Authorization", "Bearer YOUR_API_KEY") client := &http.Client{} resp, _ := client.Do(req) defer resp.Body.Close() body, _ := io.ReadAll(resp.Body) var result map[string]interface{} json.Unmarshal(body, &result) output := result["output"].([]interface{})[0].(map[string]interface{}) content := output["content"].([]interface{})[0].(map[string]interface{}) fmt.Println(content["text"]) } ``` -------------------------------- ### Configure Generation Parameters in Python Source: https://docs.concentrate.ai/getting-started/quickstart Shows how to control model output behavior using parameters like temperature, max_output_tokens, and top_p. These settings allow for fine-tuning the creativity and length of the generated responses. ```python response = requests.post( "https://api.concentrate.ai/v1/responses", headers={"Authorization": "Bearer YOUR_API_KEY"}, json={ "model": "gpt-5.2", "input": "Write a creative story", "temperature": 1.5, "max_output_tokens": 500, "top_p": 0.95 } ) ``` -------------------------------- ### Run Go Program Source: https://docs.concentrate.ai/getting-started/quickstart This command executes a Go program named 'test.go' using the Go runtime. It's typically used to run compiled Go applications or scripts. ```bash go run test.go ``` -------------------------------- ### Make an API Request to Concentrate AI Source: https://docs.concentrate.ai/getting-started/quickstart Demonstrates how to send a POST request to the /v1/responses endpoint to generate AI content. Includes the raw cURL command and the expected JSON response structure. ```bash curl https://api.concentrate.ai/v1/responses \ -H "Content-Type: application/json" \ -H 'accept: application/json' \ -H "Authorization: Bearer YOUR_API_KEY" \ -d '{ "model": "gpt-5.2", "input": "What is the capital of France?" }' ``` ```json { "id": "abcd1234-ab12-cd34-ef56-abcdef12356", "object": "response", "created_at": 1702934400, "status": "completed", "output": [ { "type": "message", "role": "assistant", "content": [ { "type": "output_text", "text": "The capital of France is Paris." } ] } ] } ``` -------------------------------- ### Define Token Limits in JSON Source: https://docs.concentrate.ai/getting-started/quickstart An example of the JSON request body structure used to enforce output length constraints, ensuring predictable and cost-effective API usage. ```json { "model": "gpt-5.2", "input": "Your prompt", "max_output_tokens": 500 } ``` -------------------------------- ### Enable Streaming with cURL Source: https://docs.concentrate.ai/getting-started/quickstart This cURL command demonstrates how to enable real-time streaming of responses from the Concentrate AI API. Streaming is useful for providing a more interactive user experience. ```bash curl https://api.concentrate.ai/v1/responses \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-5.2", "input": "Write a short story about a robot", "stream": true }' ``` -------------------------------- ### Install Codex CLI with Concentrate AI Script Source: https://docs.concentrate.ai/integrations/codex This script automates the setup process for integrating the Codex CLI with Concentrate AI. It downloads and executes a setup script from the provided URL. Ensure you have curl installed to use this command. ```bash curl -fsSL https://concentrate.ai/scripts/setup-codex.sh | bash ``` -------------------------------- ### Execute Multi-Turn Conversations with Python Source: https://docs.concentrate.ai/getting-started/quickstart Demonstrates how to maintain conversation context by passing a list of message objects with roles to the Concentrate AI API. This enables the model to understand previous interactions within the session. ```python input = [ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "What is Python?"}, {"role": "assistant", "content": "Python is a high-level programming language."}, {"role": "user", "content": "What is it used for?"} ] response = requests.post( "https://api.concentrate.ai/v1/responses", headers={"Authorization": "Bearer YOUR_API_KEY"}, json={ "model": "gpt-5.2", "input": input } ) ``` -------------------------------- ### Enable Tool Calling with Python Source: https://docs.concentrate.ai/getting-started/quickstart This Python script shows how to enable tool calling with the Concentrate AI API. It sends a request with tool definitions and then processes the response, identifying when the model intends to call a tool and extracting its arguments. ```python import requests response = requests.post( "https://api.concentrate.ai/v1/responses", headers={ "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json" }, json={ "model": "gpt-5.2", "input": "What is 25 * 17?", "tools": [ { "type": "function", "name": "calculate", "description": "Perform mathematical calculations", "parameters": { "type": "object", "properties": { "expression": {"type": "string"} }, "required": ["expression"] } } ] } ) data = response.json() # Model will respond with a function_call for item in data["output"]: if item["type"] == "function_call": print(f"Tool: {item['name']}") print(f"Args: {item['arguments']}") ``` -------------------------------- ### Handle API Errors and Responses in Python Source: https://docs.concentrate.ai/getting-started/quickstart Provides a robust pattern for executing API requests using try-except blocks and status code checking. It demonstrates how to parse successful responses and handle specific error codes like insufficient credits or provider issues. ```python try: response = requests.post( "https://api.concentrate.ai/v1/responses", headers={"Authorization": "Bearer YOUR_API_KEY"}, json={ "model": "gpt-5.2", "input": "Hello" } ) if response.status_code == 200: data = response.json() print(data["output"][0]["content"][0]["text"]) elif response.status_code == 402: print("Insufficient credits - please add funds") elif response.status_code == 424: print("Provider error - try a different provider") else: print(f"Error: {response.status_code}") print(response.json()) except Exception as e: print(f"Request failed: {e}") ``` -------------------------------- ### Enable Streaming with Python Source: https://docs.concentrate.ai/getting-started/quickstart This Python script shows how to enable and process streaming responses from the Concentrate AI API using the requests library. It iterates over the response lines, decodes the data, and prints text deltas as they arrive. ```python import requests import json response = requests.post( "https://api.concentrate.ai/v1/responses", headers={ "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json" }, json={ "model": "gpt-5.2", "input": "Write a short story about a robot", "stream": True }, stream=True ) for line in response.iter_lines(): if line and line.startswith(b'data: '): data = json.loads(line[6:]) if data.get("type") == "response.output_text.delta": print(data["delta"], end="", flush=True) ``` -------------------------------- ### Enable Tool Calling with cURL Source: https://docs.concentrate.ai/getting-started/quickstart This cURL command demonstrates how to configure the Concentrate AI API to use tool calling. It defines a 'calculate' function that the AI can invoke to perform mathematical operations. ```bash curl https://api.concentrate.ai/v1/responses \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_API_KEY" \ -d '{ "model": "gpt-5.2", "input": "What is 25 * 17?", "tools": [ { "type": "function", "name": "calculate", "description": "Perform mathematical calculations", "parameters": { "type": "object", "properties": { "expression": {"type": "string"} }, "required": ["expression"] } } ] }' ``` -------------------------------- ### Complete Streaming Lifecycle Example Source: https://docs.concentrate.ai/api-reference/endpoint/streaming A full sequence of events representing a complete streaming response, from creation to completion, including content generation and usage statistics. ```text event: response.created data: {"type":"response.created","sequence_number":0,"response":{"id":"resp_abc123","status":"in_progress"}} event: response.output_item.added data: {"type":"response.output_item.added","sequence_number":1,"output_index":0,"item":{"type":"message","id":"msg_xyz789","status":"in_progress","role":"assistant","content":[]}} event: response.content_part.added data: {"type":"response.content_part.added","sequence_number":2,"output_index":0,"content_index":0,"item_id":"msg_xyz789","part":{"type":"output_text","text":""}} event: response.output_text.delta data: {"type":"response.output_text.delta","sequence_number":3,"output_index":0,"content_index":0,"item_id":"msg_xyz789","delta":"Once"} event: response.output_text.done data: {"type":"response.output_text.done","sequence_number":7,"output_index":0,"content_index":0,"item_id":"msg_xyz789","text":"Once upon a time"} event: response.completed data: {"type":"response.completed","sequence_number":10,"response":{"id":"resp_abc123","status":"completed","usage":{"input_tokens":8,"output_tokens":4,"total_tokens":12}}} ``` -------------------------------- ### Advanced Schema Example: Nested Objects Source: https://docs.concentrate.ai/api-reference/endpoint/structured-output Example of a JSON Schema demonstrating nested objects and arrays for complex data structures. ```APIDOC ## Advanced Schema Example: Nested Objects ### Description This example demonstrates how to define a JSON Schema with nested objects and arrays to represent complex data structures like orders with customer information and items. ### Method Not Applicable (Configuration Parameter) ### Endpoint Not Applicable (Configuration Parameter) ### Parameters #### Request Body - **text.format.type** (string) - Required - Must be `"json_schema"` - **text.format.name** (string) - Required - A name for the schema (e.g., `"order"`) - **text.format.schema** (object) - Required - The JSON Schema object defining the structure. ### Request Example ```json { "text": { "format": { "type": "json_schema", "name": "order", "schema": { "type": "object", "properties": { "customer": { "type": "object", "properties": { "name": { "type": "string" }, "email": { "type": "string", "format": "email" } }, "required": ["name", "email"], "additionalProperties": false }, "items": { "type": "array", "items": { "type": "object", "properties": { "product": { "type": "string" }, "quantity": { "type": "integer", "minimum": 1 }, "price": { "type": "number" } }, "required": ["product", "quantity", "price"], "additionalProperties": false } }, "total": { "type": "number" } }, "required": ["customer", "items", "total"], "additionalProperties": false } } } } ``` ### Response #### Success Response (200) - **customer** (object) - Information about the customer. - **items** (array) - An array of items in the order. - **total** (number) - The total cost of the order. #### Response Example ```json { "customer": { "name": "Jane Doe", "email": "jane.doe@example.com" }, "items": [ { "product": "Laptop", "quantity": 1, "price": 1200.50 }, { "product": "Mouse", "quantity": 1, "price": 25.00 } ], "total": 1225.50 } ``` ``` -------------------------------- ### Routing Criteria Examples (JSON) Source: https://docs.concentrate.ai/api-reference/endpoint/auto-routing Illustrates how to configure the `routing` parameter to optimize model selection based on specific criteria. Examples include cost optimization (default), performance optimization, and latency optimization. ```json { "model": "auto", "input": "What is 2+2?", "routing": { "strategy": "min", "metric": "cost" } } ``` ```json { "model": "auto", "input": "Write a complex algorithm", "routing": { "strategy": "max", "metric": "performance" } } ``` ```json { "model": "auto", "input": "Quick question", "routing": { "strategy": "min", "metric": "avg_latency" } } ``` -------------------------------- ### Example of Parallel Tool Calls (Python) Source: https://docs.concentrate.ai/api-reference/endpoint/tool-calling This Python example illustrates a scenario where parallel tool calls are advantageous. The model identifies that the user's request requires fetching weather data for multiple cities and generates three independent function calls that can be executed in parallel. ```python # User asks: "What's the weather in SF, NYC, and London?" # Model can call get_weather three times in parallel: { "output": [ {"type": "function_call", "call_id": "call_1", "name": "get_weather", "arguments": '{"location": "San Francisco, CA"}'}, {"type": "function_call", "call_id": "call_2", "name": "get_weather", "arguments": '{"location": "New York, NY"}'}, {"type": "function_call", "call_id": "call_3", "name": "get_weather", "arguments": '{"location": "London, UK"}'} ] } ``` -------------------------------- ### GET /v1/models/ Source: https://docs.concentrate.ai/api-reference/endpoint/list-models Retrieve a comprehensive list of all available AI models supported by the platform. ```APIDOC ## GET /v1/models/ ### Description List all available AI models with their associated provider information, pricing, and metadata. ### Method GET ### Endpoint https://api.concentrate.ai/v1/models/ ### Parameters None ### Request Example GET /v1/models/ ### Response #### Success Response (200) - **slug** (string) - Unique identifier for the model - **aliases** (array) - List of alternative names for the model - **name** (string) - Human-readable name - **description** (string) - Brief overview of the model - **author** (object) - Information about the model creator (slug, display_name) - **providers** (object) - Map of provider-specific configurations and pricing #### Response Example [ { "slug": "gpt-4o", "name": "GPT-4o", "author": { "slug": "openai", "display_name": "OpenAI" }, "providers": { "openai": { "pricing": { "tokens": { "input": { "price": { "USD": 0.005 }, "units": 1000 }, "output": { "price": { "USD": 0.015 }, "units": 1000 } } } } } } ] ``` -------------------------------- ### Parameters using JSON Schema Source: https://docs.concentrate.ai/api-reference/endpoint/tool-calling Illustrates how to define function parameters using JSON Schema. This example shows properties for 'location', 'unit', and 'include_forecast', with 'location' being a required string. ```json { "parameters": { "type": "object", "properties": { "location": { "type": "string", "description": "City and state, e.g. San Francisco, CA" }, "unit": { "type": "string", "enum": ["celsius", "fahrenheit"], "description": "Temperature unit" }, "include_forecast": { "type": "boolean", "description": "Include 5-day forecast" } }, "required": ["location"] } } ``` -------------------------------- ### Multi-Turn Tool Calling Example Source: https://docs.concentrate.ai/api-reference/endpoint/request-parameters This example shows a multi-turn conversation involving tool calling. It sequences user input, a function call initiated by the model, and the subsequent output of that function call. ```json { "model": "gpt-5.2", "input": [ { "role": "user", "content": "What's the weather in San Francisco?" }, { "type": "function_call", "call_id": "call_abc123", "name": "get_weather", "arguments": "{\"location\": \"San Francisco, CA\"}" }, { "type": "function_call_output", "call_id": "call_abc123", "output": "{\"temperature\": 72, \"conditions\": \"sunny\"}" } ], "tools": [...] // Tool definitions would go here } ``` -------------------------------- ### GET /websites/concentrate_ai Source: https://docs.concentrate.ai/api-reference/endpoint/get-provider-info Retrieves the current AI configuration settings for website concentrate AI. ```APIDOC ## GET /websites/concentrate_ai ### Description Retrieves the current AI configuration settings for website concentrate AI, including image generation limits and supported formats. ### Method GET ### Endpoint /websites/concentrate_ai ### Parameters #### Query Parameters None ### Request Example ```json { "example": "" } ``` ### Response #### Success Response (200) - **provider_slug** (string) - The slug of the AI provider. - **pricing** (object) - Pricing details for the AI service. - **max_total** (number) - Maximum total cost. - **max_per_image** (number) - Maximum cost per image. - **context_window** (number) - The context window size for the AI model. - **max_output_tokens** (number) - The maximum number of output tokens. - **zdr** (boolean) - Indicates if zero-shot detection is supported. - **supports** (object) - Supported features. - **supported_formats** (array) - List of supported image formats. - **size_mb** (number) - Maximum image size in MB. #### Response Example ```json { "provider_slug": "openai", "pricing": { "max_total": 100, "max_per_image": 5 }, "context_window": 4096, "max_output_tokens": 1024, "zdr": true, "supports": { "supported_formats": [ "png", "jpeg" ], "size_mb": 10 } } ``` #### Error Response (404) - **error** (string) - Error type, should be 'Not Found'. - **message** (string) - A descriptive error message. #### Response Example (404) ```json { "error": "Not Found", "message": "AI configuration not found for this website." } ``` ``` -------------------------------- ### Reasoning Model Event Payloads Source: https://docs.concentrate.ai/api-reference/endpoint/streaming Examples of events emitted by reasoning-capable models. These include signals for the start of summary parts and incremental updates to the reasoning text. ```json { "type": "response.reasoning_summary_part.added", "sequence_number": 4, "output_index": 0, "summary_index": 0, "item_id": "reason_xyz123", "part": { "type": "summary_text", "text": "" } } ``` ```json { "type": "response.reasoning_summary_text.delta", "sequence_number": 5, "output_index": 0, "summary_index": 0, "item_id": "reason_xyz123", "delta": "Analyzing the problem" } ``` -------------------------------- ### Implement Exponential Backoff Retry Logic Source: https://docs.concentrate.ai/getting-started/quickstart A utility pattern for handling transient network or service errors by retrying requests with an increasing delay between attempts. ```python import time for attempt in range(3): try: response = make_request() break except Exception as e: if attempt < 2: time.sleep(2 ** attempt) ``` -------------------------------- ### Implement Multi-Turn Tool Calling Workflow Source: https://docs.concentrate.ai/api-reference/endpoint/tool-calling A complete implementation of the multi-turn tool calling pattern. It demonstrates defining tools, handling function call requests from the model, executing local functions, and submitting results back to the API. ```python import requests import json API_URL = "https://api.concentrate.ai/v1/responses" HEADERS = { "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json" } tools = [{ "type": "function", "name": "get_weather", "description": "Get current weather for a location", "parameters": { "type": "object", "properties": { "location": {"type": "string"}, "unit": {"type": "string", "enum": ["celsius", "fahrenheit"]} }, "required": ["location"] } }] response1 = requests.post(API_URL, headers=HEADERS, json={ "model": "gpt-5.2", "input": "What's the weather like in San Francisco?", "tools": tools }) data1 = response1.json() function_call = next((item for item in data1["output"] if item["type"] == "function_call"), None) if function_call: args = json.loads(function_call["arguments"]) def get_weather(location, unit="fahrenheit"): return {"location": location, "temperature": 72, "unit": unit, "conditions": "Sunny"} result = get_weather(**args) response2 = requests.post(API_URL, headers=HEADERS, json={ "model": "gpt-5.2", "input": [ {"role": "user", "content": "What's the weather like in San Francisco?"}, function_call, {"type": "function_call_output", "call_id": function_call["call_id"], "output": json.dumps(result)} ], "tools": tools }) ``` ```typescript const API_URL = "https://api.concentrate.ai/v1/responses"; const HEADERS = { "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json" }; const tools = [{ type: "function", name: "get_weather", description: "Get current weather for a location", parameters: { type: "object", properties: { location: { type: "string" }, unit: { type: "string", enum: ["celsius", "fahrenheit"] } }, required: ["location"] } }]; const response1 = await fetch(API_URL, { method: "POST", headers: HEADERS, body: JSON.stringify({ model: "gpt-5.2", input: "What's the weather like in San Francisco?", tools }) }); const data1 = await response1.json(); const functionCall = data1.output.find((item: any) => item.type === "function_call"); if (functionCall) { const args = JSON.parse(functionCall.arguments); const result = { location: args.location, temperature: 72, unit: args.unit, conditions: "Sunny" }; const response2 = await fetch(API_URL, { method: "POST", headers: HEADERS, body: JSON.stringify({ model: "gpt-5.2", input: [ { role: "user", content: "What's the weather like in San Francisco?" }, functionCall, { type: "function_call_output", call_id: functionCall.call_id, output: JSON.stringify(result) } ], tools }) }); } ``` -------------------------------- ### Make API Call to Get Response (cURL, Python, JavaScript, TypeScript) Source: https://docs.concentrate.ai/api-reference/introduction This snippet shows how to send a POST request to the /v1/responses endpoint to get a model's response. It includes examples for cURL, Python, JavaScript, and TypeScript, demonstrating how to set headers and send JSON payloads. Ensure you replace 'YOUR_API_KEY' with your actual API key. ```bash curl https://api.concentrate.ai/v1/responses \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_API_KEY" \ -d '{ "model": "gpt-4o", "input": "What is the capital of France?" }' ``` ```python import requests response = requests.post( "https://api.concentrate.ai/v1/responses", headers={ "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json" }, json={ "model": "gpt-4o", "input": "What is the capital of France?" } ) print(response.json()) ``` ```javascript const response = await fetch("https://api.concentrate.ai/v1/responses", { method: "POST", headers: { "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json" }, body: JSON.stringify({ model: "gpt-4o", input: "What is the capital of France?" }) }); const data = await response.json(); console.log(data); ``` ```typescript interface ResponseRequest { model: string; input: string | Array<{role: string; content: string}>; stream?: boolean; temperature?: number; max_output_tokens?: number; } const response = await fetch("https://api.concentrate.ai/v1/responses", { method: "POST", headers: { "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json" }, body: JSON.stringify({ model: "gpt-4o", input: "What is the capital of France?" } as ResponseRequest) }); const data = await response.json(); console.log(data); ``` -------------------------------- ### POST /configuration Source: https://docs.concentrate.ai/api-reference/endpoint/create-response Configures the tool execution environment, including allowed tools, tool modes, and conversation context management. ```APIDOC ## POST /configuration ### Description Configures the AI agent's tool capabilities, including defining allowed tools, setting execution modes, and managing conversation context. ### Method POST ### Endpoint /configuration ### Parameters #### Request Body - **tools** (array) - Required - A list of tools available to the agent, including function, custom, or web_search types. - **mode** (string) - Required - Execution mode, either 'auto' or 'required'. - **parallel_tool_calls** (boolean) - Optional - Whether to allow multiple tool calls simultaneously. - **context_management** (array) - Optional - Configuration for context compaction, including threshold settings. - **conversation** (object/string) - Optional - Reference to an existing conversation ID. ### Request Example { "type": "allowed_tools", "mode": "auto", "tools": [ { "name": "search_tool", "type": "function" }, { "type": "web_search" } ] } ### Response #### Success Response (200) - **status** (string) - Confirmation of successful configuration update. #### Response Example { "status": "success" } ``` -------------------------------- ### POST /v1/tools/execute Source: https://docs.concentrate.ai/api-reference/endpoint/create-response Configures tool execution parameters including web search settings, cache control, and model temperature. ```APIDOC ## POST /v1/tools/execute ### Description Executes a tool request with specific configuration for search patterns, caching, and model constraints. ### Method POST ### Endpoint /v1/tools/execute ### Parameters #### Request Body - **type** (string) - Required - The type of tool operation (e.g., 'find_in_page'). - **pattern** (string) - Required - The search pattern to apply. - **url** (string) - Required - The target URL for the operation. - **cache_control** (object) - Optional - Configuration for caching (type: 'ephemeral', ttl: '5m' | '1h'). - **temperature** (number) - Optional - Model creativity (0 to 2). - **tool_choice** (object) - Optional - Defines specific tool selection or mode (auto/required). ### Request Example { "type": "find_in_page", "pattern": "example_query", "url": "https://example.com", "cache_control": { "type": "ephemeral", "ttl": "5m" }, "temperature": 0.7 } ### Response #### Success Response (200) - **status** (string) - The current state of the execution (completed, in_progress, searching). #### Response Example { "status": "completed" } ``` -------------------------------- ### Using tool_choice for Specific Providers Source: https://docs.concentrate.ai/api-reference/endpoint/web-search For providers like Google Vertex AI (Gemini) and Mistral, which do not support combining web search and function tools directly, this example shows how to use the `tool_choice` parameter to explicitly select web search. ```APIDOC ## POST /api/create-response (with tool_choice) ### Description When using providers that restrict the simultaneous use of web search and function tools (e.g., Google Vertex AI, Mistral), the `tool_choice` parameter can be used to prioritize and select the desired tool, such as web search. ### Method POST ### Endpoint /api/create-response ### Parameters #### Request Body - **model** (string) - Required - The model to use for the request. - **input** (string) - Required - The user's input query. - **tools** (array) - Required - A list of available tools, including `web_search` and `function` tools. - **tool_choice** (object) - Optional - Specifies which tool(s) the model should use. Use `type: "allowed_tools"`, `mode: "auto"`, and `tools` array to define allowed tools. ### Request Example ```json { "model": "gemini-2.5-pro", "input": "What happened in the news today?", "tools": [ { "type": "web_search" }, { "type": "function", "name": "convert_currency", "description": "Convert between currencies", "parameters": { "type": "object", "properties": { "amount": { "type": "number" }, "from": { "type": "string" }, "to": { "type": "string" } }, "required": ["amount", "from", "to"] } } ], "tool_choice": { "type": "allowed_tools", "mode": "auto", "tools": [{ "type": "web_search" }] } } ``` ### Response #### Success Response (200) - **output** (object) - The response from the model, which will prioritize the selected tool (e.g., web search results). #### Response Example ```json { "output": { "web_search_results": [ { "title": "Major News Headlines Today", "url": "http://example.com/news", "snippet": "Key events and updates from around the world." } ] } } ``` ``` -------------------------------- ### Verify API Health across multiple languages Source: https://docs.concentrate.ai/api-reference/endpoint/health Demonstrates how to perform a simple GET request to the health check endpoint to verify service status. These examples show the basic implementation in cURL, Python, JavaScript, and Go. ```bash curl https://api.concentrate.ai/v1/responses/health ``` ```python import requests response = requests.get("https://api.concentrate.ai/v1/responses/health") if response.status_code == 200: print("API is healthy") else: print("API is experiencing issues") ``` ```javascript const response = await fetch("https://api.concentrate.ai/v1/responses/health"); if (response.ok) { console.log("API is healthy"); } else { console.log("API is experiencing issues"); } ``` ```go package main import ( "fmt" "net/http" ) func main() { resp, err := http.Get("https://api.concentrate.ai/v1/responses/health") if err != nil { fmt.Println("Failed to reach API:", err) return } defer resp.Body.Close() if resp.StatusCode == 200 { fmt.Println("API is healthy") } else { fmt.Println("API is experiencing issues") } } ``` -------------------------------- ### Verify Claude Code Installation Source: https://docs.concentrate.ai/integrations/claude-code Checks the currently installed version of the Claude Code CLI tool to ensure it is ready for configuration. ```bash claude --version ``` -------------------------------- ### GET /v1/models/{model} Source: https://docs.concentrate.ai/api-reference/endpoint/get-model Retrieves detailed information about a specific AI model. This endpoint allows you to get details such as the model's name, author, description, and pricing information from various providers. ```APIDOC ## GET /v1/models/{model} ### Description Retrieves detailed information about a specific AI model, including its properties, author, and provider-specific pricing. ### Method GET ### Endpoint /v1/models/{model} ### Parameters #### Path Parameters - **model** (string) - Required - The unique identifier for the model you want to retrieve details for. This can be one of 286 allowed values. ### Request Example ```json { "example": "GET /v1/models/gpt-4" } ``` ### Response #### Success Response (200) - **slug** (string) - The unique identifier for the model. - **aliases** (array[string]) - Read-only list of alternative names for the model. - **name** (string) - The display name of the model. - **description** (string) - A brief description of the model. - **author** (object) - Information about the model's author. - **slug** (string) - The author's unique identifier (e.g., "openai", "anthropic"). - **display_name** (string) - The display name of the author. - **providers** (object) - An object containing information about different providers offering this model. - **provider_slug** (string) - The identifier for the provider (e.g., "openai", "azure"). - **pricing** (object) - Pricing details for the model from this provider. - **tokens** (object) - Pricing based on tokens. - **input** (object) - Pricing for input tokens. - **price** (object) - Price per unit. - **USD** (number) - Price in USD. - **units** (number) - The number of tokens this price applies to. - **output** (object) - Pricing for output tokens. - **price** (object) - Price per unit. - **USD** (number) - Price in USD. - **units** (number) - The number of tokens this price applies to. - **cache** (object) - Cache-related pricing information (details omitted in provided schema). #### Response Example ```json { "slug": "gpt-4", "aliases": [ "gpt4" ], "name": "GPT-4", "description": "The latest model from OpenAI, capable of complex reasoning.", "author": { "slug": "openai", "display_name": "OpenAI" }, "providers": { "openai": { "provider_slug": "openai", "pricing": { "tokens": { "input": { "price": { "USD": 0.03 }, "units": 1000 }, "output": { "price": { "USD": 0.06 }, "units": 1000 }, "cache": { "read": { "price": { "USD": 0.0001 }, "units": 1000 } } } } } } } ``` ``` -------------------------------- ### GET /v1/models/{model}/providers/{provider} Source: https://docs.concentrate.ai/api-reference/endpoint/get-provider-info Retrieves provider-specific information for a given model. This endpoint allows you to get details about pricing and other configurations for different AI providers associated with a specific model. ```APIDOC ## GET /v1/models/{model}/providers/{provider} ### Description Get provider-specific information for a model. This endpoint allows you to retrieve details about pricing and other configurations for different AI providers associated with a specific model. ### Method GET ### Endpoint /v1/models/{model}/providers/{provider} ### Parameters #### Path Parameters - **model** (string) - Required - One of 286 allowed values. - **provider** (string) - Required - One of 40 allowed values. ### Response #### Success Response (200) - **provider_slug** (string) - Enum: "openai", "anthropic", "azure", "bedrock", "xai", "ai-studio", "cohere", "mistral", "vertex", "cloudflare", "huggingface", "zai" - **pricing** (object) - Pricing details for the model and provider. - **tokens** (object) - **input** (object) - **price** (object) - **USD** (number) - Minimum: 0 - **units** (number) - Minimum: 0 - **output** (object) - **price** (object) - **USD** (number) - Minimum: 0 - **units** (number) - Minimum: 0 - **cache** (object) - **read** (object) - **price** (object) - **USD** (number) - Minimum: 0 - **units** (number) - Minimum: 0 - **write** (object) - **price** (object) - **USD** (number) - Minimum: 0 - **units** (number) - Minimum: 0 #### Response Example ```json { "provider_slug": "openai", "pricing": { "tokens": { "input": { "price": { "USD": 0.000015 }, "units": 1000 }, "output": { "price": { "USD": 0.00005 }, "units": 1000 }, "cache": { "read": { "price": { "USD": 0.000001 }, "units": 1000 }, "write": { "price": { "USD": 0.000002 }, "units": 1000 } } } } } ``` ``` -------------------------------- ### POST /v1/responses/ Source: https://docs.concentrate.ai/api-reference/endpoint/create-response Initiates a stateful conversation with a selected AI model, supporting various input formats and configuration parameters. ```APIDOC ## POST /v1/responses/ ### Description Start a stateful conversation with your model of choice. This endpoint accepts model configuration and message history to generate AI responses. ### Method POST ### Endpoint https://api.concentrate.ai/v1/responses/ ### Parameters #### Request Body - **model** (string) - Required - Model identifier (e.g., "gpt-5.2", "auto"). - **stream** (boolean) - Optional - Whether to stream the response. - **temperature** (number) - Optional - Sampling temperature (0-2). - **top_p** (number) - Optional - Nucleus sampling parameter (0-1). - **input** (string/array) - Required - The conversation input, either a string or an array of message objects. ### Request Example { "model": "gpt-5.2", "input": [ { "role": "user", "content": "Hello, how are you?" } ], "temperature": 0.7 } ### Response #### Success Response (200) - **id** (string) - Unique identifier for the response. - **content** (string) - The generated AI response. #### Response Example { "id": "resp_12345", "content": "I am doing well, thank you!" } ``` -------------------------------- ### 400 Bad Request: Invalid Model Name Example Source: https://docs.concentrate.ai/api-reference/endpoint/errors An example of a 'Bad Request' error response when an invalid or non-existent model name is provided. This indicates issues with model identification or availability. ```json { "error": "Bad Request", "message": "Invalid model name: 'invalid-model-xyz'" } ```