### Run guided setup Source: https://keelcode.ai/docs/cli/commands Executes the optional guided configuration, such as setting up Nerd Font icons. ```bash keelcode setup ``` -------------------------------- ### Install and initialize the keelcode CLI Source: https://keelcode.ai/docs Use the bun package manager to install the CLI globally and authenticate with your account. ```bash bun add --global @keelcode-ai/keelcode keelcode login keelcode ``` -------------------------------- ### Install Keelcode CLI globally Source: https://keelcode.ai/docs/cli/install Install the package globally using Bun. ```bash bun add --global @keelcode-ai/keelcode ``` -------------------------------- ### Start interactive agent Source: https://keelcode.ai/docs/cli/commands Launches the interactive agent for the current or specified project. ```bash keelcode [project] ``` -------------------------------- ### Initialize and use the Keelcode CLI Source: https://keelcode.ai/docs/quickstart Install the global package, authenticate, and execute a prompt within a project directory. ```bash bun add --global @keelcode-ai/keelcode keelcode login cd my-project keelcode -p "find and fix the failing test" ``` -------------------------------- ### Start interactive TUI Source: https://keelcode.ai/docs/cli/usage Launches the Keelcode agent in the current project directory. ```bash cd my-project keelcode ``` -------------------------------- ### Authenticate with Keelcode Source: https://keelcode.ai/docs/cli/install Commands to initiate the login process and verify the installation. ```bash keelcode login keelcode ``` -------------------------------- ### List available models via API Source: https://keelcode.ai/docs/models Retrieve a list of models available to your account using the GET /v1/models endpoint. ```bash curl https://api.keelcode.ai/v1/models -H "authorization: Bearer $KEELCODE_API_KEY" ``` -------------------------------- ### Model catalog response format Source: https://keelcode.ai/docs/api/models Example JSON response containing the list of available models with their IDs and display names. ```json { "data": [ { "id": "claude-opus-4-8", "type": "model", "display_name": "Claude Opus 4.8" }, { "id": "gpt-5.6-sol", "type": "model", "display_name": "GPT-5.6 Sol" }, { "id": "kimi-k2.6-nitro", "type": "model", "display_name": "Kimi K2.6 Nitro" } ] } ``` -------------------------------- ### Streaming response event format Source: https://keelcode.ai/docs/api/messages Example of the Anthropic-style server-sent events (SSE) returned by the API during message generation. ```text event: message_start data: {"type":"message_start","message":{"id":"msg_...","role":"assistant","model":"claude-opus-4-8","content":[]}} event: content_block_start data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""}} event: content_block_delta data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Hello"}} event: content_block_stop data: {"type":"content_block_stop","index":0} event: message_delta data: {"type":"message_delta","delta":{"stop_reason":"end_turn"},"usage":{"output_tokens":12}} event: message_stop data: {"type":"message_stop"} ``` -------------------------------- ### GET /v1/models Source: https://keelcode.ai/docs/api/models Retrieves the catalog of models available to your account. The returned model IDs can be used in the /v1/messages endpoint. ```APIDOC ## GET /v1/models ### Description List the models available to your account. Responses are cached for 60 seconds. ### Method GET ### Endpoint /v1/models ### Response #### Success Response (200) - **data** (array) - A list of model objects. - **id** (string) - The unique identifier for the model. - **type** (string) - The resource type. - **display_name** (string) - The human-readable name of the model. #### Response Example { "data": [ { "id": "claude-opus-4-8", "type": "model", "display_name": "Claude Opus 4.8" }, { "id": "gpt-5.6-sol", "type": "model", "display_name": "GPT-5.6 Sol" }, { "id": "kimi-k2.6-nitro", "type": "model", "display_name": "Kimi K2.6 Nitro" } ] } ``` -------------------------------- ### Authenticate user Source: https://keelcode.ai/docs/cli/commands Initiates the device approval sign-in flow. ```bash keelcode login [--no-browser] ``` -------------------------------- ### Authenticate CLI session Source: https://keelcode.ai/docs/authentication Use the login command to initiate device approval. Use the --no-browser flag if a browser is unavailable. ```bash keelcode login # no browser on this machine? keelcode login --no-browser ``` -------------------------------- ### CLI command aliases Source: https://keelcode.ai/docs/cli/install List of available command names and instructions for managing custom aliases. ```text keelcode kc kcode keel ``` ```bash keelcode alias setup keelcode alias add mycode keelcode alias list ``` -------------------------------- ### Display account info Source: https://keelcode.ai/docs/cli/commands Displays details for the currently authenticated account. ```bash keelcode whoami ``` -------------------------------- ### Check credit usage Source: https://keelcode.ai/docs/cli/commands Displays current credit consumption. ```bash keelcode usage ``` -------------------------------- ### Run headless prompt Source: https://keelcode.ai/docs/cli/commands Executes a single prompt in headless mode, supporting piped stdin. ```bash keelcode -p "prompt" ``` -------------------------------- ### Manage command aliases Source: https://keelcode.ai/docs/cli/commands Provides utilities to add, list, remove, or configure command aliases. ```bash keelcode alias add|list|remove|setup ``` -------------------------------- ### Define tools for model use Source: https://keelcode.ai/docs/api/messages JSON body configuration for defining tools with input schemas to enable model-assisted tool calling. ```json { "model": "claude-opus-4-8", "max_tokens": 1024, "stream": true, "tools": [ { "name": "get_weather", "description": "Get the current weather for a city.", "input_schema": { "type": "object", "properties": { "city": { "type": "string" } }, "required": ["city"] } } ], "messages": [ { "role": "user", "content": [{ "type": "text", "text": "Weather in Delhi?" }] } ] } ``` -------------------------------- ### List models via cURL Source: https://keelcode.ai/docs/api/models Retrieves the list of available models using the Keelcode API key for authentication. ```bash curl https://api.keelcode.ai/v1/models \ -H "authorization: Bearer $KEELCODE_API_KEY" ``` -------------------------------- ### Execute one-shot prompts Source: https://keelcode.ai/docs/cli/usage Runs a single command prompt directly or processes piped input from other tools. ```bash keelcode -p "find and fix the failing test" ``` ```bash git diff | keelcode -p "review this diff" ``` -------------------------------- ### End session Source: https://keelcode.ai/docs/cli/commands Terminates the local authentication session. ```bash keelcode logout ``` -------------------------------- ### Create a message with cURL Source: https://keelcode.ai/docs/api/messages Sends a POST request to the messages endpoint. Requires an Authorization header with a valid API key and sets stream to true. ```bash curl https://api.keelcode.ai/v1/messages \ -H "authorization: Bearer $KEELCODE_API_KEY" \ -H "content-type: application/json" \ -d '{ "model": "claude-opus-4-8", "max_tokens": 1024, "stream": true, "messages": [ { "role": "user", "content": [{ "type": "text", "text": "Hello, keelcode" }] } ] }' ``` -------------------------------- ### Authenticate API requests with Bearer token Source: https://keelcode.ai/docs/authentication Include the API key in the Authorization header for all requests. ```bash Authorization: Bearer $KEELCODE_API_KEY ``` -------------------------------- ### Interact with the Keelcode API Source: https://keelcode.ai/docs/quickstart Send a streaming request to the Keelcode API using cURL or the Anthropic SDK. ```bash curl https://api.keelcode.ai/v1/messages \ -H "authorization: Bearer $KEELCODE_API_KEY" \ -H "content-type: application/json" \ -d '{ "model": "claude-opus-4-8", "max_tokens": 1024, "stream": true, "messages": [ { "role": "user", "content": [{ "type": "text", "text": "Hello, keelcode" }] } ] }' ``` ```ts import Anthropic from "@anthropic-ai/sdk"; // keelcode speaks the Anthropic Messages API — point the SDK at it. const client = new Anthropic({ apiKey: process.env.KEELCODE_API_KEY, baseURL: "https://api.keelcode.ai", }); const stream = await client.messages.stream({ model: "claude-opus-4-8", max_tokens: 1024, messages: [{ role: "user", content: "Hello, keelcode" }], }); for await (const event of stream) { if (event.type === "content_block_delta" && event.delta.type === "text_delta") { process.stdout.write(event.delta.text); } } ``` -------------------------------- ### POST /v1/messages Source: https://keelcode.ai/docs/api/messages Create a message to stream a model response. This endpoint is streaming-only and requires the 'stream' parameter to be set to true. ```APIDOC ## POST /v1/messages ### Description Stream a model response. This endpoint implements the Anthropic Messages API, allowing for conversational interactions with supported models. ### Method POST ### Endpoint /v1/messages ### Parameters #### Request Body - **model** (string) - Required - A model id from /v1/models. - **max_tokens** (integer) - Required - Maximum tokens to generate (1–128000, capped per model). - **messages** (Message[]) - Required - The conversation. Each message has a role (user | assistant) and an array of content blocks. - **stream** (true) - Required - Must be true — the endpoint is streaming-only. - **system** (string | Block[]) - Optional - A system prompt. - **tools** (Tool[]) - Optional - Tools the model may call. - **tool_choice** (object) - Optional - auto | any | none | { type: "tool", name }. - **temperature** (number) - Optional - Sampling temperature, 0–1. - **top_p** (number) - Optional - Nucleus sampling, 0–1. - **stop_sequences** (string[]) - Optional - Up to 16 sequences that stop generation. - **thinking** (object) - Optional - { type: "enabled", budget_tokens } to enable extended thinking. - **reasoning_effort** (enum) - Optional - low | medium | high — for reasoning models. ### Request Example { "model": "claude-opus-4-8", "max_tokens": 1024, "stream": true, "messages": [ { "role": "user", "content": [{ "type": "text", "text": "Hello, keelcode" }] } ] } ### Response #### Success Response (200) - **SSE Stream** - The response is an Anthropic-style SSE stream containing message_start, content_block_*, message_delta, and message_stop events. ``` -------------------------------- ### Status Codes Source: https://keelcode.ai/docs/errors List of standard HTTP status codes and their corresponding error codes used by the API. ```APIDOC ## Status Codes - **400** (invalid_request / invalid_json) - The body is malformed or violates the contract. - **401** (unauthorized) - Missing or invalid API key. - **403** (forbidden) - The key lacks the required scope. - **404** (model_not_found) - Unknown model requested. - **413** (payload_too_large) - Body exceeds 10 MiB. - **429** (rate_limited / allowance_exceeded) - Too many requests, or the daily allowance is spent. - **503** (model_unpriced) - The model is not commercially enabled yet. ``` -------------------------------- ### API Error Response Structure Source: https://keelcode.ai/docs/errors The standard JSON format for non-2xx API responses. ```json { "type": "error", "error": { "code": "invalid_request", "title": "Invalid request", "detail": "The Messages request does not match the API contract." } } ``` -------------------------------- ### Error Response Format Source: https://keelcode.ai/docs/errors The standard structure for error responses returned by the API. ```APIDOC ## Error Response Format ### Description Non-2xx responses return a problem object. Clients should branch logic based on the `error.code` field rather than the human-readable `title` or `detail` fields. ### Response Body - **type** (string) - Always "error" - **error** (object) - Contains error details - **code** (string) - Machine-readable error code - **title** (string) - Human-readable summary - **detail** (string) - Detailed explanation of the error ### Response Example { "type": "error", "error": { "code": "invalid_request", "title": "Invalid request", "detail": "The Messages request does not match the API contract." } } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.