### Quickstart Installation Source: https://ezaiapi.com/docs Follow these steps to quickly set up EzAI and start using it with Claude Code. ```APIDOC ## Quickstart Up and running in under a minute. Sign up to get your API key. 1. ### Get your API key Sign in and copy your API key from the dashboard. 2. ### Run the install command Sets `ANTHROPIC_BASE_URL`, `ANTHROPIC_API_KEY`, and configures `~/.claude/settings.json`. **macOS / Linux** ```bash curl -fsSL "/install.sh?key=YOUR_KEY" | sh ``` **Windows** ```powershell irm "/install.ps1?key=YOUR_KEY" | iex ``` View source: install.sh · install.ps1 3. ### Restart your terminal ```bash source ~/.bashrc # or ~/.zshrc ``` 4. ### Start using Claude Code ```bash claude ``` That's it! Claude Code routes through EzAI automatically. ``` -------------------------------- ### Start Claude Code Source: https://ezaiapi.com/docs Once configured, you can start using Claude Code, which will automatically route through EzAI. ```bash claude ``` -------------------------------- ### Install EzAI CLI (Windows PowerShell) Source: https://ezaiapi.com/docs Installs the EzAI CLI tool on Windows using PowerShell. ```powershell irm "/install.ps1?key=YOUR_KEY" | iex ``` -------------------------------- ### Manual Installation Source: https://ezaiapi.com/docs Alternatively, you can manually set up EzAI by configuring environment variables and settings files. ```APIDOC ## Manual Installation Prefer manual setup? Two steps: ### 1. Set environment variables Add to `~/.bashrc`, `~/.zshrc`, or your shell config: ```bash export ANTHROPIC_BASE_URL="https://ezaiapi.com" export ANTHROPIC_API_KEY="YOUR_KEY" ``` ### 2. Update settings.json Create or edit `~/.claude/settings.json`: ```json { "env": { "ANTHROPIC_BASE_URL": "https://ezaiapi.com", "ANTHROPIC_API_KEY": "YOUR_KEY" }, "disableLoginPrompt": true } ``` ``` -------------------------------- ### Install EzAI CLI (Windows) Source: https://ezaiapi.com/docs Installs the EzAI CLI tool on Windows systems using PowerShell. ```powershell curl -fsSL "https://ezaiapi.com/install.sh?key=YOUR_KEY" | sh ``` -------------------------------- ### Install EzAI CLI (macOS/Linux) Source: https://ezaiapi.com/docs Installs the EzAI CLI tool, setting necessary environment variables and configuration for Claude Code integration. ```bash curl -fsSL "/install.sh?key=YOUR_KEY" | sh ``` -------------------------------- ### Restart Terminal Source: https://ezaiapi.com/docs After installation, restart your terminal or source your shell configuration file to apply changes. ```bash source ~/.bashrc # or ~/.zshrc ``` -------------------------------- ### Compatibility with Tools Source: https://ezaiapi.com/docs EzAI is designed to be a drop-in replacement for Anthropic and OpenAI-compatible tools. This section details the setup for various popular tools. ```APIDOC ## Compatibility EzAI works as a drop-in replacement for any Anthropic or OpenAI-compatible tool. Tool | Status | Setup ---|---|--- Claude Code| ✅ Native| Set env vars or run install script Cursor| ✅ Works| Settings → Models → Custom API provider Cline| ✅ Works| Extension settings → Anthropic → Base URL Continue| ✅ Works| config.json → custom provider Aider| ✅ Works| Set ANTHROPIC_BASE_URL env var OpenAI SDK| ✅ Works| Set custom User-Agent (see above) LiteLLM| ✅ Works| Set api_base + api_key Any Anthropic tool| ✅ Works| Change base URL + API key ``` -------------------------------- ### OpenAI SDK Integration Source: https://ezaiapi.com/docs Demonstrates how to integrate with the EzAI API using the official OpenAI SDK, including necessary configurations for custom User-Agent. ```APIDOC ## OpenAI SDK Integration Use the official OpenAI SDK to access all EzAI models via the `/v1/chat/completions` endpoint. **⚠️ Important:** Cloudflare blocks the default `User-Agent: OpenAI/Python` header with a 403 error. You **must** set a custom User-Agent as shown below. ### Python ```python # pip install openai from openai import OpenAI client = OpenAI( base_url="https://ezaiapi.com/v1", api_key="sk-your-key", default_headers={"User-Agent": "EzAI/1.0"} # Required! ) response = client.chat.completions.create( model="claude-sonnet-4-5", messages=[ {"role": "system", "content": "You are helpful."}, {"role": "user", "content": "Hello!"} ], max_tokens=1024 ) print(response.choices[0].message.content) ``` ### Node.js ```javascript // npm install openai import OpenAI from 'openai'; const client = new OpenAI({ baseURL: 'https://ezaiapi.com/v1', apiKey: 'sk-your-key', defaultHeaders: { 'User-Agent': 'EzAI/1.0' } // Required! }); const resp = await client.chat.completions.create({ model: 'claude-sonnet-4-5', messages: [ { role: 'system', content: 'You are helpful.' }, { role: 'user', content: 'Hello!' } ], max_tokens: 1024 }); console.log(resp.choices[0].message.content); ``` ``` -------------------------------- ### OpenAI SDK Integration Source: https://ezaiapi.com/docs Use the official OpenAI SDK. Note: A custom User-Agent header is required to bypass Cloudflare restrictions. ```python # pip install openai from openai import OpenAI client = OpenAI( base_url="https://ezaiapi.com/v1", api_key="sk-your-key", default_headers={"User-Agent": "EzAI/1.0"} # Required! ) response = client.chat.completions.create( model="claude-sonnet-4-5", messages=[ {"role": "system", "content": "You are helpful."}, {"role": "user", "content": "Hello!"} ], max_tokens=1024 ) print(response.choices[0].message.content) ``` ```javascript // npm install openai import OpenAI from 'openai'; const client = new OpenAI({ baseURL: 'https://ezaiapi.com/v1', apiKey: 'sk-your-key', defaultHeaders: { 'User-Agent': 'EzAI/1.0' } // Required! }); const resp = await client.chat.completions.create({ model: 'claude-sonnet-4-5', messages: [ { role: 'system', content: 'You are helpful.' }, { role: 'user', content: 'Hello!' } ], max_tokens: 1024 }); console.log(resp.choices[0].message.content); ``` -------------------------------- ### Configure OpenAI SDK with Custom User-Agent Source: https://ezaiapi.com/docs Set a custom User-Agent to bypass Cloudflare WAF blocks that target the default OpenAI Python header. ```python client = OpenAI( base_url="https://ezaiapi.com/v1", api_key="sk-your-key", default_headers={"User-Agent": "EzAI/1.0"} ) ``` -------------------------------- ### Chat Completions via OpenAI Format Source: https://ezaiapi.com/docs Interact with models using the standard OpenAI Chat Completions API format. ```bash curl https://ezaiapi.com/v1/chat/completions \ -H "Authorization: Bearer sk-your-key" \ -H "Content-Type: application/json" \ -d '{ "model": "claude-sonnet-4-5", "messages": [ { "role": "system", "content": "You are helpful." }, { "role": "user", "content": "Hello!" } ], "max_tokens": 1024 }' ``` ```json { "id": "req_abc123", "object": "chat.completion", "model": "claude-sonnet-4-5", "choices": [{ "index": 0, "message": { "role": "assistant", "content": "Hello! How can I help?" }, "finish_reason": "stop" }], "usage": { "prompt_tokens": 15, "completion_tokens": 9, "total_tokens": 24 } } ``` -------------------------------- ### Update settings.json (Manual) Source: https://ezaiapi.com/docs Configure Claude Code settings by creating or editing the `~/.claude/settings.json` file to include EzAI credentials. ```json { "env": { "ANTHROPIC_BASE_URL": "https://ezaiapi.com", "ANTHROPIC_API_KEY": "YOUR_KEY" }, "disableLoginPrompt": true } ``` -------------------------------- ### Troubleshooting Common Issues Source: https://ezaiapi.com/docs Provides solutions for specific troubleshooting scenarios, including 403 errors with the OpenAI SDK, IP blocks, rate limit exceedances, connection timeouts, and Claude Code configuration. ```APIDOC ## Troubleshooting ### 403 Forbidden with OpenAI SDK Cloudflare WAF blocks the default `User-Agent: OpenAI/Python` header. Set a custom User-Agent: ```python client = OpenAI( base_url="https://ezaiapi.com/v1", api_key="sk-your-key", default_headers={"User-Agent": "EzAI/1.0"} ) ``` ### 403 Forbidden — IP Blocked Your IP was auto-blocked after 50+ failed auth attempts. **Wait 5 minutes** for the block to expire, then fix your API key. Check the key in your dashboard. ### 429 Too Many Requests You've exceeded your tier's rate limit (RPM or concurrent). Check the `Retry-After` header for when to retry. If your balance is exhausted (402), top up in the dashboard. See Rate Limits for your tier's limits. ### Connection Timeout / Reset Intermittent upstream connection issues. The proxy automatically retries. If persistent, try again after a few seconds — the upstream model may be under heavy load. ### Claude Code not using proxy Verify your environment variables are set: ```bash echo $ANTHROPIC_BASE_URL # Should show https://ezaiapi.com echo $ANTHROPIC_API_KEY # Should show your API key cat ~/.claude/settings.json # Should contain env block ``` ``` -------------------------------- ### Set Environment Variables (Manual) Source: https://ezaiapi.com/docs Manually set the ANTHROPIC_BASE_URL and ANTHROPIC_API_KEY environment variables in your shell configuration. ```bash export ANTHROPIC_BASE_URL="https://ezaiapi.com" export ANTHROPIC_API_KEY="YOUR_KEY" ``` -------------------------------- ### Verify Claude Code Proxy Configuration Source: https://ezaiapi.com/docs Check environment variables and settings to ensure Claude Code is correctly routing through the EzAI proxy. ```bash echo $ANTHROPIC_BASE_URL # Should show https://ezaiapi.com echo $ANTHROPIC_API_KEY # Should show your API key cat ~/.claude/settings.json # Should contain env block ``` -------------------------------- ### OpenAI Compatible Chat Completions Source: https://ezaiapi.com/docs Provides an OpenAI-compatible endpoint for chat completions, allowing integration with OpenAI SDKs and tools like LiteLLM. ```APIDOC ## POST /v1/chat/completions ### Description Native OpenAI Chat Completions format. Use with OpenAI SDK, LiteLLM, or any OpenAI-compatible tool. ### Method POST ### Endpoint `/v1/chat/completions` ### Parameters #### Request Body - **model** (string) - Required - The model to use for the chat completion. - **messages** (array) - Required - An array of message objects. - **role** (string) - Required - The role of the message sender (e.g., "system", "user", "assistant"). - **content** (string) - Required - The content of the message. - **max_tokens** (integer) - Optional - The maximum number of tokens to generate in the completion. ### Request Example ```json { "model": "claude-sonnet-4-5", "messages": [ { "role": "system", "content": "You are helpful." }, { "role": "user", "content": "Hello!" } ], "max_tokens": 1024 } ``` ### Response #### Success Response (200) - **id** (string) - Unique identifier for the completion. - **object** (string) - Type of object returned (e.g., "chat.completion"). - **model** (string) - The model used for the completion. - **choices** (array) - An array of completion choices. - **index** (integer) - Index of the choice. - **message** (object) - The message content and role. - **role** (string) - The role of the message sender (e.g., "assistant"). - **content** (string) - The content of the assistant's message. - **finish_reason** (string) - The reason the generation finished (e.g., "stop"). - **usage** (object) - Token usage information. - **prompt_tokens** (integer) - Number of tokens in the prompt. - **completion_tokens** (integer) - Number of tokens in the completion. - **total_tokens** (integer) - Total number of tokens used. #### Response Example ```json { "id": "req_abc123", "object": "chat.completion", "model": "claude-sonnet-4-5", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "Hello! How can I help?" }, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 15, "completion_tokens": 9, "total_tokens": 24 } } ``` ``` -------------------------------- ### Streaming Responses Source: https://ezaiapi.com/docs Enable streaming responses by setting `"stream": true`. This returns Server-Sent Events for real-time updates. ```bash curl https://ezaiapi.com/v1/messages \ -H "x-api-key: sk-your-key" \ -H "anthropic-version: 2023-06-01" \ -H "content-type: application/json" \ -d '{ "model": "claude-sonnet-4-5", "max_tokens": 1024, "stream": true, "messages": [ { "role": "user", "content": "Write a haiku" } ] }' ``` -------------------------------- ### List Available Models Source: https://ezaiapi.com/docs Retrieves a list of all available models in OpenAI format, useful for model discovery. ```APIDOC ## GET /v1/models ### Description Returns all available models in OpenAI format. Useful for model discovery in tools like LiteLLM. ### Method GET ### Endpoint `/v1/models` ### Alternate Endpoints - `/openai/v1/models` - `/api/v1/models` ### Single Model Endpoint - **GET /v1/models/{model_id}** - Returns model info or 404. ``` -------------------------------- ### Rate Limits and Response Headers Source: https://ezaiapi.com/docs Understand the rate limits applied per account based on your tier, including RPM, concurrent requests, and daily limits. Response headers provide real-time usage information. ```APIDOC ## Rate Limits Rate limits are applied **per account** based on your tier. Two limits apply simultaneously: RPM Requests per minute Concurrent Max parallel requests 5 min IP block auto-expires Tier | RPM | Concurrent | Daily Requests | Condition ---|---|---|---|--- Free| 5| 1| 50| $0 balance, no plan Top-up| 30| 2| 500| Has credit balance Starter| 30| 2| 1,000| $10/month plan Pro| 60| 3| 2,000| $20/month plan Max| 90| 6| 5,000| $40/month plan Ultra| 120| 8| 10,000| $80/month plan **💎 Monthly Plans** — Get free credits that reset every 5 hours + higher rate limits + daily request quota. Multiple plans stack daily limits. View plans → ### Response Headers Every API response includes rate limit headers so your client can track usage: ``` x-ratelimit-tier: topup x-ratelimit-limit-requests: 30 # RPM limit for your tier x-ratelimit-remaining-requests: 28 # Remaining requests this minute x-ratelimit-reset-requests: 2026-03-03T09:00:00.000Z x-concurrent-limit: 5 # Max parallel requests x-concurrent-remaining: 3 # Available parallel slots ``` * •Exceeding any limit returns `429` with a `Retry-After` header * •50+ consecutive failed auth attempts from the same IP triggers auto-block (`403`) * •IP blocks expire automatically after 5 minutes * •Balance exhaustion returns `402` — top up * •Your current tier is shown in your dashboard — upgrade plan for higher limits ``` -------------------------------- ### Create Message (GPT) Source: https://ezaiapi.com/docs Send a message to the GPT-4.1 model using the EzAI API. The proxy auto-converts to OpenAI format upstream. ```bash curl https://ezaiapi.com/v1/messages \ -H "x-api-key: sk-your-key" \ -H "anthropic-version: 2023-06-01" \ -H "content-type: application/json" \ -d '{ "model": "gpt-4.1", "max_tokens": 1024, "messages": [ { "role": "user", "content": "Hello, GPT!" } ] }' ``` -------------------------------- ### Responses API Integration Source: https://ezaiapi.com/docs Use the simplified Responses API for compatibility with tools like n8n and LangChain. ```bash curl https://ezaiapi.com/v1/responses \ -H "Authorization: Bearer sk-your-key" \ -H "Content-Type: application/json" \ -d '{ "model": "claude-sonnet-4-5", "input": "Hello!", "max_output_tokens": 1024 }' ``` -------------------------------- ### Enable Extended Thinking (Chain-of-Thought) Source: https://ezaiapi.com/docs Activate Claude's chain-of-thought reasoning for complex tasks by including the `thinking` object in the request. Recommended with streaming and a budget of 5K-10K tokens. ```json { "model": "claude-opus-4-6", "max_tokens": 16000, "stream": true, "thinking": { "type": "enabled", "budget_tokens": 10000 }, "messages": [ { "role": "user", "content": "Solve this step by step..." } ] } ``` -------------------------------- ### Supported Models Source: https://ezaiapi.com/docs Lists the AI models supported by the EzAI API, categorized by provider. ```APIDOC ## Supported Models All models are accessible via `/v1/messages` (Anthropic), `/v1/chat/completions` (OpenAI) and `/v1/responses` (Responses API) formats. ### Claude - claude-opus-4-6 (144K context) - claude-opus-4-5 (160K context) - claude-sonnet-4-6 (new, 200K context) - claude-sonnet-4-5 (144K context) - claude-sonnet-4 (216K context) - claude-haiku-4-5 (144K context) ### GPT / OpenAI - gpt-5.4 (new, ★, 400K context) - gpt-5.3-codex (400K context) - gpt-5.2 (264K context) / gpt-5.2-codex (400K context) - gpt-5.1 (264K context) / gpt-5.1-codex (400K context) - gpt-5.1-codex-mini / max (400K context) - gpt-5 / gpt-5-mini (264K context) - gpt-4.1 / gpt-4.1-mini / nano (128K context) - gpt-4o / gpt-4o-mini (128K context) - o3 / o3-mini / o4-mini (aliases) ### Gemini - gemini-3.1-pro (preview, 128K context) - gemini-3-pro (preview, 128K context) - gemini-3-flash (preview, 128K context) - gemini-2.5-pro (128K context) ### xAI - grok-code-fast-1 (128K context) ``` -------------------------------- ### Streaming Responses Source: https://ezaiapi.com/docs Enable streaming to receive responses as Server-Sent Events (SSE), which is useful for real-time interactions. ```APIDOC ## Streaming Add `"stream": true` to receive Server-Sent Events: ```bash curl https://ezaiapi.com/v1/messages \ -H "x-api-key: sk-your-key" \ -H "anthropic-version: 2023-06-01" \ -H "content-type: application/json" \ -d '{ "model": "claude-sonnet-4-5", "max_tokens": 1024, "stream": true, "messages": [ { "role": "user", "content": "Write a haiku" } ] }' ``` SSE events: `message_start` → `content_block_delta` → `message_stop`. See Anthropic streaming docs. ``` -------------------------------- ### Anthropic SDK Integration Source: https://ezaiapi.com/docs Access multiple model families using the official Anthropic SDK by pointing the base_url to EzAI. ```python # pip install anthropic import anthropic client = anthropic.Anthropic( api_key="sk-your-key", base_url="https://ezaiapi.com" ) # Claude msg = client.messages.create( model="claude-sonnet-4-5", max_tokens=1024, messages=[{"role": "user", "content": "Hello!"}] ) print(msg.content[0].text) # GPT — same client, just change model msg = client.messages.create(model="gpt-4.1", max_tokens=1024, messages=[{"role": "user", "content": "Hello GPT!"}]) # Gemini msg = client.messages.create(model="gemini-2.5-pro", max_tokens=1024, messages=[{"role": "user", "content": "Hello Gemini!"}]) ``` ```javascript // npm install @anthropic-ai/sdk import Anthropic from '@anthropic-ai/sdk'; const client = new Anthropic({ apiKey: 'sk-your-key', baseURL: 'https://ezaiapi.com' }); const msg = await client.messages.create({ model: 'claude-sonnet-4-5', max_tokens: 1024, messages: [{ role: 'user', content: 'Hello!' }] }); console.log(msg.content[0].text); ``` -------------------------------- ### Count Tokens via API Source: https://ezaiapi.com/docs Calculate the number of tokens for a given message payload without incurring credit charges. ```bash curl https://ezaiapi.com/v1/messages/count_tokens \ -H "x-api-key: sk-your-key" \ -H "anthropic-version: 2023-06-01" \ -H "content-type: application/json" \ -d '{ "model": "claude-sonnet-4-5", "messages": [{ "role": "user", "content": "Hello!" }] }' ``` -------------------------------- ### Error Codes and Handling Source: https://ezaiapi.com/docs This section details common error codes returned by the API, their meanings, and recommended actions to resolve them. ```APIDOC ## Error Codes Code | Meaning | What to Do ---|---|--- 400| Bad request / invalid body| Check your JSON payload and required fields 401| Invalid or missing API key| Check `x-api-key` header value 402| Insufficient balance| Top up credits in dashboard 403| IP blocked or Cloudflare WAF| Wait 5 min (IP block) or set custom User-Agent (SDK) 405| Method not allowed| Use POST for /v1/messages 408| Request timeout| Retry — upstream model was slow to respond 413| Payload too large| Reduce input tokens or message count 429| Rate limit exceeded (RPM or concurrent)| Check `Retry-After` header; reduce request frequency 502| Upstream error| Retry after a few seconds 503| All upstream providers busy| Retry with exponential backoff 529| Upstream overloaded| Wait and resend — automatic retry recommended ``` -------------------------------- ### Create Message (Gemini) Source: https://ezaiapi.com/docs Send a message to the Gemini-2.5-pro model using the EzAI API. Responses are normalized to the Anthropic Messages API format. ```bash curl https://ezaiapi.com/v1/messages \ -H "x-api-key: sk-your-key" \ -H "anthropic-version: 2023-06-01" \ -H "content-type: application/json" \ -d '{ "model": "gemini-2.5-pro", "max_tokens": 1024, "messages": [ { "role": "user", "content": "Hello, Gemini!" } ] }' ``` -------------------------------- ### Create Message (Claude) Source: https://ezaiapi.com/docs Send a message to the Claude-sonnet-4-5 model using the EzAI API. The proxy handles format conversion. ```bash curl https://ezaiapi.com/v1/messages \ -H "x-api-key: sk-your-key" \ -H "anthropic-version: 2023-06-01" \ -H "content-type: application/json" \ -d '{ "model": "claude-sonnet-4-5", "max_tokens": 1024, "messages": [ { "role": "user", "content": "Hello, Claude!" } ] }' ``` -------------------------------- ### Uninstall EzAI Proxy Configuration Source: https://ezaiapi.com/docs Commands to remove the environment variables and Claude Code settings related to EzAI. ```bash # Remove env vars from your shell config unset ANTHROPIC_BASE_URL unset ANTHROPIC_API_KEY # Remove Claude Code settings rm ~/.claude/settings.json ``` -------------------------------- ### POST /v1/messages Source: https://ezaiapi.com/docs Send a message to any supported AI model. The API automatically handles format conversions for Anthropic, OpenAI, and Google models. ```APIDOC ## Create Message POST `/v1/messages` Send a message to any model. The proxy auto-converts between formats upstream — you always use the same Anthropic Messages format. ### Request Example (Claude) ```bash curl https://ezaiapi.com/v1/messages \ -H "x-api-key: sk-your-key" \ -H "anthropic-version: 2023-06-01" \ -H "content-type: application/json" \ -d '{ "model": "claude-sonnet-4-5", "max_tokens": 1024, "messages": [ { "role": "user", "content": "Hello, Claude!" } ] }' ``` ### Request Example (GPT) ```bash curl https://ezaiapi.com/v1/messages \ -H "x-api-key: sk-your-key" \ -H "anthropic-version: 2023-06-01" \ -H "content-type: application/json" \ -d '{ "model": "gpt-4.1", "max_tokens": 1024, "messages": [ { "role": "user", "content": "Hello, GPT!" } ] }' ``` ### Request Example (Gemini) ```bash curl https://ezaiapi.com/v1/messages \ -H "x-api-key: sk-your-key" \ -H "anthropic-version: 2023-06-01" \ -H "content-type: application/json" \ -d '{ "model": "gemini-2.5-pro", "max_tokens": 1024, "messages": [ { "role": "user", "content": "Hello, Gemini!" } ] }' ``` **Note:** Request uses Anthropic format. The proxy auto-converts to OpenAI format upstream and normalizes the response back. Response follows the standard Anthropic Messages API format for all models. ``` -------------------------------- ### View Rate Limit Response Headers Source: https://ezaiapi.com/docs API responses include these headers to track RPM and concurrent request usage. ```text x-ratelimit-tier: topup x-ratelimit-limit-requests: 30 # RPM limit for your tier x-ratelimit-remaining-requests: 28 # Remaining requests this minute x-ratelimit-reset-requests: 2026-03-03T09:00:00.000Z x-concurrent-limit: 5 # Max parallel requests x-concurrent-remaining: 3 # Available parallel slots ``` -------------------------------- ### Authentication Headers Source: https://ezaiapi.com/docs Required headers for authenticating requests to the EzAI API. ```text # Required headers x-api-key: sk-your-api-key content-type: application/json anthropic-version: 2023-06-01 ``` -------------------------------- ### Count Tokens Source: https://ezaiapi.com/docs Endpoint to count the number of tokens in a given message. This operation is free and does not consume credits. ```APIDOC ## POST /v1/messages/count_tokens ### Description Counts the tokens in a given message. This is a free operation. ### Method POST ### Endpoint `/v1/messages/count_tokens` ### Request Body - **model** (string) - Required - The model to use for counting tokens. - **messages** (array) - Required - An array of message objects, each with a `role` and `content`. - **role** (string) - Required - The role of the message sender (e.g., "user", "assistant"). - **content** (string) - Required - The content of the message. ### Request Example ```json { "model": "claude-sonnet-4-5", "messages": [ { "role": "user", "content": "Hello!" } ] } ``` ### Response #### Success Response (200) - **input_tokens** (integer) - The number of input tokens counted. #### Response Example ```json { "input_tokens": 12 } ``` ``` -------------------------------- ### OpenAI Responses API Source: https://ezaiapi.com/docs An API endpoint that follows the OpenAI Responses format, compatible with tools like n8n and LangChain. ```APIDOC ## POST /v1/responses ### Description OpenAI Responses API format. Compatible with n8n, LangChain, and tools using the newer OpenAI SDK. Accepts `input` (string or message array) + `instructions` (system prompt). Auto-converted to Anthropic format upstream. ### Method POST ### Endpoint `/v1/responses` ### Parameters #### Request Body - **model** (string) - Required - The model to use. - **input** (string or array) - Required - The input prompt or message array. - **max_output_tokens** (integer) - Optional - The maximum number of tokens to generate. - **instructions** (string) - Optional - The system prompt. ### Request Example ```json { "model": "claude-sonnet-4-5", "input": "Hello!", "max_output_tokens": 1024 } ``` ``` -------------------------------- ### Extended Thinking (Chain-of-Thought) Source: https://ezaiapi.com/docs Enable Claude's chain-of-thought reasoning for complex tasks by setting the `thinking` parameter in the request body. ```APIDOC ## Extended Thinking Enable Claude's chain-of-thought reasoning for complex tasks: ```json { "model": "claude-opus-4-6", "max_tokens": 16000, "stream": true, "thinking": { "type": "enabled", "budget_tokens": 10000 }, "messages": [ { "role": "user", "content": "Solve this step by step..." } ] } ``` #### Supported Models claude-opus-4-6 · claude-sonnet-4-5 · claude-sonnet-4 #### Best Practices budget_tokens: 5K–10K for most tasks. Max: 32,000. Always use with streaming. ``` -------------------------------- ### Authentication Source: https://ezaiapi.com/docs All requests to the EzAI API require authentication using your API key, which should be included in the request headers. ```APIDOC ## Authentication Include your API key in every request: ```http # Required headers x-api-key: sk-your-api-key content-type: application/json anthropic-version: 2023-06-01 ``` **Base URL:** `https://ezaiapi.com` — all requests go here. Get your key from the dashboard. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.