Inference Cheap API
Connect with the OpenAI SDKs and your Inference Cheap key.
For agents — copy the integration prompt.
Connect
| Client | Base URL |
|---|---|
| OpenAI SDKs | https://openai.inference.cheap/v1 |
| Codex CLI / app | https://codex.inference.cheap — setup |
Get an API key from the Inference Cheap team. Pass it as
Authorization: Bearer YOUR_API_KEY or the SDK's api_key option.
Keep keys server-side.
export INFERENCE_CHEAP_API_KEY="YOUR_API_KEY"
curl --fail-with-body https://openai.inference.cheap/v1/models \
-H "Authorization: Bearer $INFERENCE_CHEAP_API_KEY"First request
Install the openai package. Use a model returned by /v1/models.
Python
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["INFERENCE_CHEAP_API_KEY"],
base_url="https://openai.inference.cheap/v1",
)
response = client.responses.create(model="gpt-5.6-sol", input="Say hello.")
print(response.output_text)JavaScript
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.INFERENCE_CHEAP_API_KEY,
baseURL: "https://openai.inference.cheap/v1",
});
const response = await client.responses.create({
model: "gpt-5.6-sol",
input: "Say hello.",
});
console.log(response.output_text);API endpoints
Paths are relative to https://openai.inference.cheap. All require an API key.
| Operation | Endpoint |
|---|---|
| Responses / Chat Completions | POST /v1/responses, POST /v1/chat/completions |
| List / retrieve models | GET /v1/models, GET /v1/models/{id} |
| Retrieve / delete a stored response | GET /v1/responses/{id}, DELETE /v1/responses/{id} |
| Response inputs / background cancellation | GET /v1/responses/{id}/input_items, POST /v1/responses/{id}/cancel |
| Compact input / count tokens | POST /v1/responses/compact, POST /v1/responses/input_tokens |
| Conversations / files | /v1/conversations, /v1/files |
| Generate / edit images | Images API |
| Billing scope and multipliers | GET /v1/sub2api/billing |
Request options
- Models:
/v1/modelslists models available to your key, not prices. Model, tool, and reasoning support depend on your access. - Reasoning: omit for defaults. Responses uses
reasoning: { effort: "high" }; Chat Completions usesreasoning_effort: "high". - Streaming: set
stream: true. Readresponse.output_text.deltaevents; handleresponse.failedandresponse.incomplete. HTTP 200 alone is not success. - History: set
store: truefor later retrieval. Useprevious_response_idor a conversation ID, not both; resend instructions for each response. - Pricing: ask the team for rates and usage.
/v1/sub2api/billingreturns scope and multipliers, not per-model prices.
Errors
| Status | Action |
|---|---|
400 / 404 | Check the error, request fields, endpoint, model, and resource IDs. |
401 / 403 | Check your key and access. |
413 | Reduce the payload. |
429 | Reduce concurrency; respect Retry-After. |
5xx | Retry with bounded backoff. |
After a timeout, inspect a stored response before repeating the request.
For agents
Copy this Markdown prompt to your agent.
# Integrate Inference Cheap
- Use the OpenAI SDK with base URL https://openai.inference.cheap/v1.
- Read INFERENCE_CHEAP_API_KEY from the project's secret store; never expose it
in browser code or logs. Ask the Inference Cheap team if a key is missing.
- Call GET /v1/models before choosing a model; keep the user's choice if available.
- Start with Responses and default options. Preserve existing client settings.
- For streaming, check the final outcome; HTTP 200 is not proof of success.
- When testing is requested, make one small request and report its final result.
- Codex setup: https://docs.inference.cheap/codex
- Image generation: https://docs.inference.cheap/images