Build
Connect the tools you already use.
Start with a production-qualified Codex or OpenCode setup. Other Responses API and Chat Completions clients can connect when they satisfy the published compatibility contract.
Shared configuration
Set the same three environment variables regardless of client.
export COSTIQ_BASE_URL=https://inference.costiq.xyz/v1
export COSTIQ_MODEL=general-fast
printf 'CostIQ API key: ' >&2
read -r -s COSTIQ_API_KEY && printf '\n' >&2
export COSTIQ_API_KEYCompatibility status
OpenAI compatibility is not one binary capability. CostIQ qualifies each client and protocol path with a real task.
| Client | Protocol | Status | Evidence |
|---|---|---|---|
Codex CLI 0.155.0 | Responses | Verified | Fresh profile, authenticated catalog, streaming, shell tool, and file change. |
OpenCode 1.18.31 | Responses | Verified | Clean project, function tool call, and exact file write. |
@ai-sdk/openai 4.0.83 | Responses and Chat | Verified | 12 Responses calls, 54 streamed multi-tool scenarios, and 10 non-streamed post-tool continuations. |
| cURL, Python, TypeScript | Responses | Verified examples | Model discovery, non-streaming, streaming, usage, and errors. |
| Other agents | Responses or Chat | Qualification required | Must pass the checklist below; a custom base URL alone is not enough. |
Verified versions were exercised through the public CostIQ endpoint, most recently on 4 October 2026. Only the listed versions are qualified; recheck after a client upgrade or protocol or tool-calling change.
Codex
Use CostIQ as a native Responses API provider.
Create a separate user-level profile so CostIQ does not replace your normal Codex provider. Save this file next to ~/.codex/config.toml; do not put provider configuration in a project-level .codex/config.toml.
model = "general-fast"
model_provider = "costiq"
model_context_window = 500000
model_reasoning_effort = "high"
[model_providers.costiq]
name = "CostIQ"
base_url = "https://inference.costiq.xyz/v1"
wire_api = "responses"
request_max_retries = 0
stream_max_retries = 0
[model_providers.costiq.auth]
command = "printenv"
args = ["COSTIQ_API_KEY"]codex --profile costiqExport COSTIQ_API_KEY before starting. The credential command reads it without storing the key in TOML and enables Codex to refresh CostIQ's authenticated model catalog. The published command is for macOS and Linux.
OpenCode
Use CostIQ through OpenCode's native Responses provider.
Place this file in the project you intend to use. It reads the key from the process environment and does not require storing the credential in OpenCode's auth file.
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"costiq": {
"npm": "@ai-sdk/openai",
"name": "CostIQ",
"options": {
"baseURL": "{env:COSTIQ_BASE_URL}",
"apiKey": "{env:COSTIQ_API_KEY}"
},
"models": {
"general-fast": { "name": "General Fast" }
}
}
},
"model": "costiq/general-fast"
}opencode run --model costiq/general-fast "Reply with exactly OK."Python
Official OpenAI Python client with a custom base URL.
env -u COSTIQ_API_KEY python3 -m pip install openaiimport os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["COSTIQ_API_KEY"],
base_url=os.environ.get(
"COSTIQ_BASE_URL",
"https://inference.costiq.xyz/v1",
).rstrip("/"),
max_retries=0,
timeout=60.0,
)
response = client.responses.create(
model=os.environ.get("COSTIQ_MODEL", "general-fast"),
input="Reply with gateway-ok",
store=False,
)
print(response.output_text)TypeScript
Official OpenAI JavaScript client with retries disabled.
env -u COSTIQ_API_KEY npm install openaiimport OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.COSTIQ_API_KEY,
baseURL:
process.env.COSTIQ_BASE_URL ??
"https://inference.costiq.xyz/v1",
maxRetries: 0,
timeout: 60_000,
});
const response = await client.responses.create({
model: process.env.COSTIQ_MODEL ?? "general-fast",
input: "Reply with gateway-ok",
store: false,
});
console.log(response.output_text);Other clients
An agent is a CostIQ candidate only if it lets you set the complete base URL, bearer key, and model alias, and if it speaks native Responses or Chat Completions. If it hard-codes OpenAI-only account endpoints, hides the base URL, or requires a proprietary subscription transport, it is not automatically compatible.
- Set
https://inference.costiq.xyz/v1, your CostIQ key, andgeneral-fast. Do not append a second/v1. - Verify authenticated model discovery and one small non-streaming request.
- Verify streaming reaches its protocol-specific terminal event.
- Run one function-tool round trip and one harmless real task, not only a text reply.
- Confirm the client surfaces
401,403,413, and429without retry storms.