Documentation / Getting started
Connect your app to Clydex.
Create a key, choose a model, and send your first text request. Find setup instructions for your application, then follow its usage and cost in your Clydex account.
01 / Connect
Make a text request.
- Sign in with Google. Use Referrals for the welcome-credit steps, or redeem a purchased code in Top Up.
- Create a key for one pool. In API Keys, choose a pool and optional lifetime spending limit. The key fixes both pool and balance type. A Promo key never falls back to your paid balance.
- Save the secret once. Keep it in a server environment or your client’s secret store. Clydex cannot reveal an API key again. Never put it in a public browser bundle, URL, repository, or screenshot.
https://<YOUR_CLYDEX_DOMAIN>/v1Use this origin followed by /v1. A client that appends an endpoint must produce exactly /v1/responses or /v1/chat/completions, without a duplicated /v1. Authentication uses your Clydex API key as a Bearer token.
export CLYDEX_BASE_URL='https://<YOUR_CLYDEX_DOMAIN>/v1'
# Paste the key at the prompt; it is not echoed.
read -r -s -p 'Clydex API key: ' CLYDEX_API_KEY; echo
export CLYDEX_API_KEY
curl --fail-with-body "$CLYDEX_BASE_URL/models" \
-H "Authorization: Bearer $CLYDEX_API_KEY"Select a model ID returned by your key’s catalog and check its protocol and output limit in Channels & Models. Replace the model placeholder below. The example output cap of 32 must be within that route’s published limit.
{
"model": "<MODEL_FROM_YOUR_KEY_CATALOG>",
"input": "Reply with one short word.",
"max_output_tokens": 32,
"store": false,
"stream": false
}# Save the edited JSON above as request.json.
# Use a NEW ID for each intended generation; keep it on a retry.
CLYDEX_REQUEST_ID=$(node -e 'console.log(crypto.randomUUID())')
curl --fail-with-body --include \
"$CLYDEX_BASE_URL/responses" \
-H "Authorization: Bearer $CLYDEX_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $CLYDEX_REQUEST_ID" \
--data-binary @request.jsonBash’s ID generator uses Node.js. curl must support --fail-with-body. These snippets send no request from this page and never ask the website to store your key.
What does the text profile accept?
Text messages may use system, developer, user, or assistant roles. Responses accepts a text input and optional instructions. Chat accepts text messages. Always set an output cap: max_output_tokens for Responses, or exactly one of max_completion_tokens and max_tokensfor Chat. Storage must be false or omitted; Chat permits only one result.
Tools, tool results, structured output, sampling controls, explicit reasoning controls, stored history, previous responses, media, remote attachments, WebSockets, and Anthropic calls are unavailable. Unknown fields are rejected. An SDK may add defaults that are outside this profile; inspect its request configuration before use.
02 / Keep the outcome clear
Streams, status, and retries.
Set stream: true on the same endpoint. Read complete SSE frames; network chunks are not event boundaries. Responses and Chat keep their respective wire formats. For Chat, request final usage with stream_options.include_usage: true.
A first token or HTTP 200 does not mean a request settled successfully. Keep reading terminal events and errors. A disconnected stream may leave a reservation while the outcome is checked; it is never automatically displayed as a free completed request.
Keep X-Clydex-Request-Id from the response headers, then read its status with the same API key. X-Request-Id is a separate correlation ID for diagnostics. A different key, even in your account, cannot read that request here.
curl --fail-with-body \
"$CLYDEX_BASE_URL/requests/<X-CLYDEX-REQUEST-ID>" \
-H "Authorization: Bearer $CLYDEX_API_KEY"An Idempotency-Key of 16–128 letters, digits, underscores, periods, colons, or hyphens prevents an accepted generation from being sent twice. Repeating the same body with the same key returns 409 request_already_accepted; a changed body returns 409 idempotency_conflict. It does not replay the generated content. Without that header, another POST is a new generation.
Disable automatic SDK retries (max_retries=0 in Python or maxRetries: 0 in Node clients that provide these options). Review an uncertain outcome in Request history before deciding to start a new request. Requests under review remain pending until their outcome is confirmed.
03 / Understand the charge
Real tokens. Separate balances.
Request history shows actual input, cached input, and output tokens, plus the public price snapshot and final charge. Cached input is included in total input; reasoning tokens, when present, are included in total output. Neither is counted twice.
Illustrative tokens, not a real request: bill 10 uncached input + 2 cached input + 4 output. There are 16 total tokens. No hidden token multiplier applies.
charge = (
(input - cached_input) × input_rate
+ cached_input × cached_input_rate
+ output × output_rate
) / 1,000,000This formula applies only to a published tariff with these categories. Context bands and other conditions appear with that model’s price. Check the published rates before sending a request. Rates that are not shown are not available for purchase.
- Paid balance funds paid-pool keys and receives eligible 5% referral commissions.
- Promo credits fund only Promo-pool requests at standard model rates, without a paid-pool discount.
- Available means posted balance minus active reservations. A pending charge is not a settled $0.
See the two referral programs and purchase and credit terms before using either balance. Credits and commission are for API use and cannot be withdrawn as cash or crypto.
04 / Troubleshoot
An error with a next step.
JSON errors contain error.code, error.message, and error.correlation_id. After a stream starts, an error arrives through SSE; the already-sent HTTP status cannot describe the final outcome.
| Code | Next step |
|---|---|
invalid_api_key | Use a Clydex key, Bearer authentication, and the Clydex origin. Check whether the key was revoked. |
unsupported_or_invalid_request | Use the text profile above. Remove tools, media, unsupported defaults, and unknown fields; include an output cap. |
model_unavailable | Read the catalog with the same key. Pool access and protocol must match. |
model_limit_exceeded | Reduce the input size or output cap to the selected route’s published limits. |
insufficient_balancekey_budget_exceeded | Review available balance, reservations, and the key’s lifetime limit. A Promo key cannot use paid funds. |
promotion_pausedpromo_cost_cap_reached | New promo requests are paused. Existing credits are preserved; check campaign status in Referrals. |
gateway_unavailablepricing_unagreed | Live requests are not enabled for this route. Published prices do not activate a model. Check availability; do not repeatedly submit a paid generation. |
request_already_acceptedidempotency_conflict | Inspect the original request status. Do not generate a new ID just to bypass an uncertain outcome. |
Keep the correlation ID and request ID for diagnosis. Never include API keys or credit codes in an error report.
05 / Know the boundaries
Application compatibility.
Find your application below, then use its guide to connect your Clydex key and model. Clydex currently accepts text requests through Responses and Chat Completions. Applications that require tools, media, or a different API cannot use those features.
Not tested means the settings have not been verified with a live Clydex model in that application. Unavailable means the application requires a capability Clydex does not currently offer. A successful model-list check alone does not verify a full chat or agent session.
| Application / guide | Clydex status | Connection scope |
|---|---|---|
| Codex CLI / App / VS CodeResponses | Not tested | Responses configuration; agent workflows unavailable |
| Claude Code / VS CodeAnthropic | Unavailable | Requires an API that Clydex does not currently provide |
| Claude DesktopAnthropic | Unavailable | No Clydex connection is currently available |
| OpenCodeChat Completions | Not tested | Custom text connection; agent workflows unavailable |
| Grok integrationsGrok models | Unavailable | Grok models are not available in the Clydex catalog |
| HermesChat Completions | Not tested | Custom text connection; agent workflows unavailable |
| Cherry StudioChat Completions | Not tested | Text chat configuration; attachments and tools unavailable |
| OpenAI-compatible APIResponses / Chat | Not tested | Text requests and streaming; check live model availability |
| Anthropic-compatible APIAnthropic | Unavailable | The /v1/messages endpoint is unavailable |
06 / Connect your application
Client guides.
Start with the Quickstart to save your Clydex key and list available models. Reuse that key, this deployment’s base URL, and an exact model ID in your application. The same key always spends from its selected pool and balance.
Codex CLI / App / VS Code Not tested
Set up a named Clydex connection for the Responses API. This configures authentication and the endpoint; full Codex agent sessions are currently unavailable because they need features beyond Clydex’s text profile.
- Export
CLYDEX_API_KEYusing the Quickstart. Launch Codex from an environment that can read that variable, including when using the app or VS Code. - Merge the settings below into your user
~/.codex/config.toml. Replace the model placeholder with an ID from your Clydex key’s catalog. - Restart the client after changing its environment or configuration.
model_provider = "clydex"
model = "<MODEL_FROM_YOUR_KEY_CATALOG>"
[model_providers.clydex]
name = "Clydex"
base_url = "https://<YOUR_CLYDEX_DOMAIN>/v1"
env_key = "CLYDEX_API_KEY"
wire_api = "responses"
requires_openai_auth = false
supports_websockets = false
request_max_retries = 0
stream_max_retries = 0The resulting endpoint must be /v1/responses. Requests need an explicit output cap and must omit stored history, tools, and reasoning controls. If your client cannot meet those requirements, use the direct API example below. These settings do not make an unsupported agent session compatible.
Claude Code / VS Code Unavailable
Claude Code requires the Messages API and agent tools. Clydex does not currently expose /v1/messages or those tool workflows, so there is no supported Clydex setup for its terminal or VS Code interface.
Keep Clydex keys out of incompatible connection settings. For a Clydex text request, use the API example or review the Cherry Studio settings below.
Claude Desktop Unavailable
Claude Desktop’s inference connection cannot currently use Clydex. Clydex provides Responses and Chat Completions, while this integration needs the Messages API. Developer settings and MCP connections do not translate between these APIs.
Use the Clydex Quickstart for text generation. There is no Clydex Desktop launch command or token configuration to apply at this time.
OpenCode Not tested
Add Clydex as a custom Chat Completions connection. The following configuration is for OpenCode versions using the provider configuration schema.
- In OpenCode, run
/connect, select Other, useclydexas the connection ID, and enter your Clydex API key. - Merge the JSON below into your project’s
opencode.jsonand replace the model placeholder. Keep the secret in the credential store. - Run
/modelsand select the model under Clydex.
{
"provider": {
"clydex": {
"npm": "@ai-sdk/openai-compatible",
"name": "Clydex",
"options": { "baseURL": "https://<YOUR_CLYDEX_DOMAIN>/v1" },
"models": {
"<MODEL_FROM_YOUR_KEY_CATALOG>": { "name": "Clydex text" }
}
}
}
}Before sending, confirm the client sends an output cap and omits tools, sampling controls, and stored history. Set context and output limits from Channels & Models. Agent execution is unavailable. If your version uses a different config schema or always adds unsupported fields, use the direct API example instead.
Grok integrations Unavailable
Grok models and Grok search features are not currently available in Clydex. This applies to Grok CLI and Grok configurations inside Claude Code, Codex, and OpenCode. Entering a Grok model name does not enable access.
To use a model from your Clydex catalog in Codex or OpenCode, follow that application’s Clydex guide and its stated limits. A Clydex key does not include a Grok subscription.
Hermes Not tested
Configure a named custom endpoint using Chat Completions. Export CLYDEX_API_KEY in the environment that starts Hermes, then merge these settings into ~/.hermes/config.yaml and replace the model placeholder.
providers:
clydex:
name: Clydex
api: https://<YOUR_CLYDEX_DOMAIN>/v1
key_env: CLYDEX_API_KEY
transport: chat_completions
model:
provider: custom:clydex
default: <MODEL_FROM_YOUR_KEY_CATALOG>Run hermes model outside an active chat to select the connection. Within a chat, /model custom:clydex:<MODEL_ID> selects an already configured model. Use text only, set an output cap, and disable tools and automatic fallback. If your version always sends tools or unsupported options, it cannot use Clydex’s current text profile. Full agent workflows remain unavailable.
Cherry Studio Not tested
- Open the application’s model-provider settings, add a connection named Clydex, and choose the OpenAI-compatible API type.
- Set its base URL to
https://<YOUR_CLYDEX_DOMAIN>/v1and credential to your Clydex API key. - Refresh the model list or add an exact ID from your Clydex catalog. Select Chat Completions when your version offers a protocol choice.
- Set an output limit within the model’s published cap. Turn off tools, web search, attachments, reasoning options, and custom sampling parameters.
- Send a short text message, then check its completed status, tokens, and charge in Clydex request history.
The final request URL must be /v1/chat/completions, with no repeated /v1. If the client returns an unsupported-field error, remove the named option. A client version that cannot omit it is not compatible with the current profile. Image requests are unavailable.
OpenAI-compatible API / SDKs Not tested live
Use the Quickstart for curl, or send a text request with the Python SDK below. Install the openai package in your Python environment, export CLYDEX_API_KEY, and replace the model placeholder. Your account must have an active model and enough available balance.
import os
import uuid
from openai import OpenAI
client = OpenAI(
api_key=os.environ["CLYDEX_API_KEY"],
base_url="https://<YOUR_CLYDEX_DOMAIN>/v1",
max_retries=0,
)
# Keep this ID if the same generation needs an explicit retry.
request_id = str(uuid.uuid4())
response = client.responses.create(
model="<MODEL_FROM_YOUR_KEY_CATALOG>",
input="Reply with one short word.",
max_output_tokens=32,
store=False,
extra_headers={"Idempotency-Key": request_id},
)
print(response.output_text)For a Node client, pass your key as apiKey, this URL as baseURL, and maxRetries: 0. Use the strict JSON payload from the Quickstart. Select Chat Completions only for a model that supports that protocol. SDK versions have not yet been verified against a live Clydex model.
On a timeout, inspect request history before starting a new generation. Keep the same idempotency ID for an intentional retry of the same body; Clydex reports an already accepted request without replaying its content. Use a new ID only for a new generation.
Anthropic-compatible API / SDKs Unavailable
Clydex does not currently serve /v1/messages. Anthropic Python and TypeScript clients require that protocol, so changing their base URL and API key alone will not connect them to Clydex.
Use the Responses SDK example or the Chat Completions Quickstart for text requests. Messages requests are not automatically translated into either endpoint.
