API Reference
Cortiqa returns conventional HTTP status codes and structured JSON error objects to assist with automated retry logic and debugging.
| Code | Status | Description |
|---|---|---|
200 | OK | The request succeeded. |
400 | Bad Request | Malformed JSON, missing required parameters, or invalid model ID. |
401 | Unauthorized | Missing, expired, or invalid sk-cortiqa-... API key. |
403 | Forbidden | Your account or key lacks permissions for the requested resource. |
404 | Not Found | The requested file, batch ID, or endpoint does not exist. |
429 | Too Many Requests | Rate limit exceeded or account monthly budget hard cap reached. |
500 | Internal Server Error | An unexpected server error occurred. Automatic SDK retries will attempt recovery. |
503 | Service Unavailable | High cluster concurrency or scheduled maintenance. Retry with backoff. |
When an error occurs, the response body contains a JSON object with error metadata:
{
"error": {
"message": "Incorrect API key provided: sk-cortiqa-***. You can obtain your API key from https://platform.cortiqa.co/api-keys.",
"type": "authentication_error",
"param": null,
"code": "invalid_api_key"
}
}Catch typed exceptions natively in your code:
# Python
from cortiqa import Cortiqa
from cortiqa.exceptions import AuthenticationError, RateLimitError, APIError
client = Cortiqa()
try:
response = client.chat.completions.create(
model="openai/gpt-oss-120b",
messages=[{"role": "user", "content": "Hello"}]
)
except AuthenticationError:
print("Invalid API key! Check sk-cortiqa credentials.")
except RateLimitError:
print("Rate limit reached! Backing off...")
except APIError as e:
print(f"API returned status {e.status_code}: {e.message}")// TypeScript / Node.js
import Cortiqa, { AuthenticationError, RateLimitError, APIError } from "@cortiqa/sdk";
const client = new Cortiqa();
try {
const message = await client.messages.create({
model: "openai/gpt-oss-120b",
messages: [{ role: "user", content: "Hello" }],
});
} catch (err) {
if (err instanceof AuthenticationError) {
console.error("Invalid API key!");
} else if (err instanceof RateLimitError) {
console.error("Rate limit exceeded!");
} else if (err instanceof APIError) {
console.error(`Cortiqa API error ${err.status}: ${err.message}`);
}
}