Documentation
Connect your apps to Somny
Create a key, choose a model, and send requests through OpenAI- or Anthropic-compatible endpoints.
Quick start
- Create a key. Sign in and open API key in your dashboard. Your account has one active key for all your apps. Use Show or Copy to retrieve your current key when you need it.
- Add a custom connection. In your app, choose a custom OpenAI-compatible or Anthropic-compatible connection and enter the matching base URL below.
- Choose a model. Paste your Somny key and enter a model ID from the Models page. Use the exact ID.
https://somny.xyz/v1https://somny.xyzIf the app asks for a full endpoint, use /v1/chat/completions, /v1/responses, or /v1/messages on that host. Avoid adding /v1 twice. Keep the key in your app’s private API settings or your server environment, rather than public website code.
To replace a lost or exposed key, choose Rotate key in your dashboard. The old key immediately stops accepting new requests. Copy the replacement and update every connected app. Rotation keeps your usage history and does not reset your allowance.
Claude Code and Desktop
Use https://somny.xyz as the gateway base URL. Claude appends /v1/models and /v1/messages itself, so leave the base URL at the host. Enter your Somny key using Bearer or x-api-key authentication.
In Claude Desktop, open Developer → Configure Third-Party Inference, select Gateway, and save the connection. If the Developer menu is hidden, enable Developer Mode under Help → Troubleshooting. Check the connection again, then choose an exact, currently available Claude ID from the Models page. Claude models require paid or manually granted access.
For the CLI, set ANTHROPIC_BASE_URL to https://somny.xyz, ANTHROPIC_AUTH_TOKEN to your Somny key, and ANTHROPIC_MODEL to the exact model ID. Configure any default Haiku, Sonnet or Opus overrides with available Somny IDs too; built-in provider IDs may differ. The desktop app uses its own connection settings.
A discovery URL containing /v1/messages/v1/models means a complete endpoint was entered as the base. Correct it to https://somny.xyz and save again. Somny also accepts that known URL composition for discovery and Messages requests. If a selected model fails, check its current status and your account’s access. Include the request ID and the non-secret error from Copy details when contacting support.
See Anthropic’s Claude Code gateway setup and Desktop gateway configuration. Individual advanced features still depend on the selected model’s qualified capabilities.
Make a request
Replace YOUR_SOMNY_KEY with your key and MODEL_ID with an available model. The SDK examples use the official OpenAI and Anthropic libraries; set SOMNY_API_KEY in your environment for the JavaScript versions.
List available models
curl https://somny.xyz/v1/models \
-H 'Authorization: Bearer YOUR_SOMNY_KEY'Chat Completions
from openai import OpenAI
client = OpenAI(
base_url="https://somny.xyz/v1",
api_key="YOUR_SOMNY_KEY",
)
reply = client.chat.completions.create(
model="MODEL_ID",
messages=[{"role": "user", "content": "Hello"}],
max_tokens=256,
)
print(reply.choices[0].message.content)Responses
The SDK examples reuse the OpenAI client from Chat Completions.
curl https://somny.xyz/v1/responses \
-H 'Authorization: Bearer YOUR_SOMNY_KEY' \
-H 'Content-Type: application/json' \
-d '{
"model": "MODEL_ID",
"input": "Hello",
"max_output_tokens": 256,
"store": false
}'Messages (Anthropic format)
curl https://somny.xyz/v1/messages \
-H 'x-api-key: YOUR_SOMNY_KEY' \
-H 'anthropic-version: 2023-06-01' \
-H 'Content-Type: application/json' \
-d '{
"model": "MODEL_ID",
"messages": [{"role": "user", "content": "Hello"}],
"max_tokens": 256
}'Image generation
All paid plans include Gemini 3.1 Flash Image and the GPT Image models in the model catalog. Use POST /v1/images/generations with a text prompt of up to 4,000 characters, one image per request (n: 1), and a size such as 1024x1024 or 1536x1024. Dimensions must be multiples of 16 and at most 2,048 pixels.
curl https://somny.xyz/v1/images/generations -H "Authorization: Bearer $SOMNY_API_KEY" -H "Content-Type: application/json" -H "Idempotency-Key: your-unique-image-request-id" -d '{"model":"gemini-3.1-flash-image","prompt":"A blue ceramic cup in soft studio lighting","size":"1024x1024","response_format":"b64_json"}'Somny normalizes the provider’s approximate image dimensions to your requested size, preserving the whole image and adding white borders where aspect ratios differ. Gemini returns JPEG and GPT Image returns PNG. Use client.images.generate with the same fields and your Somny base URL. Choose response_format: "b64_json" for inline bytes or "url" (the default) for a Somny image URL. Retrieve that URL with your Somny Bearer key. Key rotation preserves account ownership.
Download images promptly. Somny image URLs expire after 24 hours and also depend on supplier availability. DELETE /v1/images/IMAGE_ID revokes Somny retrieval access; it does not claim to delete the supplier’s copy. Somny stores retrieval metadata, with no local prompt or image content storage.
GPT Image uses 2,000,000 weighted credits per successful image at any supported size. Gemini uses 200,000 credits up to a 1,408-pixel longest edge and 300,000 credits above that. Image and text requests share your daily allowance. A full standard Starter / Plus / Pro / Max allowance covers 2 / 4 / 8 / 16 GPT Image generations.
Generation is non-streaming and text to image only. Editing, variations, multiple images per request, transparent backgrounds and extra generation controls are unavailable on this route. Unsupported fields return an error. Failed requests with no retrievable image use no image allowance. If a response is interrupted, use GET /v1/images/generations with your Bearer key and original Idempotency-Key header to check that request. A completed response gives its image URL; pending returns HTTP 202. This Somny recovery endpoint never generates another image. Reusing the key on POST returns a conflict and prevents a second dispatch.
Streaming
Set "stream": true (or stream=True in Python) and add -N to curl. Read through the final event to receive final usage. An initial HTTP 200 does not guarantee that a stream completed.
Claude Sonnet 5.5 supports JSON and streaming responses, including inline image input. Its streaming output arrives after generation finishes. Usage estimates are labelled and may round up reported token counts.
Saved Responses
Set store: true on a Responses request to save its input, output and tool payloads in your account. Saved content is encrypted and expires after 30 days. Ordinary foreground requests stay transient when store is omitted or false; background requests explicitly opt into temporary storage as described below.
Retrieve a saved response by ID, list its input items, or continue it with previous_response_id. Each continuation includes the prior input and output in the new model context and usage charge. Send any top-level instructions again; those instructions do not carry forward automatically.
To reuse selected saved items, pass { type: "item_reference", id: "msg_..." } in the new input. References can identify inputs or outputs in saved Responses, or items in your conversations. They include that item’s content and any captured file data in the new context and usage charge. The new response stays transient unless you explicitly request storage.
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://somny.xyz/v1",
apiKey: process.env.SOMNY_API_KEY,
maxRetries: 0,
});
const first = await client.responses.create({
model: "MODEL_ID",
input: "My project's name is Orchard.",
max_output_tokens: 128,
store: true,
});
try {
const saved = await client.responses.retrieve(first.id);
console.log(saved.output_text);
const next = await client.responses.create({
model: "MODEL_ID",
previous_response_id: first.id,
input: "What is my project's name?",
max_output_tokens: 128,
store: false,
});
console.log(next.output_text);
} finally {
await client.responses.delete(first.id);
}Saved Responses use the same account storage quota as files. An active saved response reserves 128 MiB of capacity; after completion, only its actual encrypted size counts. Expanded conversation input must fit the 16 MiB inference limit and the model’s context limit. Standard and background streaming are supported.
Delete each saved response when it is no longer needed. Deleting an earlier response or an uploaded file does not delete copies of its content in later explicitly saved responses. Key rotation preserves your saved responses. Deletion or expiry immediately removes access; encrypted backups follow a separate 30-day retention schedule.
Background Responses
Set background: true to queue a response and retrieve it by ID while it runs. Closing the original connection does not cancel it. Normal model limits, daily allowance and usage charges apply; queued work also counts toward your account’s active request limit.
Background execution explicitly requests encrypted storage of the input, output and stream events. With store omitted or false, that content expires ten minutes after completion, failure or cancellation. With store: true, it expires 30 days after creation. Delete the response sooner through the Responses API; encrypted backup copies follow a separate 30-day retention schedule.
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://somny.xyz/v1",
apiKey: process.env.SOMNY_API_KEY,
maxRetries: 0,
});
let response = await client.responses.create({
model: "MODEL_ID",
input: "Write a short greeting.",
max_output_tokens: 128,
background: true,
store: false,
});
try {
while (["queued", "in_progress"].includes(response.status)) {
await new Promise(resolve => setTimeout(resolve, 1000));
response = await client.responses.retrieve(response.id);
}
if (response.status === "completed") console.log(response.output_text);
else console.log(response.status, response.error);
} finally {
await client.responses.delete(response.id);
}To resume a stream, create the response with both background: true and stream: true. Keep its ID and the last received sequence_number, then retrieve it with { stream: true, starting_after: lastSequence }. Resumption delivers later events from the same request and does not generate another response.
Use client.responses.cancel(id) to stop queued or running work. Repeating cancellation is safe. Work cancelled before dispatch uses no allowance; already dispatched work can still have supplier usage. If cancellation is pending, poll the existing ID. Deletion immediately removes content access and requests cancellation. Rotating a key preserves access to the account’s stored responses.
Background Responses and Batch items currently share one executing job at a time across the service. A queued request must start and finish within its original 15-minute admission window, with at most ten minutes of execution. Interrupted dispatched attempts are not automatically restarted. Large simultaneous reads can return storage_capacity; retry retrieval after a pause, without creating a new generation.
Batches
Use the OpenAI Batch API for Chat Completions or Responses, or Anthropic Message Batches for Messages. Submit once, retain the batch ID, then poll and download its JSONL results. Each item uses the same model capabilities, limits and token multipliers as an ordinary request. Provider batch discounts do not apply to Somny’s allowance.
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://somny.xyz/v1",
apiKey: process.env.SOMNY_API_KEY,
maxRetries: 0,
});
const line = {
custom_id: "greeting-1", method: "POST", url: "/v1/chat/completions",
body: { model: "MODEL_ID", max_completion_tokens: 128,
messages: [{ role: "user", content: "Write a short greeting." }] },
};
const file = await client.files.create({
purpose: "batch",
file: new File([JSON.stringify(line) + "\n"], "requests.jsonl"),
});
let batch = await client.batches.create({
input_file_id: file.id,
endpoint: "/v1/chat/completions",
completion_window: "24h",
});
console.log("Keep this batch ID:", batch.id);
while (["validating", "in_progress", "finalizing", "cancelling"].includes(batch.status)) {
await new Promise(resolve => setTimeout(resolve, 1000));
batch = await client.batches.retrieve(batch.id);
}
for (const id of [batch.output_file_id, batch.error_file_id].filter(Boolean)) {
console.log(await (await client.files.content(id)).text());
}
console.log(batch.status, batch.errors);OpenAI input files must have purpose batch, unique custom_id values and one model and endpoint throughout. File validation is asynchronous; a validation failure prevents all items from starting. Anthropic validates each request’s parameters independently and includes errors alongside successful results. Streaming and nested background execution are unavailable inside either batch.
The completion window is 24 hours. Queued Batch items reserve storage; supplier funding is reserved and available daily allowance is checked when they start. Confirmed charges use the settlement day’s remaining allowance, with excess carried into subsequent days. Capacity and allowance shortages can delay an item until the window expires. Each started item has at most ten minutes to execute; Batch items and background Responses share one executor. An uncertain dispatched request is never automatically sent again.
Cancel through either SDK and wait for processing to end before deleting the batch. Cancellation preserves completed results and does not itself delete content. Requests cancelled before dispatch use no allowance; work already sent to a provider can still have usage. Large simultaneous downloads can return storage_capacity; retry retrieval after a pause.
Creating a batch explicitly requests encrypted storage. An OpenAI batch owns an independent copy of its input file. Its input and results are retained for 30 days from batch creation, or until its latest generated result file expires, whichever is later. Use output_expires_after to set generated-file expiry from one hour to 30 days after file creation. Anthropic batch content expires 29 days after batch creation. Batch metadata remains until deleted.
Anthropic provides client.messages.batches.delete(id). For OpenAI-format batches, Somny also provides DELETE /v1/batches/BATCH_ID after processing ends; this deletion extension is not an OpenAI SDK method. It deletes the independent batch input and all generated result files. Delete the original uploaded file and any separately saved responses or conversations independently. Generated OpenAI files can also be deleted individually through Files. Encrypted backups follow the separate 30-day retention schedule.
The application accepts up to 50,000 requests and 200 MiB per OpenAI input file, or 100,000 requests and 256 MiB per Anthropic batch. Individual expanded requests remain limited to 16 MiB. Your account can queue up to 100,000 batch items within its existing 1 GiB storage quota; ciphertext snapshots and encryption overhead count toward that quota. The public edge has a lower single-upload limit: 90 MiB was verified for Files, while 120 MiB was rejected. Use multipart Uploads for larger OpenAI files and split large Anthropic submissions. These limits do not promise a particular completion throughput.
Saved Chat Completions
Set store: true on a Chat Completions request to save the original input messages, final completion and metadata in your account. Saved content is encrypted and remains until you delete it. Omitting store, or setting it to false or null, keeps the request transient.
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://somny.xyz/v1",
apiKey: process.env.SOMNY_API_KEY,
maxRetries: 0,
});
const completion = await client.chat.completions.create({
model: "MODEL_ID",
messages: [{ role: "user", content: "Write a short greeting." }],
max_completion_tokens: 128,
metadata: { label: "greeting" },
store: true,
});
try {
const saved = await client.chat.completions.retrieve(completion.id);
console.log(saved.choices[0].message.content);
for await (const message of client.chat.completions.messages.list(completion.id)) {
console.log(message);
}
await client.chat.completions.update(completion.id, {
metadata: { label: "reviewed" },
});
} finally {
await client.chat.completions.delete(completion.id);
}Retrieve, list, update metadata or delete a saved completion with the Chat Completions API. List results can be filtered by model and metadata. The messages endpoint paginates the original inputs; the generated output is in the completion’s choices. Metadata updates replace the previous metadata; pass null or an empty object to clear it.
JSON and streaming generation use the same retrievable completion ID. A saved completion becomes readable after generation finishes; failed or interrupted drafts are discarded. Each active saved request reserves 128 MiB plus encryption and metadata headroom before inference. Completed requests use their actual encrypted size within the shared account storage quota. Lists accept up to 100 items per page; reduce the page size if a large page exceeds read capacity. Deletion removes active content without changing usage history, and backup copies follow the separate 30-day retention schedule.
Conversations
Create a conversation to store persistent context. You can retrieve it, update its metadata, and add, list, retrieve or delete individual items. Messages, function calls and results, and reasoning items are supported. Each create or append call accepts up to 20 items; hosted tool items remain unavailable.
Creating or appending items also accepts item_reference objects. These make independent copies of saved items in your account. A reference must resolve to available content; deleted or expired items return 404 unless another explicitly saved copy remains. If you have assigned the same item ID to different content, send the full item instead. Item references share the 16 MiB input limit and bounded storage read capacity.
Pass a conversation ID, or { id: "conv_..." }, in a Responses request. Its existing items are included in the model input, and the new input and output are added after generation completes. This explicitly requests storage even with store: false. Set store: true as well if you also want to retrieve the separate response by ID. Use either conversation or previous_response_id in a request.
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://somny.xyz/v1",
apiKey: process.env.SOMNY_API_KEY,
maxRetries: 0,
});
const conversation = await client.conversations.create({
items: [{ role: "user", content: "My project's name is Orchard." }],
});
try {
const response = await client.responses.create({
model: "MODEL_ID",
conversation: conversation.id,
input: "What is my project's name?",
max_output_tokens: 128,
store: false,
});
console.log(response.output_text);
// The conversation keeps its items even with store: false.
} finally {
const ids = [];
for await (const item of client.conversations.items.list(conversation.id)) {
ids.push(item.id);
}
for (const id of ids) {
await client.conversations.items.delete(id, {
conversation_id: conversation.id,
});
}
await client.conversations.delete(conversation.id);
}Conversation context is encrypted, belongs to your account and remains until deleted. Deleting a conversation removes its metadata but does not delete its items. Delete items individually to remove their content; Somny also allows listing and deleting retained items using the original conversation ID after the container is deleted. Copies in saved Responses or other conversations must be deleted separately. Encrypted backups retain deleted content for up to 30 days.
Send one generation at a time per conversation. Simultaneous generation or item edits return 409. Context still counts toward model usage and must fit 1,000 input items, 16 MiB and the model’s context limit. A generation reserves 128 MiB plus encryption and metadata headroom, one resource slot per new input, and 256 output slots. Those slots are reserved before billing admission; completed items use their actual storage. The shared account limit remains 1 GiB and 1,000 resources.
Files
Uploading through the Files API explicitly stores the file in your account. You can list files, retrieve metadata, and delete them. Files remain accessible after key rotation and are isolated from other accounts. Ordinary inference does not save its input or output.
Responses accepts uploaded PDF and image IDs on qualified model routes. Messages accepts PDF, image, and UTF-8 plain text file IDs. Chat Completions accepts PDF file IDs and inline base64 PDF data on gpt-5.6-luna, using { type: "file", file: { file_id: "file_..." } } content parts. Chat PDF requests cannot include function tools or stop sequences. Choose a model whose capabilities include the input type and endpoint you need; replace PDF_MODEL_ID below with its exact ID.
Responses also accepts UTF-8 text and code files through an uploaded file_id or base64 file_data with a filename. Supported formats include TXT, Markdown, JSON, HTML, XML, YAML, JavaScript, TypeScript, Python, Java, C/C++, Go, Rust, Ruby, PHP, shell scripts, SQL and CSS. The filename and decoded text become model input and count toward usage. Inline files remain transient unless you explicitly request storage. Saved Chat history preserves original file references, and Batch snapshots preserve their JSONL input; keep separately referenced files until replay or execution finishes.
import OpenAI from "openai";
import { createReadStream } from "node:fs";
const client = new OpenAI({
baseURL: "https://somny.xyz/v1",
apiKey: process.env.SOMNY_API_KEY,
});
const file = await client.files.create({
file: createReadStream("document.pdf"),
purpose: "user_data",
expires_after: { anchor: "created_at", seconds: 3600 },
});
try {
const reply = await client.responses.create({
model: "PDF_MODEL_ID",
input: [{ role: "user", content: [
{ type: "input_file", file_id: file.id },
{ type: "input_text", text: "Summarize this document." },
] }],
max_output_tokens: 512,
store: false,
});
console.log(reply.output_text);
} finally {
await client.files.delete(file.id);
}File inputs must fit the current 16 MiB inference limit after encoding. Your account has 1 GiB of storage and can hold up to 1,000 stored resources, including files, upload sessions and parts; encryption and metadata count toward capacity. Model access and image or document support depend on the selected route. Pending media usage does not reduce your available allowance; the final charge follows the same daily usage rules as text requests. OpenAI-format files can be downloaded through GET /v1/files/FILE_ID/content; the Anthropic format permits downloads of generated files only.
Upload a file in parts
Use the OpenAI Uploads API for large files: create an upload, send parts of at most 64 MiB, then complete it with the part IDs in the required order. Completion returns a normal file ID and can verify an optional MD5 checksum. Finish or cancel the upload within one hour. Unfinished parts expire with the upload; completed files follow their own expiry. The protocol accepts declarations up to 8 GiB, while your account’s storage quota still applies.
import OpenAI, { toFile } from "openai";
import { createReadStream } from "node:fs";
import { stat } from "node:fs/promises";
const client = new OpenAI({
baseURL: "https://somny.xyz/v1",
apiKey: process.env.SOMNY_API_KEY,
maxRetries: 0,
});
const path = "document.pdf";
const upload = await client.uploads.create({
bytes: (await stat(path)).size,
filename: "document.pdf",
mime_type: "application/pdf",
purpose: "user_data",
expires_after: { anchor: "created_at", seconds: 3600 },
});
try {
const part_ids = [];
for await (const chunk of createReadStream(path, { highWaterMark: 64 * 1024 * 1024 })) {
const part = await client.uploads.parts.create(upload.id, {
data: await toFile(chunk, "part"),
});
part_ids.push(part.id);
}
const completed = await client.uploads.complete(upload.id, { part_ids });
console.log(completed.file.id);
} catch (error) {
await client.uploads.cancel(upload.id).catch(() => {});
throw error;
}Set an expiry when uploading or delete files when finished. OpenAI accepts expiry from one hour to 30 days, and Anthropic from one hour to 90 days. Other uploads remain until deleted; OpenAI-format batch files expire after 30 days by default. Deleted or expired files immediately become inaccessible, and encrypted backup copies follow a separate 30-day retention schedule. See the privacy policy.
Responses extracts text from DOC, DOCX, PPT, PPTX, RTF and ODT documents, including presentation slide order and speaker notes. Embedded images and charts are omitted; use PDF for visual content. Extracted text is limited to 8 MiB per document and extraction must finish within 30 seconds across a request. Container complexity limits also apply. Encrypted documents and spreadsheets are still unavailable. Legacy Word text boxes and RTF drawing text require conversion to DOCX or PDF.
Responses accepts public HTTPS file_url inputs for PDFs, DOC, DOCX, PPT, PPTX, RTF, ODT and these UTF-8 text/code formats. PDF URLs require a model with qualified PDF input, currently gpt-5.6-luna. URLs must use port 443 without embedded credentials, follow at most three redirects, finish downloading within 30 seconds, and serve uncompressed content when requested. The combined expanded input remains limited to 16 MiB. Saved Responses and Conversation items retain an encrypted copy for replay; ordinary inference stays transient. Batch URL sources must remain available through validation and execution, and can change between those steps. Chat Completions does not accept file URLs.
Limits and features
Supported
- Text input and output
- Text-to-image generation on Gemini 3.1 Flash Image
- Image input on marked models
- PDF input, JSON mode and JSON schema on marked endpoints
- Function tools, executed by your app
- Standard and streaming responses with final usage
- Chat Completions, Responses and Messages formats
- Account-owned file uploads, listing and deletion
- Explicitly saved Responses and continuation by ID
- Background Responses, cancellation and stream resumption
- OpenAI and Anthropic batches on qualified inference endpoints
- Saved Chat Completions and input-message retrieval
- Conversations and individual item management
Unavailable
- Built-in hosted tools
- Embeddings, video generation and fine-tuning
- Audio and realtime endpoints
- Exact token counting
The Models page lists each model’s qualified input types, endpoints, context and maximum requested output. Context includes input and output together; the supplier enforces the model limit. Requests can be up to 16 MiB and run for up to 10 minutes. Use streaming for long requests; non-streaming connections can time out earlier. A large context or output request still needs enough available allowance and can time out before reaching its maximum output.
For transient inference, include the relevant messages, tool results and returned thinking blocks with each continuation. Native Claude Messages preserves signed thinking; native GPT Responses preserves opaque reasoning when the supplier returns it. Feature support depends on the model and endpoint. Explicitly uploaded files and saved Responses can be reused by ID.
Models marked “Automatic tool calls only” accept tool_choice: "auto" or "none" (Messages uses {"type":"auto"} or {"type":"none"}). Forcing a tool returns a 400 error before using allowance. Check forced_tool_choice_protocols in the model’s capabilities when your app requires a particular tool.
Your allowance
Your plan has one daily allowance shared across your apps and models. It resets at midnight UTC; unused tokens expire. All paid plans share model access. The free plan has a smaller model selection.
The Models page and the Models screen in your dashboard list each model’s multipliers. Usage separates actual tokens from the weighted tokens deducted from your allowance:
Fresh input × input multiplier
+ cached input × cache-read multiplier
+ cache writes × cache-write multiplier
+ output × output multiplier
Long-context rate: GPT requests with more than 272,000 input tokens and Grok requests with more than 200,000 input tokens use 2× the usual weighted tokens for the entire request. The threshold counts fresh input, cache reads, and cache writes together. All input, cached tokens, and output are doubled; requests exactly at the threshold keep the usual rates.
Cache use comes from reported request usage, not an assumed cache percentage. Reasoning tokens are included in output and are not added a second time. Models with one flat multiplier use it for every category.
Gemini 3.8 Flash caching: reuse is automatic and best effort. Keep a large, unchanged prefix at the start of the conversation; even eligible repeats can miss. The route has observed hits around 5,000 input tokens and above, but publishes no guaranteed minimum, lifetime or eviction policy. cache_control and prompt_cache_key have no effect on this route. Only reported cache reads receive the cache-read rate.
Reported input can include model instructions as well as your messages. Some models can exceed the requested output length. Your final allowance charge cannot exceed the internal limit recorded when that request was admitted. Accounts support up to 50 simultaneous requests; waiting for a usage confirmation does not occupy a slot after generation ends.
The dashboard’s available balance is your daily allowance minus Used today. Requests awaiting usage confirmation do not reduce that balance or block new requests. Confirmed usage is deducted when it arrives. Any amount that exceeds the remaining daily allowance carries into the next day, and subsequent days if necessary. Daily allowances reset at midnight UTC; carried usage is deducted before new usage.
For new requests, missing usage may be charged using a labeled estimate: ambiguous supplier cache counters use the larger input interpretation, otherwise input bytes and observed output bytes use the route’s saved bytes-per-token ratio. Each category rounds up to the next 100 tokens, with the charge capped at the original reservation. Byte estimates require observed output and exclude image requests. Confirmed errors remain uncharged. Requests without sufficient evidence stay internal until usage can be confirmed or estimated; they do not reserve your daily allowance. Lower later measurements credit the affected daily deductions and cancel any unapplied amount, without a second debit. Previously released or refunded requests remain uncharged. Carried usage uses future token allowances; it never creates a cash overage charge or token purchase.
Somny keeps usage metadata, including request IDs, token counts, and timing. Prompts, responses and function-tool payloads stay transient unless you explicitly request a storage feature.
Errors and support
401Key not accepted- Check that you copied the full Somny key and that it has not been revoked.
400Request not supported- Check the error message for unsupported fields, model limits, or an invalid request format.
429Allowance or rate limit- Check your remaining allowance and pending requests. Follow a
Retry-Afterheader when one is provided. 503Temporarily unavailable- Check Status in your dashboard. Capacity may be full or the selected model may be paused.
If a connection drops or times out, check Usage before sending the request again. Work may have started even if you did not receive a complete answer. Keep the x-request-id response header when reporting a problem; it matches the request in your usage records.
For integrations, an optional Idempotency-Key prevents another dispatch with the same account-scoped key. A repeat returns 409. If you explicitly saved a Response and have its ID, retrieve it through the Responses API.
Need help?
Join Somny’s Discord for support. Include your request ID when reporting an API problem, and keep API keys and payment details out of public channels.