# Create chat-based completion
Source: https://docs.infercom.ai/api-reference/operations/createchatcompletion
POST https://api.infercom.ai/v1/chat/completions
Create a chat completion from a list of messages using Infercom's OpenAI-compatible API. Supports streaming, function calling, vision, and JSON output.
# Create a model response
Source: https://docs.infercom.ai/api-reference/operations/createresponse
POST https://api.infercom.ai/v1/responses
Creates a model response for the given input. Designed for agentic workflows with structured output items (messages, reasoning, function calls). Only `type: "function"` tools are supported. Stateless API - supply full conversation history via `input[]` on each request.
# Create a message
Source: https://docs.infercom.ai/api-reference/operations/createmessage
POST https://api.infercom.ai/v1/messages
Send a structured list of input messages and the model will generate the next message in the conversation. This endpoint is compatible with Anthropic's Messages API format, allowing you to use the Anthropic SDK with Infercom models.
# Get environment's available model list metadata
Source: https://docs.infercom.ai/api-reference/operations/getmodellist
GET https://api.infercom.ai/v1/models
List the models available in your Infercom environment, including context length, capabilities, and EU data residency, via the OpenAI-compatible endpoint.
# Get environment's available model metadata
Source: https://docs.infercom.ai/api-reference/operations/getmodel
GET https://api.infercom.ai/v1/models/{model_id}
Retrieve metadata for a single model by ID, including context length, max completion tokens, capabilities, and EU sovereignty region.
# Create embeddings
Source: https://docs.infercom.ai/api-reference/operations/createembedding
POST https://api.infercom.ai/v1/embeddings
Generate vector embeddings for input text. **Note:** This endpoint requires an embedding model to be available. Check `GET /v1/models` for current model availability.
# Transcribes audio into the input language.
Source: https://docs.infercom.ai/api-reference/operations/createtranscription
POST https://api.infercom.ai/v1/audio/transcriptions
Transcribe audio to text in the original language. **Note:** This endpoint requires an audio model (e.g., Whisper) to be available. Check `GET /v1/models` for current model availability.
# Translate audio into English.
Source: https://docs.infercom.ai/api-reference/operations/createtranslation
POST https://api.infercom.ai/v1/audio/translations
Translate audio to English text. **Note:** This endpoint requires an audio model (e.g., Whisper) to be available. Check `GET /v1/models` for current model availability.
# Infercom API Reference - Overview
Source: https://docs.infercom.ai/en/api-reference/overview
The Infercom [Developer guide](/en/get-started/overview) and API reference provide the tools you need to build applications using Infercom as an inference service.
## API endpoints
### Text generation
| Endpoint | Description | Best for |
|----------|-------------|----------|
| `/v1/chat/completions` | OpenAI-compatible chat API | Conversational applications, OpenAI SDK users |
| `/v1/messages` | Anthropic-compatible Messages API | Claude Code, LangChain Anthropic, Anthropic SDK users |
| `/v1/responses` | Structured output API for agentic workflows | Coding agents, tool calling, multi-step reasoning |
See [OpenAI compatibility](/en/features/openai-compatibility) for the Chat Completions API, [Anthropic compatibility](/en/features/anthropic-compatibility) for the Messages API, or [Responses API](/en/features/responses-api) for agentic workflows.
### Embeddings
| Endpoint | Description | Best for |
|----------|-------------|----------|
| `/v1/embeddings` | Generate vector embeddings | RAG, semantic search, classification |
See [Embeddings](/en/features/embeddings) for usage examples.
### Audio
| Endpoint | Description | Best for |
|----------|-------------|----------|
| `/v1/audio/transcriptions` | Transcribe audio to text | Speech-to-text, meeting transcription |
| `/v1/audio/translations` | Translate audio to English | Multilingual audio processing |
See [Audio](/en/features/audio) for usage examples.
## Infercom Inference Service
Code examples in this API reference include the specific URLs for developing on Infercom Inference Service.
## Model sovereignty metadata
The `/v1/models` endpoint supports a `?verbose=true` query parameter that returns detailed metadata for each model, including sovereignty information. Use the `sn_metadata.region` field to determine where a model is hosted:
- **`"EU"`** — the model runs on Infercom's EU infrastructure in Germany with full data sovereignty
- **Empty or absent** — the model is available via SambaNova's global infrastructure
See [Supported models](/en/models/infercomcloud-models#identifying-model-regions) for details and code examples.
# API Error Codes
Source: https://docs.infercom.ai/en/api-reference/using-the-api/api-error-codes
The Infercom API uses standard HTTP response status codes to indicate whether an API request was successful or failed.
When a request fails, the API responds with a JSON object containing details about the error.
## The error envelope
Every error response uses the same shape. The error detail is nested inside an `error` object, and the response carries a `request_id` alongside it.
```json title="Example error response"
{
"error": {
"message": "Invalid value for 'temperature': 99 is greater than the maximum of 2.",
"type": "invalid_request_error",
"param": "temperature",
"code": "invalid_value"
},
"request_id": "dagkf1tcohtmhkppeq70"
}
```
| Field | Description |
| :---- | :---------- |
| `error.message` | A human-readable explanation of the problem. |
| `error.type` | The error class, for example `invalid_request_error` or `authentication_error`. |
| `error.param` | The request property that caused the error. `null` when no single property is at fault. |
| `error.code` | A stable machine-readable code. See [Error code reference](#error-code-reference). |
| `request_id` | A unique identifier for the request. |
## Error categories
Use the following table to understand the various error categories.
| HTTP status | Category | Description | Suggestion |
| :---------- | :------------------- | :----------------------------------------------------------------------------- | :----------------------------------------------- |
| 400 | Bad request | The server couldn't process the request due to invalid syntax or input values. | Review the API request syntax and parameters. |
| 401 | Unauthorized | Authentication credentials are missing or invalid. | Ensure valid API key/token is included. |
| 408 | Request timeout | The server terminated the request due to excessive processing time. | Retry the request with optimized payload. |
| 404 | Not found | The model does not exist, or it has been retired. | Use a currently supported model. |
| 422 | Unprocessable entity | The request is well formed, but the model is not enabled on your plan. | Use a model listed for your subscription. |
| 429 | Too many requests | Rate limit exceeded for your subscription tier. | Implement rate limiting or upgrade tier. |
| 429 | Queue Full | Too many requests are currently in flight; the server declined the request. | Retry after a short delay or reduce concurrency. |
| 500 | Something went wrong | A server-side error occurred. | Retry later or contact support if persistent. |
| 503 | Maintenance | The model is temporarily unavailable due to maintenance. | Try again after some time. |
## Error code reference
Use the following table to understand and troubleshoot errors programmatically.
| HTTP status | Error code | Description | Suggestion |
| :---------- | :------------------------ | :------------------------------------------------------------------ | :------------------------------------------------------------------------------------------------------------------------------- |
| 400 | `context_length_exceeded` | Input/output tokens exceed model context limits. | Reduce prompt and response length to stay within model limits. |
| | `invalid_type` | Parameter type mismatch (e.g., expected int but got float). | Check the expected parameter types and correct the input. |
| | `decimal_above_max_value` | Decimal value exceeds the allowed maximum. | Adjust the value to fall within the allowed range. |
| | `decimal_below_min_value` | Decimal value is below the allowed minimum. | Increase the value to meet the minimum required threshold. |
| | `integer_above_max_value` | Integer value exceeds the allowed maximum. | Provide a smaller integer within the valid range. |
| | `invalid_value` | Parameter value is outside the allowed range. | Check the accepted range for that parameter and resend. |
| | `unknown_parameter` | The endpoint does not accept that parameter. | Remove the parameter. Check the endpoint's reference page for the parameters it accepts. |
| | `model_not_supported` | The model exists but does not serve this endpoint. | Use a model listed for that endpoint. Check [Supported models](/en/models/infercomcloud-models). |
| | `unsupported_model` | The model is not served by `/v1/responses`. | Use `/v1/chat/completions`, or pick a model the Responses API serves. |
| 401 | `invalid_authentication` | Invalid or expired API key. | Generate and use a valid API key from the Infercom Inference Service portal. |
| | `invalid_api_key` | The API key is incorrect or has been revoked. | Create a new key at [cloud.infercom.ai](https://cloud.infercom.ai) and update your client. |
| 408 | `request_timeout` | Request timed out due to server load or latency. | Retry with a smaller or optimized request payload. Additionally, consider upgrading to a higher subscription tier to avoid this. |
| 404 | `model_not_found` | The model ID does not exist, or the model has been retired. A retired model returns this code on `/v1/chat/completions` and `/v1/responses`. `/v1/messages` returns the same status with no `code` field. | Verify the model ID. For a retired model, see [Deprecations](/en/models/deprecations) for the replacement. Do not retry. |
| 422 | `model_not_in_plan` | The model exists but is not enabled on your plan. Returned by `/v1/chat/completions` and `/v1/messages`. The other endpoints return `400` for the same condition. | Use a model listed for your subscription, or contact support to add the model. |
| 429 | `insufficient_quota` | Rate limit exceeded. | Upgrade your plan for higher quota. |
| 429 | `queue_full` | Too many in-flight requests; server declined the request. | Retry after a delay or reduce request frequency. |
| 500 | `internal_server_error` | An unexpected server-side error occurred. | Retry later. If the issue persists, contact support. |
| 503 | `maintenance` | Model is temporarily unavailable due to maintenance. | Try again after some time or check maintenance announcements. |
## Responses that do not use the envelope
Two paths do not use this envelope. The body is still JSON, but `error` is a string instead of an object. Both omit `request_id`.
Handle both shapes before you read `error.message`.
### Malformed image data
Returned by [vision](/en/features/vision) requests when the API cannot decode the image. HTTP 400.
```json
{
"error": "Unable to decode image: cannot identify image file <_io.BytesIO object at 0x...>",
"error_code": null,
"error_param": null,
"error_type": "invalid_request_error"
}
```
### A forced `tool_choice` that the model does not satisfy
Returned by [function calling](/en/features/function-calling) requests when you force a specific function and the model produces no valid call. HTTP 400.
```json
{
"error": "Specified tool_choice with function name \"book_flight\", but the model output contains zero valid function call.",
"error_code": null,
"error_model_output": "I can help you book a flight from Munich to Lisbon...",
"error_type": "Invalid function calling output."
}
```
This body adds a field the envelope does not define, `error_model_output`. It carries the text the model produced instead of the tool call. Note also that `error_type` holds a sentence here, not a code such as `invalid_request_error`.
### Defensive parsing
```python
def read_error(response) -> tuple[str, str | None]:
"""Return (message, request_id) for every response shape."""
try:
body = response.json()
except ValueError:
# Not JSON, for example an error page from a proxy
# between your client and the API.
return response.text.strip(), None
err = body.get("error")
if isinstance(err, str):
return err, None
return err.get("message", "unknown error"), body.get("request_id")
```
# Infercom AI Starter Kits
Source: https://docs.infercom.ai/en/build/ai-starter-kits
AI Starter Kits are a collection of examples designed to bootstrap application development for common AI use cases. They provide open-source Python code hosted on [Infercom's GitHub](https://github.com/infercomai/ai-starter-kit/blob/main/README.md) with concepts that can be applied to any programming language. Start with the demos below and be sure to view all of our AI Starter Kits at our [Github repository](https://github.com/infercomai/ai-starter-kit).
## Multimodal retriever
Unlock insights from complex PDFs and images. Demonstrates advanced retrieval and answer generation that combines both visual and textual data.
## Financial assistant
Use large language models (LLMs) to generate complex responses. Demonstrates how to employ multiple agents in a chain to:
- Focus and decompose queries.
- Generate multi-step answers and summarize them.
- Check accuracy.
## Function calling
Enhance your AI applications with powerful function calling capabilities.
## Enterprise knowledge retrieval
Document Q&A on multiple file formats including PDF, TXT, and DOC. This starter kit demonstrates a sample implementation of a retrieval augmented generation (RAG) semantic search workflow.
## Search assistant
Expand your application's knowledge with this implementation of the semantic search workflow and prompt construction strategies. Includes configurable integrations with multiple SERP APIs.
# Developer community
Source: https://docs.infercom.ai/en/build/developer-community
## Community Resources for Infercom Developers
Infercom uses the same technology platform as SambaNova Cloud. This gives you access to an **extended developer ecosystem** with multiple community options:
### SambaNova Developer Community
The SambaNova Developer Community is the **primary technical community** for all questions about the API, code examples, model behavior, and best practices.
**What you'll find there:**
- Active community of AI developers
- Code examples and tutorials
- API documentation and help
- Discussions on model behavior and optimization
- Fast answers through large community
### Infercom-Specific Differences
Please note the following differences between Infercom and SambaNova Cloud:
**Model Availability:**
- Infercom hosts a **curated selection of EU-hosted models** on sovereign infrastructure in Germany
- Additional models are available through the [Global Model Catalog](/en/models/infercomcloud-models#global-model-catalog), transparently routed via SambaNova's global infrastructure
- Current model list: [Infercom Models](/en/models/infercomcloud-models)
**EU-Specific Features:**
- Data sovereignty and GDPR compliance for [EU-hosted models](/en/models/infercomcloud-models)
- Hosting in European data centers (Equinix Munich 4, Germany)
- EUR pricing
- Transparent region labeling for all models
### Infercom Support
For **Infercom-specific questions**, please contact our support team directly:
**Infercom Support for:**
- EU data sovereignty and compliance questions
- Infercom-specific configuration
- Billing and contracts (EUR)
- Model availability on Infercom
- GDPR and AI Act compliance
- [Dedicated capacity](/en/dedicated/overview)
### When to Use Which Resource?
| Topic | Resource |
|-------|-----------|
| API usage, code examples | SambaNova Community |
| Model behavior, performance | SambaNova Community |
| OpenAI compatibility | SambaNova Community |
| Function calling, streaming | SambaNova Community |
| **EU data sovereignty** | **Infercom Support** |
| **Infercom model availability** | **Infercom Support** |
| **Billing (EUR)** | **Infercom Support** |
| **GDPR/AI Act compliance** | **Infercom Support** |
## Additional Resources
# Hugging Face Spaces
Source: https://docs.infercom.ai/en/build/hf-spaces
Hugging Face Spaces offer an interactive, web platform to showcase machine learning models, datasets, and demos. Explore the apps in our [space](https://huggingface.co/infercomai).
# Build RAG Workflows with Infercom
Source: https://docs.infercom.ai/en/build/rag
Retrieval-augmented generation, or RAG, is a technique that enhances an LLM's responses by incorporating external information.
RAG leverages a database to fetch the most contextually relevant results based on semantic search at generation time. This technique is particularly useful for prompting off-the-shelf LLMs that were fine-tuned for general chat, enabling them to handle queries beyond their original training data. It also allows LLMs to access updated information without retraining and reduce hallucinations.
## Workflow steps
A typical RAG workflow consists of two main phases: ingestion and online processing. Ingestion, or preprocessing, (steps 1-4) involves preparing the data for the RAG system and usually occurs offline. Online processing (steps 5-7) handles the real-time aspects of the RAG system, focusing on data retrieval and response generation.
1. **Document parsing**
Data is loaded and formatted into digital text using document loaders tailored to specific file types, such as CSV, Markdown, and PDF. This step includes extracting content and associated metadata like source and page numbers. Depending on the quality and format of the files, data cleaning and customization may be necessary to meet different use case requirements.
2. **Splitting**
Documents are divided into smaller chunks to accommodate the model's context window limitations. There are various strategies for data chunking, with chunk size, overlap size, and sliding window being key hyperparameters that can be tuned.
3. **Vector embeddings**
Each text chunk is converted into a vector representation using an embedding model. These embeddings facilitate content retrieval based on semantic similarity.
4. **Vector store**
The embeddings with their corresponding content and metadata are stored in a vector database, using the embedding as the index. Several vector database options are available, including FAISS, ChromaDB, Qdrant, and Milvus for example.
5. **Retrieval**
The query is also embedded, and a retriever function is used to identify the closest chunk vectors in the vector database to the query vector, based on a specific similarity metric. This step leverages the embeddings stored during the ingestion workflow.
6. **Reranking**
This is an optional step in the online processing phase. A reranker model can also be used to sort the retrieved chunks in order of relevance and remove the unnecessary chunks.
7. **Q&A generation**
The LLM gets the user query and the final retrieved chunks to generate a grounded response.
Try implementing a RAG application end-to-end using LangChain and Infercom by checking out the [enterprise knowledge retriever (EKR)](https://github.com/infercomai/ai-starter-kit/tree/main/enterprise_knowledge_retriever "https://github.com/infercomai/ai-starter-kit/tree/main/enterprise_knowledge_retriever") kit.
# Implement Reasoning Models with Infercom
Source: https://docs.infercom.ai/en/build/reasoning
Reasoning models systematically process information to derive logical conclusions and solve complex problems step by step. Before producing a final answer, they generate an internal chain of thought - reasoning through the problem, exploring alternatives, and self-correcting. This makes them well suited for math, coding, multi-step planning, and analysis of ambiguous or complex inputs.
## Reasoning models on Infercom
The following models support reasoning. Always check [Supported models](/en/models/infercomcloud-models) for current availability and regions.
| **Model ID** | **Region** | **How reasoning is controlled** | **Default** |
| :---------------------------- | :--------- | :----------------------------------------------------- | :--------------------- |
| `gpt-oss-120b` | EU | `reasoning_effort` (`low`, `medium`, `high`) | `medium` |
| `gemma-4-31B-it` | EU | `chat_template_kwargs: {"enable_thinking": true}` | **Off** |
| `MiniMax-M3.1-Flash` | Non-EU | `reasoning_effort` (`low`, `medium`, `high`, `xhigh`, `max`) | `max` |
The two controls are not interchangeable:
- `reasoning_effort` adjusts **how much** `gpt-oss-120b` and `MiniMax-M3.1-Flash` reason. It cannot switch reasoning off.
- `enable_thinking` turns reasoning **on or off** for `gemma-4-31B-it`, which does not reason unless you ask it to.
Setting either parameter on a model that does not implement it is accepted and silently ignored - you get no error and no change in behavior. Exception: `MiniMax-M3.1-Flash` always reasons, and `enable_thinking: false` returns a `400`.
## How reasoning appears in the response
Reasoning-capable models return their chain of thought in a dedicated `reasoning` field on the message, separate from the final answer in `content`:
```json
{
"choices": [
{
"message": {
"role": "assistant",
"reasoning": "The user wants 17 * 23. 17 * 20 = 340, 17 * 3 = 51, 340 + 51 = 391.",
"content": "17 * 23 = 391"
},
"finish_reason": "stop"
}
]
}
```
Use `reasoning` for transparency or debugging, and `content` for the answer you show to users.
## Counting reasoning tokens
Every response reports the reasoning it produced in `usage.completion_tokens_details.reasoning_tokens`. Use this field to budget and to bill. It is populated on all EU models and on `MiniMax-M3.1-Flash`, including requests that carry an image.
```json
{
"usage": {
"prompt_tokens": 21,
"completion_tokens": 872,
"completion_tokens_details": {
"reasoning_tokens": 595
},
"total_tokens": 893
}
}
```
For the prompt "What is 15 * 37? Explain.":
| Model | Request | `reasoning_tokens` |
| :---- | :------ | :----------------- |
| `gpt-oss-120b` | Default | 39 |
| `gemma-4-31B-it` | `chat_template_kwargs: {"enable_thinking": true}` | 595 |
| `gemma-4-31B-it` | Default, thinking off | 0 |
`reasoning_tokens` counts towards `completion_tokens`, and therefore towards `max_tokens`. Subtract it from `completion_tokens` to see how many tokens went into the visible answer.
## Budgeting tokens for reasoning
This is the single most common source of "empty" or "broken" responses from reasoning models. Because the chain of thought is generated first and counts against your token limit, a low `max_tokens` value is consumed by reasoning before any answer is produced.
As a rule of thumb, allow several hundred to a few thousand tokens of headroom beyond the length of the answer you expect, depending on task complexity. For hard math, coding, or planning tasks, reasoning can be long - budget accordingly.
## Controlling reasoning
### Models with `reasoning_effort`
`gpt-oss-120b` accepts a `reasoning_effort` parameter (`low`, `medium`, `high`) that trades latency and token usage for answer quality. If you omit it, the model uses `medium`.
```python
from openai import OpenAI
client = OpenAI(
base_url="https://api.infercom.ai/v1",
api_key="your-infercom-api-key",
)
response = client.chat.completions.create(
model="gpt-oss-120b",
messages=[{"role": "user", "content": "A bat and ball cost $1.10 total. The bat costs $1 more than the ball. How much is the ball?"}],
reasoning_effort="high",
max_tokens=2000,
)
print("Reasoning:", response.choices[0].message.reasoning)
print("Answer:", response.choices[0].message.content)
```
```bash
curl -s "https://api.infercom.ai/v1/chat/completions" \
-H "Authorization: Bearer $INFERCOM_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-oss-120b",
"messages": [{"role": "user", "content": "A bat and ball cost $1.10 total. The bat costs $1 more than the ball. How much is the ball?"}],
"reasoning_effort": "high",
"max_tokens": 2000
}'
```
### `reasoning_effort` on `MiniMax-M3.1-Flash`
`MiniMax-M3.1-Flash` accepts `reasoning_effort` with the values `low`, `medium`, `high`, `xhigh` and `max`. **If you omit it, the model uses `max`.** Lower values usually shorten the reasoning, most on simple questions. For "Explain in three sentences why the sky is blue.", `max` uses 185 reasoning tokens and `low` uses 15. The values are not strictly ordered: on some requests a lower value reasons longer than a higher one.
Set `reasoning_effort` explicitly when you need short answers or JSON output. If you omit it, budget `max_tokens` generously. `xhigh` and `max` are valid on `MiniMax-M3.1-Flash` only: `gpt-oss-120b` and `gemma-4-31B-it` reject them with a `400`.
### Models with configurable thinking (`enable_thinking`)
`gemma-4-31B-it` has a configurable thinking mode that you turn on or off via `chat_template_kwargs`. Set `enable_thinking` to `true` to have the model reason before answering, or `false` for a direct answer.
**Thinking is off by default.** If you omit `enable_thinking`, the model answers directly and the `reasoning` field comes back empty - omitting it behaves exactly like setting it to `false`. You must pass `true` to get a chain of thought.
```python
from openai import OpenAI
client = OpenAI(
base_url="https://api.infercom.ai/v1",
api_key="your-infercom-api-key",
)
response = client.chat.completions.create(
model="gemma-4-31B-it",
messages=[{"role": "user", "content": "A bat and ball cost $1.10 total. The bat costs $1 more than the ball. How much is the ball?"}],
extra_body={"chat_template_kwargs": {"enable_thinking": True}},
max_tokens=2000,
)
print("Reasoning:", response.choices[0].message.reasoning)
print("Answer:", response.choices[0].message.content)
```
```bash
curl -s "https://api.infercom.ai/v1/chat/completions" \
-H "Authorization: Bearer $INFERCOM_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gemma-4-31B-it",
"messages": [{"role": "user", "content": "A bat and ball cost $1.10 total. The bat costs $1 more than the ball. How much is the ball?"}],
"chat_template_kwargs": {"enable_thinking": true},
"max_tokens": 2000
}'
```
## Troubleshooting: empty or truncated responses
If a reasoning model returns an empty `content`, a response that cuts off mid-sentence, or what looks like raw thinking in the output, the usual cause is an insufficient token budget - not a model defect. A second, less obvious cause is a temperature set well below the publisher's recommended value, which can send the model into a repetition loop.
1. **Check finish_reason**
Look at `choices[0].finish_reason` in the response. A value of `"length"` means the model hit your `max_tokens` limit before it finished. `"stop"` means it completed normally.
2. **Raise max_tokens**
If `finish_reason` is `"length"`, increase `max_tokens` (or `max_completion_tokens`) and retry. Give the model enough room for both its reasoning and the final answer.
3. **Check your temperature if raising max_tokens does not help**
Compare `usage.completion_tokens_details.reasoning_tokens` with your `max_tokens`. If the reasoning consumes the entire budget again at a higher limit, you are likely in a repetition loop. Set `temperature` to the value the publisher recommends for that model. Check that your request sends `temperature` at all - an absent parameter means greedy decoding, not a mid-range default.
4. **Verify the reasoning and content fields**
Confirm that `reasoning` contains the chain of thought and `content` contains the final answer. With an adequate budget and a sensible temperature, the two are cleanly separated.
**Common failure signatures:**
| Symptom | What you see | Fix |
| :------ | :----------- | :-- |
| Empty answer | `content` is `null` or empty, `finish_reason` is `"length"` | Raise `max_tokens` |
| Truncated answer | `content` cuts off mid-sentence, `finish_reason` is `"length"` | Raise `max_tokens` |
| Reasoning leaks into `content` | Chain of thought appears in `content` because the model was cut off before it emitted the end-of-thinking marker. When this happens the `reasoning` field is empty even though `usage.completion_tokens_details.reasoning_tokens` is non-zero | Raise `max_tokens` |
| Reasoning never terminates | `finish_reason` is `"length"` and `reasoning_tokens` consumes the whole budget at every limit you try, with the chain of thought restating the same point | Raise the temperature towards the publisher's recommended value |
## Prompting reasoning models
- Keep system prompts minimal. Excessive instructions can constrain the model's reasoning scope and reduce quality.
- Avoid adding your own "think step by step" chain-of-thought prompting - the model already reasons internally. Use clear, zero-shot or single-instruction prompts.
- **Always send `temperature` explicitly.** The Infercom API has no default. Omit the parameter and most models decode greedily, which is the setting most likely to trigger the repetition loop above. It also forces `top_k` to 1, so any `top_k` you send is ignored.
- **Use the sampling parameters the model publisher recommends.** They differ per model and are listed under [Recommended sampling parameters](/en/models/infercomcloud-models#recommended-sampling-parameters). For `gpt-oss-120b` the publisher recommends `temperature` 1.0 and `top_p` 1.0.
- `temperature=1.0` does not mean "maximum randomness". It means the model's probability distribution is used exactly as trained. Values below 1.0 sharpen it, values above 1.0 flatten it. The Infercom API accepts values from 0 to 2.
## Use cases
### Report generation
Reasoning models are well suited to processing unstructured information - legal contracts, financial statements, or scientific papers - recognizing patterns across multiple facets of the input before distilling it into a comprehensive summary.
### Planning for workflows and agents
Reasoning models excel at ambiguous, complex tasks. They can break down intricate problems, strategize solutions, and make decisions over large volumes of uncertain information - making them effective planners and orchestrators in agentic systems.
### Coding and mathematics
These models are effective at reviewing and improving code, catching subtle issues a quick read might miss, and breaking down math problems into verifiable steps.
## Best practices
Budget tokens for reasoning
Reasoning counts toward `max_tokens`. Set the limit high enough for both the chain of thought and the final answer. If responses come back empty or truncated, check `finish_reason` - a value of `"length"` means you need to raise `max_tokens`.
Latency and cost
Reasoning outputs have higher latency and token usage because of the chain-of-thought process. For simpler tasks, consider a non-reasoning model (or disable thinking where the model supports it) to optimize for budget and response time.
Streaming
Enabling streaming improves perceived responsiveness, since reasoning models take longer to produce a complete answer. Add `stream=True` to your request to display tokens as they become available.
## FAQs
Why do I get an empty or truncated response with finish_reason: length?
There are two common causes. First, reasoning tokens count against `max_tokens`, so the budget can be consumed before any visible answer is produced - raise `max_tokens`. Second, at a low temperature the model can enter a repetition loop that never terminates - raising `max_tokens` will not help, and you should move the temperature towards the value the publisher recommends for that model.
To tell them apart, check `usage.completion_tokens_details.reasoning_tokens`. If it exactly equals your `max_tokens` no matter how high you set the limit, suspect a loop.
Which temperature and top_p should I use?
Use the values the model publisher recommends - they differ per model and are listed under [Recommended sampling parameters](/en/models/infercomcloud-models#recommended-sampling-parameters). There is no single value that suits every model. The Infercom API accepts a temperature from 0 to 2, and `temperature=1.0` means the model's distribution is used exactly as trained rather than "maximum randomness".
What is the difference between reasoning_effort and enable_thinking?
They are two different controls, and neither works on the other's models. `gpt-oss-120b` uses `reasoning_effort` (`low`/`medium`/`high`) to dial how much it reasons; it defaults to `medium` and cannot be turned off. `MiniMax-M3.1-Flash` uses `reasoning_effort` (`low` to `max`); it defaults to `max`. `gemma-4-31B-it` uses `chat_template_kwargs: {"enable_thinking": true/false}` to turn reasoning on or off; it is off by default. Setting either parameter on a model that does not implement it is accepted and silently ignored, so check the table above before relying on one.
How do I turn reasoning off completely?
Only `gemma-4-31B-it` can answer without reasoning - and it already does so by default, since `enable_thinking` is off unless you set it. Reasoning cannot be disabled on `gpt-oss-120b` or `MiniMax-M3.1-Flash`; `reasoning_effort: "none"` is not a valid value and returns a `400`. The lowest setting is `reasoning_effort: "low"` on `gpt-oss-120b` and `MiniMax-M3.1-Flash`, which still produces a short chain of thought. On `MiniMax-M3.1-Flash`, `enable_thinking: false` returns a `400`.
I got a 400 error about maximum context length. Where can I check the limit?
See the [Supported models](/en/models/infercomcloud-models) page for each model's context length.
Where are these models hosted?
Models marked EU run in Infercom's EU data centers in Germany with full data sovereignty. Check the [Supported models](/en/models/infercomcloud-models) page to verify each model's region.
# SambaNova SDK for Python and JavaScript
Source: https://docs.infercom.ai/en/build/sn-sdk
SambaNova offers SDKs for both Python and JavaScript/TypeScript, making it easy to interact with the Infercom REST API. The [SambaNova Python client](https://pypi.org/project/sambanova/) works with Python 3.8 and above, while the [JavaScript/TypeScript version](https://www.npmjs.com/package/sambanova) is designed for server-side environments. Both libraries come with built-in type definitions for request parameters and response fields, and support both synchronous and asynchronous usage.
## Usage example
To get started, select your preferred programming language. Then, open a terminal window and install the SambaNova SDK.
```javascript
//ensure you have Node.js installed.
npm install sambanova
```
```python
# make sure you have Python3 and pip installed
pip install sambanova
```
Next, copy the following code into a new file.
```javascript
import SambaNova from "sambanova";
const client = new SambaNova({
baseURL: "https://api.infercom.ai/v1",
apiKey: "your-infercom-api-key",
});
const chatCompletion = await client.chat.completions.create({
messages: [
{ role: "system", content: "Answer the question in a couple sentences." },
{ role: "user", content: "Share a happy story with me" },
],
model: "gpt-oss-120b",
});
console.log(chatCompletion.choices[0].message.content);
```
```python
from sambanova import SambaNova
client = SambaNova(
base_url="https://api.infercom.ai/v1",
api_key="your-infercom-api-key"
)
completion = client.chat.completions.create(
model="gpt-oss-120b",
messages = [
{"role": "system", "content": "Answer the question in a couple sentences."},
{"role": "user", "content": "Share a happy story with me"}
]
)
print(completion.choices[0].message.content)
```
Once copied into the file, replace the placeholder `"your-infercom-api-key"` with your API key. Then run the file with the command below in a terminal window.
```javascript
node hello-world.js
```
```python
python hello_world.py
```
After you run the program, you should now see an output like similar to the one below.
```json
{
"id": "d89243f2-de68-416f-85c6-27c244cf9c7f",
"choices": [
{
"finish_reason": "stop",
"index": 0,
"message": {
"content": "One day, a little girl named Sophie found a lost puppy in her neighborhood and decided to take care of it until she could find its owner. As she cared for the puppy, named Max, they formed an unbreakable bond, and when the owner was finally found, they were so grateful to Sophie that they asked her to be Max's permanent dog-sitter, bringing joy and companionship to Sophie's life.",
"role": "assistant"
},
"logprobs": null
}
],
"created": 1759518870.892972,
"model": "gpt-oss-120b",
"object": "chat.completion",
"system_fingerprint": "fastcoe",
"usage": {
"completion_tokens": 84,
"prompt_tokens": 49,
"total_tokens": 133,
...
"stop_reason": "stop"
}
}
```
# Connect to your dedicated endpoint
Source: https://docs.infercom.ai/en/dedicated/connect
## Base URL and API keys
Your deployment has its own base URL and its own API keys. We give you both at onboarding.
The examples on this page use the placeholder `https:///v1`. Replace it with the base URL that we give you.
## Make a request
The API is the same OpenAI-compatible API as on the Inference API. Change the base URL and the API key. The rest of your code stays the same.
```python
from openai import OpenAI
client = OpenAI(
base_url="https:///v1",
api_key="your-dedicated-api-key"
)
completion = client.chat.completions.create(
model="GLM-5.3",
messages = [
{"role": "system", "content": "Answer the question in a couple sentences."},
{"role": "user", "content": "Share a happy story with me"}
]
)
print(completion.choices[0].message.content)
```
```sh
export API_KEY="your-dedicated-api-key"
export URL="https:///v1/chat/completions"
curl -H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"messages": [
{"role": "system", "content": "Answer the question in a couple sentences."},
{"role": "user", "content": "Share a happy story with me"}
],
"model": "GLM-5.3"
}' \
-X POST $URL
```
Use the model IDs of your deployment. See [Supported models](/en/dedicated/models).
## Features
These guides apply unchanged. Use your own base URL and a model of your deployment.
- [Text generation](/en/features/text-generation)
- [Function calling and JSON mode](/en/features/function-calling), including structured output
- [Vision](/en/features/vision)
- [Reasoning](/en/build/reasoning)
- [API reference](/en/api-reference/overview)
A feature works only on a model that supports it. For example, vision needs a model that accepts images.
## Rate limits
The rate limits of your deployment are agreed with you. They are not set by tier. The tier tables on [Rate limits](/en/models/rate-limits) apply to the Inference API only.
# Custom checkpoints on Dedicated Capacity
Source: https://docs.infercom.ai/en/dedicated/custom-checkpoints
You can serve a fine-tune of a supported architecture on dedicated capacity.
## How it works
1. You fine-tune the model on GPUs, with your own tools.
2. You hand us the weights in Hugging Face format.
3. We serve the checkpoint on your deployment.
We do not fine-tune models.
## Requirements for your checkpoint
Your checkpoint must be a fine-tune of a supported model. You can change the weights, but not the architecture.
- **Can change:** the weights. The tokenizer and the vocabulary can also change, as long as the vocabulary size stays exactly the same. This helps for multilingual models.
- **Must stay the same:** the number of attention heads, the RoPE settings, the vocabulary size and the other architecture values in `config.json`.
- **Format:** Hugging Face format, with the weights as safetensors files and the same config and tokenizer files as the base model.
For example, `DeepSeek-R1-Distill-Llama-70B` and `Llama-3.3-Swallow-70B-Instruct-v0.4` are fine-tunes of `Meta-Llama-3.3-70B-Instruct`. They keep its architecture, so they can run on dedicated capacity.
## Which models accept custom checkpoints
The **Custom checkpoints** column on [Supported models](/en/dedicated/models) shows which models accept them.
These models do not accept custom checkpoints:
- Multimodal models, for example Gemma 4 and MiniMax M3.
- Models without a conversion package yet, for example GLM-5.3.
- Models that do not generate text, for example speech and embedding models.
## Call your checkpoint
- Your checkpoint gets its own model ID. You call it through the same API as every other model. See [Connect to your endpoint](/en/dedicated/connect).
- It can run in a bundle next to other models, for example next to its base model. See [Model bundles](/en/dedicated/overview#model-bundles).
- If your checkpoint uses a different chat template or tool-call format than its base model, handle the prompt format and the output parsing in your client.
## Background
SambaNova describes how Hugging Face checkpoints are converted for its chips: [checkpoint conversion tool](https://docs.sambanova.ai/docs/en/v2.2.6/sambastack/service-administration/model-deployment/checkpoint-conversion-tool).
Support for a new architecture is a commercial conversation. [Talk to us](https://infercom.ai/contact/).
# Dedicated Capacity questions
Source: https://docs.infercom.ai/en/dedicated/faq
## What is a rack?
A rack is one SambaRack: 16 purpose-built AI chips (RDUs) in 8 servers. It is one unit of capacity. We size your capacity in racks.
## How large a model fits on one rack?
Every model in the [list of supported models](/en/dedicated/models) runs on one rack. What fits on a rack depends on the model's architecture and precision, not only on its parameter count. For a model that is not on the list, we check the fit with you.
## Do several models on one rack run at the same time?
The models in a bundle stay loaded together. The rack computes one model at a time and switches between them in milliseconds, per request. The models share the throughput of the rack, so we size a bundle for the combined traffic of its models. See [Model bundles](/en/dedicated/overview#model-bundles).
## How many racks do I need?
We size your capacity from your workload. Send us:
- the models
- the tokens per day
- the ratio of input to output tokens
- the typical and the maximum context length
- the peak number of concurrent requests
- your latency or throughput targets
- how the traffic is spread over the day
[Talk to us](https://infercom.ai/contact/) with these values.
## Can we get lower-level access than the model endpoints?
No. Dedicated Capacity gives you model endpoints through the OpenAI-compatible API. You do not get access to the hardware, the operating system or the serving stack. See [Connect to your endpoint](/en/dedicated/connect).
## Who can access the system, and does data leave the EU?
The racks are in our data center in Munich. SambaNova operates the software stack with us, with remote access, as set out in our data processing agreement (DPA). We do not store prompts or outputs persistently. See the [Trust Center](https://infercom.ai/trust/).
## How do we reach the endpoint?
Your endpoint is reached over HTTPS on the internet. Talk to us if you need a private network connection.
## How long do the models stay? Can we keep a model?
You choose the models on your capacity. We agree any model change with you.
## Can we test before we commit?
Yes. We can arrange a time-limited test on the model you need before you sign. If the model is in the [Inference API catalog](/en/models/infercomcloud-models), you can also start there. [Talk to us](https://infercom.ai/contact/).
## Can we serve our own customers on it?
Yes. It is your reserved capacity. You can build your own service on it, including serving your own clients. System integrators and agencies do this.
## How is it billed?
You pay a monthly fee for the reserved capacity, per agreement. Longer terms get better rates. Shorter terms are possible. There is no one-time hardware fee. We set prices per engagement and do not publish them.
## Can you run a model that is not on the list?
An open-weight model with a supported architecture: yes, after a bring-up. Support for a new architecture is a commercial conversation. A proprietary model: no, because we have no access to its weights. See [Custom checkpoints](/en/dedicated/custom-checkpoints).
# Supported models for Dedicated Capacity
Source: https://docs.infercom.ai/en/dedicated/models
These models can run on dedicated capacity in our data center in Munich, and on hardware in your own data center. Availability depends on the platform release. Confirm a model with us before you plan on it.
You choose the models for your capacity. Several models can run together in one bundle, depending on the models. See [Model bundles](/en/dedicated/overview#model-bundles).
## Featured models
- **`GLM-5.3`** (Z.ai): a mixture-of-experts model with about 750B parameters, about 40B active. 1M token context, text.
- **`MiniMax-M3.1-Flash`** (MiniMax): a mixture-of-experts model with 427B parameters, 23B active. 1M token context, text and image input. Built with MiniMax M3.1-Flash.
## All models
| **Model ID** | **Maker** | **Type** | **Max context** | **Status** | **Custom checkpoints** | **View on Hugging Face** |
| :-- | :-- | :-- | :-- | :-- | :-- | :-- |
| `GLM-5.3` | Z.ai | Text | 1M | Preview | No | [Model card](https://huggingface.co/zai-org/GLM-5.3) |
| `MiniMax-M3.1-Flash` | MiniMax | Text + image | 1M | Preview | No | [Model card](https://huggingface.co/MiniMaxAI/MiniMax-M3.1-Flash) |
| `MiniMax-M3` | MiniMax | Text + image + video | 1M | Preview | No | [Model card](https://huggingface.co/MiniMaxAI/MiniMax-M3) |
| `MiniMax-M2.7` | MiniMax | Text | 192k | Stable | Yes | [Model card](https://huggingface.co/MiniMaxAI/MiniMax-M2.7) |
| `MiniMax-M2.5` | MiniMax | Text | 160k | Stable | Yes | [Model card](https://huggingface.co/MiniMaxAI/MiniMax-M2.5) |
| `gpt-oss-120b` | OpenAI | Text | 128k | Stable | Yes | [Model card](https://huggingface.co/openai/gpt-oss-120b) |
| `gpt-oss-20b` | OpenAI | Text | 128k | Preview | Yes | [Model card](https://huggingface.co/openai/gpt-oss-20b) |
| `Whisper-Large-v3` | OpenAI | Speech-to-text | - | Stable | No | [Model card](https://huggingface.co/openai/whisper-large-v3) |
| `gemma-4-31B-it` | Google | Text + image + video | 256k | Stable | No | [Model card](https://huggingface.co/google/gemma-4-31B-it) |
| `gemma-3-27b-it` | Google | Text + image | 128k | Preview | No | [Model card](https://huggingface.co/google/gemma-3-27b-it) |
| `gemma-3-12b-it` | Google | Text + image | 128k | Preview | No | [Model card](https://huggingface.co/google/gemma-3-12b-it) |
| `DeepSeek-V3.2` | DeepSeek | Text | 128k | Stable | Yes | [Model card](https://huggingface.co/deepseek-ai/DeepSeek-V3.2) |
| `DeepSeek-V3.1-Terminus` | DeepSeek | Text | 128k | Stable | Yes | [Model card](https://huggingface.co/deepseek-ai/DeepSeek-V3.1-Terminus) |
| `DeepSeek-V3.1` | DeepSeek | Text | 128k | Stable | Yes | [Model card](https://huggingface.co/deepseek-ai/DeepSeek-V3.1) |
| `DeepSeek-R1-0528` | DeepSeek | Text | 128k | Stable | Yes | [Model card](https://huggingface.co/deepseek-ai/DeepSeek-R1-0528) |
| `DeepSeek-V3-0324` | DeepSeek | Text | 128k | Stable | Yes | [Model card](https://huggingface.co/deepseek-ai/DeepSeek-V3-0324) |
| `DeepSeek-R1-Distill-Llama-70B` | DeepSeek | Text | 128k | Stable | Yes | [Model card](https://huggingface.co/deepseek-ai/DeepSeek-R1-Distill-Llama-70B) |
| `Llama-4-Maverick-17B-128E-Instruct` | Meta | Text + image | 128k | Stable | No | [Model card](https://huggingface.co/meta-llama/Llama-4-Maverick-17B-128E-Instruct) |
| `Meta-Llama-3.3-70B-Instruct` | Meta | Text | 128k | Stable | Yes | [Model card](https://huggingface.co/meta-llama/Llama-3.3-70B-Instruct) |
| `Meta-Llama-3.1-405B-Instruct` | Meta | Text | 16k | Stable | Yes | [Model card](https://huggingface.co/meta-llama/Llama-3.1-405B-Instruct) |
| `Meta-Llama-3.1-70B-Instruct` | Meta | Text | 32k | Stable | Yes | [Model card](https://huggingface.co/meta-llama/Llama-3.1-70B-Instruct) |
| `Meta-Llama-3.1-8B-Instruct` | Meta | Text | 16k | Stable | Yes | [Model card](https://huggingface.co/meta-llama/Llama-3.1-8B-Instruct) |
| `Mistral-Large-3-675B-Instruct-2512` | Mistral AI | Text | 32k | Preview | Yes | [Model card](https://huggingface.co/mistralai/Mistral-Large-3-675B-Instruct-2512) |
| `qwen3-tts` | Alibaba Cloud | Text-to-speech | - | Preview | No | [Model card](https://huggingface.co/collections/Qwen/qwen3-tts) |
| `Qwen3-235B-A22B-Instruct-2507` | Alibaba Cloud | Text | 128k | Stable | Yes | [Model card](https://huggingface.co/Qwen/Qwen3-235B-A22B-Instruct-2507) |
| `Qwen3-32B` | Alibaba Cloud | Text | 32k | Stable | No | [Model card](https://huggingface.co/Qwen/Qwen3-32B) |
| `Llama-3.3-Swallow-70B-Instruct-v0.4` | Tokyotech-llm | Text | 128k | Stable | Yes | [Model card](https://huggingface.co/tokyotech-llm/Llama-3.3-Swallow-70B-Instruct-v0.4) |
| `E5-Mistral-7B-Instruct` | intfloat | Embeddings | 4k | Stable | No | [Model card](https://huggingface.co/intfloat/e5-mistral-7b-instruct) |
## Notes
- A **Preview** model is an early release. It can lack features, and it is not guaranteed to become Stable.
- **Custom checkpoints** shows whether you can bring your own fine-tuned checkpoint of the model. See [Custom checkpoints](/en/dedicated/custom-checkpoints).
- Read the licence on the model card before you use a model commercially. The MiniMax models have commercial terms.
# Dedicated Capacity overview
Source: https://docs.infercom.ai/en/dedicated/overview
## What Dedicated Capacity is
Dedicated Capacity is inference capacity reserved for one customer. It runs on purpose-built AI chips for inference, SambaNova's Reconfigurable Dataflow Units (RDUs), in our data center in Munich. We run it together with our operating partner SambaNova, which operates the software stack with us. You call it through the same OpenAI-compatible API as the Inference API, on an endpoint of your own.
## Models
- **GLM-5.3** and **MiniMax M3.1 Flash**
- gpt-oss-120b, Gemma 4 and more. See [Supported models](/en/dedicated/models).
- Your own fine-tuned checkpoints. See [Custom checkpoints](/en/dedicated/custom-checkpoints).
## Model bundles
You decide which models run on your capacity. Your capacity is one rack or several racks. A rack can run one model, or several models together in one bundle.
- **Several models on one rack.** The models in a bundle stay loaded together. The rack computes one model at a time and switches between them in milliseconds, per request. The models share the throughput of the rack, so we size a bundle for the combined traffic of its models. Each request selects its model by the model ID, on the same endpoint. For example, one rack can serve a text model, an embedding model and a speech-to-text model for a complete pipeline.
- **Several configurations of one model.** A bundle can be set up for your workload, for example for longer context lengths, for more concurrent requests, or with prompt caching.
- **Your split across racks.** With several racks, you decide how they are split between your models and bundles. We can change the split later.
Which models and configurations fit together depends on the models. We agree the specific bundles with you as part of the project.
## Inference API or Dedicated Capacity
| | Inference API | Dedicated Capacity |
| :-- | :-- | :-- |
| **Infrastructure** | Shared infrastructure | Reserved for you |
| **Model selection** | Set by Infercom | Chosen by you |
| **Models** | The [Inference API catalog](/en/models/infercomcloud-models) | GLM-5.3, MiniMax M3.1 Flash and the [full dedicated list](/en/dedicated/models), plus your checkpoints. Several models in [one bundle](#model-bundles), depending on the models |
| **Access** | api.infercom.ai, self-serve key from cloud.infercom.ai | An endpoint of your own, set up with you |
| **Billing** | Pay per token | Monthly, per agreement |
| **Rate limits** | [By tier](/en/models/rate-limits) | Agreed with you |
| **Throughput** | Shared with other customers under load | Reserved for your traffic |
| **Start** | Minutes | Lead time on request |
## When Dedicated Capacity fits
- Sustained production volume.
- Models that are not in the Inference API catalog.
- Your own fine-tuned checkpoints.
- Traffic that must not share capacity with other customers.
For variable or exploratory workloads, the Inference API is usually the better start. You can move to Dedicated Capacity later. The API stays the same.
## How to start
[Talk to us](https://infercom.ai/contact/). We size the capacity from your workload. See [what to send us](/en/dedicated/faq#how-many-racks-do-i-need).
The lead time is available on request. After onboarding, see [Connect to your endpoint](/en/dedicated/connect).
The same models can also run on hardware in your own data center. See [On-premises](https://infercom.ai/on-premises/).
# Implement Anthropic-Compatible Features - Developer Guide
Source: https://docs.infercom.ai/en/features/anthropic-compatibility
The Infercom API supports Anthropic's Messages API format (`/v1/messages`), enabling you to use the Anthropic Python SDK and compatible tooling with Infercom's models. This is useful for applications and frameworks built around the Anthropic API, such as Claude Code, LangChain's Anthropic provider, or custom agentic workflows.
## Install the Anthropic SDK
```bash
pip install anthropic
```
## Configure the client
Set the `base_url` to Infercom's API and provide your Infercom API key.
```python
import anthropic
client = anthropic.Anthropic(
base_url="https://api.infercom.ai",
api_key="your-infercom-api-key"
)
```
## Basic usage
### Non-streaming example
```python
import anthropic
client = anthropic.Anthropic(
base_url="https://api.infercom.ai",
api_key="your-infercom-api-key"
)
message = client.messages.create(
model="gpt-oss-120b",
max_tokens=1024,
messages=[
{"role": "user", "content": "What is the capital of Germany?"}
]
)
print(next(block.text for block in message.content if block.type == "text"))
```
`gpt-oss-120b` returns a `thinking` block before the `text` block, so select the text block by its type. `content[0].text` raises an `AttributeError`. See [Reasoning (thinking blocks)](#reasoning-thinking-blocks).
### Streaming example
```python
import anthropic
client = anthropic.Anthropic(
base_url="https://api.infercom.ai",
api_key="your-infercom-api-key"
)
with client.messages.stream(
model="gpt-oss-120b",
max_tokens=1024,
messages=[
{"role": "user", "content": "Write a haiku about AI."}
]
) as stream:
for text in stream.text_stream:
print(text, end="", flush=True)
```
### System prompts
Use the `system` parameter to provide instructions to the model.
```python
message = client.messages.create(
model="gpt-oss-120b",
max_tokens=1024,
system="You are a helpful assistant that speaks like a pirate.",
messages=[
{"role": "user", "content": "Hello!"}
]
)
```
### Multi-turn conversations
```python
message = client.messages.create(
model="gpt-oss-120b",
max_tokens=1024,
messages=[
{"role": "user", "content": "My name is Thomas."},
{"role": "assistant", "content": "Nice to meet you, Thomas!"},
{"role": "user", "content": "What is my name?"}
]
)
```
## Tool use (function calling)
The Anthropic Messages API supports tool use for models that have function calling capabilities.
### Defining tools
```python
import anthropic
client = anthropic.Anthropic(
base_url="https://api.infercom.ai",
api_key="your-infercom-api-key"
)
message = client.messages.create(
model="gpt-oss-120b",
max_tokens=200,
tools=[
{
"name": "get_weather",
"description": "Get the current weather in a given location",
"input_schema": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and country, e.g. Munich, Germany"
}
},
"required": ["location"]
}
}
],
messages=[
{"role": "user", "content": "What's the weather in Munich?"}
]
)
print(message.content)
```
If the model decides to use the tool, the response will include a `tool_use` content block:
```json
[
{
"type": "tool_use",
"id": "call_abc123",
"name": "get_weather",
"input": {"location": "Munich, Germany"}
}
]
```
### Providing tool results
After executing the tool, send the result back to continue the conversation:
```python
message = client.messages.create(
model="gpt-oss-120b",
max_tokens=200,
tools=[
{
"name": "get_weather",
"description": "Get the current weather in a given location",
"input_schema": {
"type": "object",
"properties": {
"location": {"type": "string"}
},
"required": ["location"]
}
}
],
messages=[
{"role": "user", "content": "What's the weather in Munich?"},
{
"role": "assistant",
"content": [
{
"type": "tool_use",
"id": "call_abc123",
"name": "get_weather",
"input": {"location": "Munich, Germany"}
}
]
},
{
"role": "user",
"content": [
{
"type": "tool_result",
"tool_use_id": "call_abc123",
"content": "Sunny, 22°C"
}
]
}
]
)
print(next(block.text for block in message.content if block.type == "text"))
```
## Images
`gemma-4-31B-it` accepts images as base64 `image` blocks. A URL image source returns HTTP 400. `gpt-oss-120b` is text only and returns HTTP 400 for an image.
```python
import base64
with open("sample.jpg", "rb") as image_file:
image_base64 = base64.b64encode(image_file.read()).decode("utf-8")
message = client.messages.create(
model="gemma-4-31B-it",
max_tokens=1024,
messages=[
{
"role": "user",
"content": [
{
"type": "image",
"source": {"type": "base64", "media_type": "image/jpeg", "data": image_base64}
},
{"type": "text", "text": "What is happening in this image?"}
]
}
]
)
print(next(block.text for block in message.content if block.type == "text"))
```
Supported formats and the token cost per image: [Vision](/en/features/vision).
## Reasoning (thinking blocks)
`gpt-oss-120b` and `MiniMax-M3.1-Flash` return their reasoning as a `thinking` block before the `text` block. They do this with or without the `thinking` parameter. `gemma-4-31B-it` returns no `thinking` block.
On `gpt-oss-120b`, `budget_tokens` selects one of three reasoning levels. It does not set an exact token limit.
| `budget_tokens` | Reasoning level |
|-----------------|-----------------|
| Up to 4,096 | `low` |
| 4,097 to 16,384 | `medium`, the same as without the `thinking` parameter |
| 16,385 and above | `high` |
`thinking: {"type": "disabled"}` does not turn reasoning off. Reasoning tokens count toward `max_tokens`: see [Budgeting tokens for reasoning](/en/build/reasoning#budgeting-tokens-for-reasoning).
```python
message = client.messages.create(
model="gpt-oss-120b",
max_tokens=4096,
thinking={"type": "enabled", "budget_tokens": 1024},
messages=[{"role": "user", "content": "What is 27 * 43?"}]
)
for block in message.content:
if block.type == "thinking":
print("Thinking:", block.thinking)
elif block.type == "text":
print("Answer:", block.text)
```
## Async usage
```python
import anthropic
import asyncio
async def main():
client = anthropic.AsyncAnthropic(
base_url="https://api.infercom.ai",
api_key="your-infercom-api-key"
)
message = await client.messages.create(
model="gpt-oss-120b",
max_tokens=1024,
messages=[
{"role": "user", "content": "Hello!"}
]
)
print(next(block.text for block in message.content if block.type == "text"))
asyncio.run(main())
```
## Using curl
You can also call the Messages API directly with curl:
```bash
curl https://api.infercom.ai/v1/messages \
-H "Content-Type: application/json" \
-H "x-api-key: your-infercom-api-key" \
-H "anthropic-version: 2023-06-01" \
-d '{
"model": "gpt-oss-120b",
"max_tokens": 1024,
"messages": [
{"role": "user", "content": "Hello!"}
]
}'
```
## Supported parameters
| Parameter | Type | Description |
|-----------|------|-------------|
| `model` | string | Required. The model to use (e.g., `gpt-oss-120b`) |
| `messages` | array | Required. Array of message objects with `role` and `content` |
| `max_tokens` | integer | Required. Maximum tokens to generate |
| `system` | string | System prompt for the model |
| `temperature` | number | Sampling temperature (0.0-2.0). [No default](/en/models/infercomcloud-models#if-you-omit-temperature), unlike the Anthropic API, which defaults to 1.0. |
| `top_p` | number | Nucleus sampling parameter |
| `top_k` | integer | Top-k sampling parameter |
| `stop_sequences` | array | Custom stop sequences |
| `stream` | boolean | Enable streaming responses |
| `tools` | array | Tool definitions for function calling |
| `tool_choice` | object | Control tool usage (`auto`, `any`, or specific tool) |
| `thinking` | object | Accepted. On `gpt-oss-120b`, `budget_tokens` selects the reasoning level. See [Reasoning (thinking blocks)](#reasoning-thinking-blocks) |
The Anthropic Python SDK 2.x has no `temperature`, `top_p` or `top_k` arguments. Pass them in `extra_body`, for example `extra_body={"temperature": 0.7}`.
## Unsupported features
The following Anthropic-specific features are not supported:
- Prompt caching (`cache_control`)
- URL image sources (use base64, see [Images](#images))
- PDF file inputs
- Citations
- Server-side tools (web search, code execution)
- Batch API
- `repetition_penalty` (returns HTTP 400 on this endpoint; use `/v1/chat/completions`)
## Differences from Anthropic's API
| Aspect | Anthropic | Infercom |
|--------|-----------|----------|
| Models | Claude (Opus, Sonnet, Haiku) | Open-weight models. EU sovereign: `gpt-oss-120b`, `gemma-4-31B-it`. Global Model Catalog (processed outside the EU): Llama, MiniMax |
| Base URL | `https://api.anthropic.com` | `https://api.infercom.ai` |
| API key header | `x-api-key` | `x-api-key` (same) |
| Version header | Required: `anthropic-version` | Supported but optional |
| Error shape | Anthropic error format | Anthropic error format (see below) |
### Error responses
`/v1/messages` returns errors in the **Anthropic** shape, not the OpenAI envelope used by Infercom's other endpoints. The body carries a top-level `"type": "error"`, and the `error` object holds `message` and `type` only:
```json
{
"type": "error",
"error": {
"type": "not_found_error",
"message": "The model `nonexistent-model` does not exist or you do not have access to it."
},
"request_id": "req_6313f64378ad4a89b6005ab233a3f2a9"
}
```
| Field | Notes |
| :---- | :---- |
| `type` (top level) | Always `error` |
| `error.type` | `authentication_error`, `invalid_request_error` or `not_found_error` |
| `error.message` | Human-readable explanation |
| `error.param` / `error.code` | **Not returned.** The OpenAI-compatible endpoints provide these; `/v1/messages` does not |
| `request_id` | Present on every status. Most carry a `req_` prefix; the 401 does not |
This shape is returned for every error status, including 400, 401, 404, 410 and 422. See [API error codes](/en/api-reference/using-the-api/api-error-codes) for the shapes the other endpoints use.
## When to use Anthropic vs OpenAI compatibility
| Use case | Recommended API |
|----------|-----------------|
| Existing Anthropic SDK code | Anthropic Messages API (`/v1/messages`) |
| Claude Code, LangChain Anthropic | Anthropic Messages API (`/v1/messages`) |
| OpenAI SDK code | OpenAI Chat Completions API (`/v1/chat/completions`) |
| Agentic workflows, coding tools | [Responses API](/en/features/responses-api) (`/v1/responses`) |
| New projects | Any - all three APIs work with the same models |
## Related documentation
- [OpenAI compatibility](/en/features/openai-compatibility) - Using the OpenAI SDK
- [Function calling](/en/features/function-calling) - Detailed guide on tool use
- [Responses API](/en/features/responses-api) - Agentic workflows with structured outputs
- [Supported models](/en/models/infercomcloud-models) - Available models and capabilities
# Implement Audio‑Input Features - Developer Guide
Source: https://docs.infercom.ai/en/features/audio
For developers requiring audio support, Infercom provides OpenAI's Whisper large-v3 model, which enables real-time transcriptions and translations.
## Whisper-Large-v3
- **Model**: Whisper-Large-v3
- **Description**: State-of-the-art automatic speech recognition (ASR) and translation model. Developed by OpenAI and trained on 5M+ hours of labeled audio. Excels in multilingual and zero-shot speech tasks across diverse domains.
- **Model ID**: `Whisper-Large-v3`
- **Supported languages**: Multilingual
### Core capabilities
- Transcribes and translates extended audio inputs (up to 25 MB).
- Demonstrates high accuracy in speech recognition and translation tasks.
- Provides OpenAI-compatible endpoints for transcriptions and translations.
### Request parameters
| Parameter | Type | Description | Default | Endpoints |
| :---------------- | :------ | :------------------------------------------------------------------------------------------------------------------------------- | :------- | :------------------------------- |
| `model` | String | The ID of the model to use. | Required | `transcriptions`, `translations` |
| `file` | File | Audio file in FLAC, MP3, MP4, MPEG, MPGA, M4A, Ogg, WAV, or WebM format. File size limit: 25MB. | Required | `transcriptions`, `translations` |
| `prompt` | String | Prompt to influence transcription style or vocabulary. Example: "Please transcribe carefully, including pauses and hesitations." | Optional | `transcriptions`, `translations` |
| `response_format` | String | Output format: `json`, `text`, `verbose_json`, `srt` or `vtt`. See [Response formats](#response-formats) below. | `json` | `transcriptions`, `translations` |
| `timestamp_granularities[]` | Array | Timestamp detail. Only `segment` is supported. Use it with `verbose_json`. `word` returns HTTP 400. | Optional | `transcriptions` |
| `language` | String | The language of the input audio. Using ISO-639-1 format (e.g., `en`) improves accuracy and latency. | Optional | `transcriptions`, `translations` |
| `stream` | Boolean | Enables streaming responses. | `false` | `transcriptions`, `translations` |
| `stream_options` | Object | **Not supported.** The endpoint rejects this parameter with HTTP 400 `unknown_parameter`. | - | Not accepted |
### Response formats
`response_format` accepts five values.
| Value | What you get |
| :---- | :----------- |
| `json` | A JSON object with `text` and a `usage` object: `{"text": "...", "usage": {"type": "duration", "seconds": 5.58}}` |
| `text` | The bare transcript string |
| `verbose_json` | A JSON object with `duration`, `language`, `task`, `text` and `segments`. Each segment has an `id`, a `start` and an `end` time in seconds, and its `text`. There is no `usage` object |
| `srt` | SRT subtitles with numbered cues and timestamps |
| `vtt` | WebVTT subtitles. The body starts with `WEBVTT` |
To get segment timestamps in JSON, send `response_format=verbose_json` with `timestamp_granularities[]=segment`. Word-level timestamps are not supported: `timestamp_granularities[]=word` returns HTTP 400.
### Usage data
With `response_format=json`, transcriptions and translations return a `usage` object. `usage.seconds` is the duration of the processed audio, in seconds. The other formats return no `usage` object.
### Example usage
```python
from sambanova import SambaNova
import base64
client = SambaNova(
base_url="https://api.infercom.ai/v1",
api_key="your-infercom-api-key",
)
audio_path="audio_path"
with open(audio_path, "rb") as audio_file:
bin_audio = audio_file.read()
response = client.audio.transcriptions.create(
model="Whisper-Large-v3",
file=(audio_path,bin_audio),
)
print(str(response))
```
```python
from openai import OpenAI
import base64
client = OpenAI(
base_url="https://api.infercom.ai/v1",
api_key="your-infercom-api-key",
)
audio_path="audio_path"
with open(audio_path, "rb") as audio_file:
bin_audio = audio_file.read()
response = client.audio.transcriptions.create(
model="Whisper-Large-v3",
file=(audio_path,bin_audio),
)
print(str(response))
```
```javascript
import SambaNova from "sambanova";
const client = new SambaNova({
baseURL: 'https://api.infercom.ai/v1',
apiKey: 'your-infercom-api-key'
});
async function run() {
const audioPath = 'audio_path';
const binAudio = fs.createReadStream(audioPath);
const response = await client.audio.transcriptions.create({
model: 'Whisper-Large-v3',
file: binAudio,
});
console.log('Full Response:');
console.dir(response, { depth: null });
}
run().catch(console.error);
```
# Implement Embeddings Features - Developer Guide
Source: https://docs.infercom.ai/en/features/embeddings
An embedding is a vectorized numerical representation of data, where the relatedness between different pieces of information is captured through measurable distances. These embeddings are commonly used in applications such as recommendation systems, classification, and search.
## E5-Mistral-7B-Instruct
- **Model**: E5-Mistral-7B-Instruct
- **Description**: High-quality multilingual embedding model based on Mistral 7B. Excels at semantic similarity, retrieval, and classification tasks across multiple languages.
- **Model ID**: `E5-Mistral-7B-Instruct`
- **Context length**: 4,096 tokens. A longer input returns HTTP 400 with `code` `context_length_exceeded` and `param` `input`
- **Embedding dimensions**: 4,096
- **Supported languages**: English, German, French, Italian, Portuguese, Hindi, Spanish, Thai
For setup and integration:
1. Get an API key from the [API keys and URLs](/en/get-started/api-keys-urls) page.
2. Review sample implementations in the documentation.
3. Generate embeddings using provided examples.
4. Integrate embeddings into your application workflows.
For a detailed breakdown of available parameters, see the [Embedding endpoint API reference](/api-reference/operations/createembedding).
## Generating embeddings
The Infercom Embeddings API is designed for seamless integration with existing applications and follows [OpenAI's embeddings API](https://platform.openai.com/docs/guides/embeddings) structure, simplifying migration and adoption.
The model takes in text as input and outputs a vector of floating-point numbers, which can be used for tasks like similarity searches.
## Generating a single embedding
To generate an embedding for a single input text, use `client.embeddings.create()` with the model name and input string.
### Example
```python
from sambanova import SambaNova
client = SambaNova(
base_url="https://api.infercom.ai/v1",
api_key="your-infercom-api-key",
)
response = client.embeddings.create(
model="E5-Mistral-7B-Instruct",
input="The quick brown fox jumps over the lazy dog"
)
print(response)
```
```python
from openai import OpenAI
client = OpenAI(
base_url="https://api.infercom.ai/v1",
api_key="your-infercom-api-key",
)
response = client.embeddings.create(
model="E5-Mistral-7B-Instruct",
input="The quick brown fox jumps over the lazy dog"
)
print(response)
```
### Example response
```python
{
"object": "list",
"data": [
{
"object": "embedding",
"embedding": [0.002843, -0.017531, ..., 0.012934],
"index": 0
}
],
"model": "E5-Mistral-7B-Instruct",
"usage": {
"prompt_tokens": 10,
"total_tokens": 10
}
}
```
## Generating multiple embeddings
To generate embeddings for multiple inputs in a single request, pass an array of input strings to the `input` parameter.
### Example
```python
from sambanova import SambaNova
client = SambaNova(
base_url="https://api.infercom.ai/v1",
api_key="your-infercom-api-key",
)
response = client.embeddings.create(
model="E5-Mistral-7B-Instruct",
input=[
"Our solar system orbits the Milky Way galaxy at about 515,000 mph",
"Jupiter's Great Red Spot is a storm that has been raging for at least 350 years."
]
)
print(response)
```
```python
from openai import OpenAI
client = OpenAI(
base_url="https://api.infercom.ai/v1",
api_key="your-infercom-api-key",
)
response = client.embeddings.create(
model="E5-Mistral-7B-Instruct",
input=[
"Our solar system orbits the Milky Way galaxy at about 515,000 mph",
"Jupiter's Great Red Spot is a storm that has been raging for at least 350 years."
]
)
print(response)
```
### Example response
```python
{
"model": "E5-Mistral-7B-Instruct",
"object": "list",
"data": [
{
"index": 0,
"object": "embedding",
"embedding": [0.2633975, 0.13856208, ..., 0.04331574]
},
{
"index": 1,
"object": "embedding",
"embedding": [-0.14496337, 0.21044481, ..., -0.16187587]
}
]
}
```
# Implement Function Calling and JSON Mode Features - Developer Guide
Source: https://docs.infercom.ai/en/features/function-calling
Function calling enables dynamic workflows by allowing the model to select and suggest function calls based on user input, which helps in building agentic workflows. By defining a set of functions, or tools, you provide context that lets the model recommend and fill in function arguments as needed.
## How function calling works
Function calling enables adaptive workflows that leverage real-time data and structured outputs, creating more dynamic and responsive model interactions.
1. **Submit a Query with tools:** Start by submitting a user query along with available tools defined in JSON Schema. This schema specifies parameters for each function.
2. **The model processes and suggests**: The model interprets the query, assesses intent, and decides if it will respond conversationally or suggest function calls. If a function is called, it fills in the arguments based on the schema.
3. **Receive a model response:** You'll get a response from the model, which may include a function call suggestion. Execute the function with the provided arguments and return the result to the model for further interaction.
## Model support
Function calling is supported on the models below. Always check [Supported models](/en/models/infercomcloud-models) for current availability.
| **Model ID** | **Region** | **Tools** | **Forced `tool_choice`** | **`response_format`** | **Tools with an image** |
| :----------- | :--------- | :-------- | :----------------------- | :-------------------- | :---------------------- |
| `gpt-oss-120b` | EU | Yes | Yes | Yes | Not applicable - text only |
| `gemma-4-31B-it` | EU | Yes | Yes | Yes | Yes |
| `Meta-Llama-3.3-70B-Instruct` | Non-EU | Yes | Yes | Not reliably enforced - validate the output | Not applicable - text only |
| `MiniMax-M3.1-Flash` | Non-EU | Yes | Yes | Yes | Yes |
Vision requests support the same `tools`, `tool_choice` and `response_format` options as text-only requests. The constraint is applied during generation. See [Vision](/en/features/vision#tools-and-structured-output-with-images).
## Example usage
The examples below describe each step of using function calling with an end-to-end example after the last step.
### Step 1: Define the function schema
Define a JSON schema for your function. You will need to specify:
- The name of the function.
- A description of what it does.
- The parameters, their data types, and descriptions.
```json title="Example schema for getting the weather"
{
"type": "function",
"function": {
"name": "get_weather",
"description": "Gets the current weather information for a given city.",
"parameters": {
"type": "object",
"properties": {
"city": {
"type": "string",
"description": "Name of the city to get weather information for."
}
},
"required": ["city"]
}
}
}
```
### Step 2: Configure function calling in your request
When sending a request, include the function definition in the `tools` parameter and set `tool_choice` to the following:
- `auto` : allows the model to choose between generating a message or calling a function. This is the default tool choice when the field is not specified.
- `required` : This forces the model to generate a function call. The model will then always select one or more function(s) to call.
- To enforce a specific function call, set `tool_choice = {"type": "function", "function": {"name": "get_weather"}}`. This ensures the model will only use the specified function.
```python
import sambanova
import random
import json
# Initialize the client with the Infercom base URL and API key
client = sambanova.SambaNova(
base_url="https://api.infercom.ai/v1",
api_key="your-infercom-api-key"
)
MODEL = 'gpt-oss-120b'
def get_weather(city: str) -> dict:
"""
Fake weather lookup: returns a random temperature between 20°C and 50°C.
"""
temp = random.randint(20, 50)
return {
"city": city,
"temperature_celsius": temp
}
tools = [
{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get weather of a location, the user should supply a location first",
"parameters": {
"type": "object",
"properties": {
"city": {
"type": "string",
"description": "The city and state, e.g. San Francisco, CA",
}
},
"required": ["city"]
},
}
},
]
messages = [{"role": "user", "content": "What's the weather like in Paris today?"}]
completion = client.chat.completions.create(
model=MODEL,
messages=messages,
tools=tools
)
print(completion)
```
```python
import openai
import random
import json
# Initialize the client with the Infercom base URL and API key
client = openai.OpenAI(
base_url="https://api.infercom.ai/v1",
api_key="your-infercom-api-key"
)
MODEL = 'gpt-oss-120b'
def get_weather(city: str) -> dict:
"""
Fake weather lookup: returns a random temperature between 20°C and 50°C.
"""
temp = random.randint(20, 50)
return {
"city": city,
"temperature_celsius": temp
}
tools = [
{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get weather of a location, the user should supply a location first",
"parameters": {
"type": "object",
"properties": {
"city": {
"type": "string",
"description": "The city and state, e.g. San Francisco, CA",
}
},
"required": ["city"]
},
}
},
]
messages = [{"role": "user", "content": "What's the weather like in Paris today?"}]
completion = client.chat.completions.create(
model=MODEL,
messages=messages,
tools=tools
)
print(completion)
```
### Step 3: Handle tool calls
If the model chooses to call a function, you will find `tool_calls` in the response. Extract the function call details and execute the corresponding function with the provided parameters.
```python title="Example code"
tool_call = completion.choices[0].message.tool_calls[0]
args = json.loads(tool_call.function.arguments)
result = get_weather(args["city"])
```
### Step 4: Provide function results back to the model
Once you have computed the result, pass it back to the model to continue the conversation or confirm the output.
```python title="Example code"
messages.append(completion.choices[0].message) # append model's function call message
messages.append({ # append result message
"role": "tool",
"tool_call_id": tool_call.id,
"content": str(result)
})
completion_2 = client.chat.completions.create(
model=MODEL,
messages=messages,
)
print(completion_2.choices[0].message.content)
```
### Step 5: Example output
An example output is shown below.
```
The current weather in Paris is 25 degrees Celsius.
```
### End-to-end example
```python
import sambanova
import random
import json
# Define the SambaNova client
client = sambanova.SambaNova(
base_url="https://api.infercom.ai/v1",
api_key="your-infercom-api-key"
)
MODEL = 'gpt-oss-120b'
def get_weather(city: str) -> dict:
"""
Fake weather lookup: returns a random temperature between 20°C and 50°C.
"""
temp = random.randint(20, 50)
return {
"city": city,
"temperature_celsius": temp
}
tools = [
{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get weather of a location, the user should supply a location first",
"parameters": {
"type": "object",
"properties": {
"city": {
"type": "string",
"description": "The city and state, e.g. San Francisco, CA",
}
},
"required": ["city"]
},
}
},
]
messages = [{"role": "user", "content": "What's the weather like in Paris today?"}]
completion = client.chat.completions.create(
model=MODEL,
messages=messages,
tools=tools
)
print(completion)
tool_call = completion.choices[0].message.tool_calls[0]
args = json.loads(tool_call.function.arguments)
result = get_weather(args["city"])
messages.append({ # append model's function call message
"role": "assistant",
"content": None,
"tool_calls": [tool_call]
})
messages.append({ # append result message
"role": "tool",
"tool_call_id": tool_call.id,
"content": json.dumps(result)
})
completion_2 = client.chat.completions.create(
model=MODEL,
messages=messages,
)
print(completion_2.choices[0].message.content)
```
```python
import openai
import random
import json
# Define the OpenAI client
client = openai.OpenAI(
base_url="https://api.infercom.ai/v1",
api_key="your-infercom-api-key"
)
MODEL = 'gpt-oss-120b'
def get_weather(city: str) -> dict:
"""
Fake weather lookup: returns a random temperature between 20°C and 50°C.
"""
temp = random.randint(20, 50)
return {
"city": city,
"temperature_celsius": temp
}
tools = [
{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get weather of a location, the user should supply a location first",
"parameters": {
"type": "object",
"properties": {
"city": {
"type": "string",
"description": "The city and state, e.g. San Francisco, CA",
}
},
"required": ["city"]
},
}
},
]
messages = [{"role": "user", "content": "What's the weather like in Paris today?"}]
completion = client.chat.completions.create(
model=MODEL,
messages=messages,
tools=tools
)
print(completion)
tool_call = completion.choices[0].message.tool_calls[0]
args = json.loads(tool_call.function.arguments)
result = get_weather(args["city"])
messages.append({ # append model's function call message
"role": "assistant",
"content": None,
"tool_calls": [tool_call]
})
messages.append({ # append result message
"role": "tool",
"tool_call_id": tool_call.id,
"content": json.dumps(result)
})
completion_2 = client.chat.completions.create(
model=MODEL,
messages=messages,
)
print(completion_2.choices[0].message.content)
```
## Streaming tool calls
Set `stream: true` to receive tool calls as they are generated. Arguments arrive in the `tool_calls` field of the delta. No reasoning scaffolding appears in `delta.content`.
## JSON schema
You can set the `response_format` parameter to your defined schema to ensure the model produces a JSON object that matches your specified structure.
```python
import sambanova
import json
# Define the SambaNova client
client = sambanova.SambaNova(
base_url="https://api.infercom.ai/v1",
api_key="your-infercom-api-key"
)
MODEL = "gpt-oss-120b"
# Define the schema
response_format = {
"type": "json_schema",
"json_schema": {
"name": "data_extraction",
"schema": {
"type": "object",
"properties": {
"section": {
"type": "string"
},
"products": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": ["section", "products"],
"additionalProperties": False
},
"strict": False
}
}
# Call the API
completion = client.chat.completions.create(
model=MODEL,
messages=[
{
"role": "system",
"content": "You are an expert at structured data extraction. You will be given unstructured text and should convert it into the given structure."
},
{
"role": "user",
"content": "the section 24 has appliances, and videogames"
}
],
response_format=response_format
)
# Print the parsed result
print(completion)
```
```python
import openai
import json
# Define the OpenAI client
client = openai.OpenAI(
base_url="https://api.infercom.ai/v1",
api_key="your-infercom-api-key"
)
MODEL = "gpt-oss-120b"
# Define the schema
response_format = {
"type": "json_schema",
"json_schema": {
"name": "data_extraction",
"schema": {
"type": "object",
"properties": {
"section": {
"type": "string"
},
"products": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": ["section", "products"],
"additionalProperties": False
},
"strict": False
}
}
# Call the API
completion = client.chat.completions.create(
model=MODEL,
messages=[
{
"role": "system",
"content": "You are an expert at structured data extraction. You will be given unstructured text and should convert it into the given structure."
},
{
"role": "user",
"content": "the section 24 has appliances, and videogames"
}
],
response_format=response_format
)
# Print the parsed result
print(completion)
```
## JSON mode
You can set the `response_format` parameter to `json_object` in your request to ensure that the model outputs a valid JSON. In case the mode is not able to generate a valid JSON, an error will be returned.
```json
import sambanova
# Define the SambaNova client
client = sambanova.SambaNova(
base_url="https://api.infercom.ai/v1",
api_key="your-infercom-api-key"
)
MODEL = 'gpt-oss-120b'
def run_conversation(user_prompt):
# Initial conversation with user input
messages = [
{
"role": "system",
"content": "Always provide the response in this JSON format: {\"country\": \"name\", \"capital\": \"xx\"}"
},
{
"role": "user",
"content": user_prompt,
}
]
# First API call to get model's response
response = client.chat.completions.create(
model=MODEL,
messages=messages,
max_tokens=500,
response_format = { "type": "json_object"},
# stream = True
)
response_message = response.choices[0].message
print(response_message)
run_conversation('what is the capital of Austria')
```
```json
import openai
# Define the OpenAI client
client = openai.OpenAI(
base_url="https://api.infercom.ai/v1",
api_key="your-infercom-api-key"
)
MODEL = 'gpt-oss-120b'
def run_conversation(user_prompt):
# Initial conversation with user input
messages = [
{
"role": "system",
"content": "Always provide the response in this JSON format: {\"country\": \"name\", \"capital\": \"xx\"}"
},
{
"role": "user",
"content": user_prompt,
}
]
# First API call to get model's response
response = client.chat.completions.create(
model=MODEL,
messages=messages,
max_tokens=500,
response_format = { "type": "json_object"},
# stream = True
)
response_message = response.choices[0].message
print(response_message)
run_conversation('what is the capital of Austria')
```
```json title="Example response"
ChatCompletionMessage(content='{"country": "Austria", "capital": "Vienna"}', role='assistant', function_call=None, tool_calls=None)
```
### Other methods of structured outputs
Beyond JSON mode, structured outputs can also be generated using the [Instructor library](https://python.useinstructor.com/), which provides a convenient wrapper for extracting structured data from LLM responses using Pydantic models.
# Implement OpenAI-Compatible Features - Developer Guide
Source: https://docs.infercom.ai/en/features/openai-compatibility
Infercom inference APIs are designed to be compliant with OpenAI client libraries to simplify the adoption of our inference technologies to enhance your AI applications.
## Download the library
Run the command below to download the library.
```python
pip install openai
```
## Use Infercom APIs with OpenAI client libraries
Configuring your OpenAI client libraries to use Infercom inference APIs is as simple as setting two values: the `base_url` and your `api_key`, as shown below.
```python
from openai import OpenAI
client = OpenAI(
base_url="https://api.infercom.ai/v1",
api_key="your-infercom-api-key"
)
```
Now you can make an API request to a model and choose how to receive your output.
### Non-streaming example
The following code demonstrates using the OpenAI Python client for non-streaming completions.
```python
completion = client.chat.completions.create(
model="Meta-Llama-3.1-8B-Instruct",
messages = [
{"role": "system", "content": "Answer the question in a couple sentences."},
{"role": "user", "content": "Share a happy story with me"}
]
)
print(completion.choices[0].message)
```
### Streaming example
The following code demonstrates using the OpenAI Python client for streaming completions.
```python
completion = client.chat.completions.create(
model="Meta-Llama-3.1-8B-Instruct",
messages = [
{"role": "system", "content": "Answer the question in a couple sentences."},
{"role": "user", "content": "Share a happy story with me"}
],
stream= True
)
for chunk in completion:
print(chunk.choices[0].delta.content)
```
## Rejected unless 0
Two OpenAI parameters are not implemented on any model. They are accepted only with the value `0`:
- `presence_penalty`
- `frequency_penalty`
To control repetition, use [`repetition_penalty`](#infercom-api-features-not-supported-by-openai-clients) instead.
## Supported, but not on every model
These parameters work. Which models honour them differs, so check the table before you rely on one.
| **Parameter** | **Honoured on** | **No effect on** | **Request fails on** |
| :------------ | :-------------- | :--------------- | :------------------- |
| `n` | Every model | - | - |
| `logprobs`, `top_logprobs` | Every model except `MiniMax-M3.1-Flash` | `MiniMax-M3.1-Flash` | - |
| `logit_bias` | `gpt-oss-120b` | - | `gemma-4-31B-it`, `Meta-Llama-3.3-70B-Instruct`, `MiniMax-M3.1-Flash` |
| `seed` | `gpt-oss-120b`, `gemma-4-31B-it`, `Meta-Llama-3.3-70B-Instruct` | `MiniMax-M3.1-Flash` | - |
| `repetition_penalty` | `gpt-oss-120b`, `gemma-4-31B-it` | `Meta-Llama-3.3-70B-Instruct` | `MiniMax-M3.1-Flash`, at any value other than 1.0 |
Measured on `/v1/chat/completions`. A failing `logit_bias` request returns HTTP 400. On `Meta-Llama-3.3-70B-Instruct` it
returns HTTP 400 or HTTP 500, varying between identical requests. `repetition_penalty` on `MiniMax-M3.1-Flash` returns HTTP 500.
The OpenAI SDKs retry a 500 twice. Send `logit_bias` only to `gpt-oss-120b`, and do not send these parameters to the
models in the last column.
## Feature differences
`temperature`: The Infercom API accepts values between 0 and 2, the same range as OpenAI. Values above 2 are rejected with a `400`. Unlike OpenAI, the Infercom API applies no default. Omit `temperature` and most models decode greedily, which behaves like `temperature` 0. Set it on every request. See [If you omit temperature](/en/models/infercomcloud-models#if-you-omit-temperature).
## Infercom API features not supported by OpenAI clients
The Infercom API supports two parameters that the OpenAI client libraries do not:
- `top_k` - limits sampling to the K most probable tokens. It has no effect unless `temperature` is 0.001 or above. See [How top_k interacts with temperature](/en/models/infercomcloud-models#how-top_k-interacts-with-temperature).
- `repetition_penalty` - the only repetition control this API applies. It also penalises tokens that appear in your prompt, so a long system prompt can suppress words the prompt relies on. It is not a drop-in replacement for `frequency_penalty`, which is accepted and ignored. Accepted range is 1 to 2. Set a correct `temperature` first, then keep `repetition_penalty` at or below 1.2. Applied on `/v1/chat/completions` only.
The OpenAI SDKs reject unknown top-level arguments, so send both through `extra_body`.
```python
response = client.chat.completions.create(
model="gpt-oss-120b",
messages=[{"role": "user", "content": "..."}],
temperature=1.0,
extra_body={"top_k": 40, "repetition_penalty": 1.05},
)
```
# Optimize Performance and Reduce Latency
Source: https://docs.infercom.ai/en/features/performance
This guide covers best practices for minimizing latency and maximizing throughput when using the Infercom Inference Service.
## Connection pooling
The single most impactful optimization is reusing your client instance across requests. This enables HTTP connection pooling, which skips the TCP and TLS handshake on subsequent calls.
### How it works
When you create a new client for every request, each call must establish a fresh TCP connection and negotiate TLS — adding several tens of milliseconds depending on your location and network conditions. By reusing the client, the underlying connection stays open and subsequent requests skip this setup entirely.
### Recommended pattern
```python
from sambanova import SambaNova
# Create the client once
client = SambaNova(
base_url="https://api.infercom.ai/v1",
api_key="your-infercom-api-key"
)
# Reuse it for all requests
response_1 = client.chat.completions.create(
model="gpt-oss-120b",
messages=[{"role": "user", "content": "Hello"}]
)
response_2 = client.chat.completions.create(
model="gpt-oss-120b",
messages=[{"role": "user", "content": "Follow-up question"}]
)
```
```python
from openai import OpenAI
# Create the client once
client = OpenAI(
base_url="https://api.infercom.ai/v1",
api_key="your-infercom-api-key"
)
# Reuse it for all requests
response_1 = client.chat.completions.create(
model="gpt-oss-120b",
messages=[{"role": "user", "content": "Hello"}]
)
response_2 = client.chat.completions.create(
model="gpt-oss-120b",
messages=[{"role": "user", "content": "Follow-up question"}]
)
```
```javascript
import SambaNova from "sambanova";
// Create the client once
const client = new SambaNova({
baseURL: "https://api.infercom.ai/v1",
apiKey: "your-infercom-api-key",
});
// Reuse it for all requests
const response1 = await client.chat.completions.create({
model: "gpt-oss-120b",
messages: [{ role: "user", content: "Hello" }],
});
const response2 = await client.chat.completions.create({
model: "gpt-oss-120b",
messages: [{ role: "user", content: "Follow-up question" }],
});
```
```python
# Avoid this pattern
for message in messages:
client = SambaNova(base_url="https://api.infercom.ai/v1", api_key="...")
response = client.chat.completions.create(...) # New connection each time
```
Both the SambaNova SDK and OpenAI SDK use [httpx](https://www.python-httpx.org/advanced/clients/) under the hood, which automatically manages a connection pool when you reuse the client. The default pool maintains up to 20 keep-alive connections.
## Response performance metadata
Every API response includes detailed performance metrics in the `usage` object. Use these to measure and optimize your application.
### Available metrics
| Field | Description |
|-------|-------------|
| `time_to_first_token` | Server-side time until the first token is generated (seconds) |
| `total_latency` | Server-side total processing time (seconds) |
| `completion_tokens_after_first_per_sec` | Output throughput after the first token (tokens/sec) |
| `completion_tokens_per_sec` | Overall output throughput including TTFT (tokens/sec) |
| `total_tokens_per_sec` | Combined input + output throughput (tokens/sec) |
| `prompt_tokens` | Number of input tokens processed |
| `completion_tokens` | Number of output tokens generated |
### Example response
```json
{
"usage": {
"prompt_tokens": 37,
"completion_tokens": 9,
"total_tokens": 46,
"time_to_first_token": 0.092,
"total_latency": 0.126,
"completion_tokens_after_first_per_sec": 232.25,
"completion_tokens_per_sec": 71.16,
"total_tokens_per_sec": 363.71
}
}
```
### Measuring client vs server latency
To understand how much time is spent on the network versus inference, compare your client-side elapsed time with the server-reported `total_latency`:
```python
import time
from openai import OpenAI
client = OpenAI(
base_url="https://api.infercom.ai/v1",
api_key="your-infercom-api-key"
)
start = time.perf_counter()
response = client.chat.completions.create(
model="gpt-oss-120b",
messages=[{"role": "user", "content": "Hello"}],
max_tokens=50
)
client_elapsed = time.perf_counter() - start
server_latency = response.usage.total_latency # seconds
network_overhead = client_elapsed - server_latency
print(f"Server inference: {server_latency*1000:.0f}ms")
print(f"Client total: {client_elapsed*1000:.0f}ms")
print(f"Network overhead: {network_overhead*1000:.0f}ms")
```
A typical network overhead from within the EU is 50–150ms, depending on your proximity to the datacenter and whether connection pooling is active.
## Streaming for interactive applications
For chatbots and interactive use cases, streaming delivers the first token to the user faster and provides a more responsive experience.
```python
from sambanova import SambaNova
client = SambaNova(
base_url="https://api.infercom.ai/v1",
api_key="your-infercom-api-key"
)
stream = client.chat.completions.create(
model="gpt-oss-120b",
messages=[{"role": "user", "content": "Explain quantum computing"}],
stream=True
)
for chunk in stream:
content = chunk.choices[0].delta.content
if content:
print(content, end="", flush=True)
```
Streaming does not reduce total processing time, but it significantly improves perceived latency by delivering output as it is generated.
## Performance best practices
| Practice | Impact | Details |
|----------|--------|---------|
| Reuse client instances | Avoids repeated TCP/TLS handshake | Saves several tens of ms per request |
| Use streaming for UI | Faster perceived response | First token arrives sooner |
| Set `max_tokens` appropriately | Avoids unnecessary generation | Don't leave it at the default if you need short responses |
| Using a reasoning model? | Avoids truncated or empty answers | Budget `max_tokens` for the chain of thought - see the [reasoning guide](/en/build/reasoning#budgeting-tokens-for-reasoning) |
| Choose the right model | Varies | Smaller models have lower TTFT and higher throughput |
| Deploy close to EU datacenter | Lower network round-trip time | Infercom runs in Germany (Equinix Munich) |
# Responses API - Build Agentic Workflows
Source: https://docs.infercom.ai/en/features/responses-api
The Responses API (`POST /v1/responses`) is designed for agentic workflows and tool-capable integrations. It structures model output as typed items—messages, function calls, and reasoning—rather than a single text field, enabling sophisticated multi-step agent interactions.
## Supported models
| Model | Reasoning | Function calling | Notes |
|-------|-----------|------------------|-------|
| `gemma-4-31B-it` | No | Yes | Fast, 128k context |
| `gpt-oss-120b` | Yes | Yes | Default `reasoning.effort` (`medium`) suits tool calling |
| `MiniMax-M3.1-Flash` | Yes | Yes | Default `reasoning.effort` is `max`. Global Model Catalog, processed outside the EU |
## Key characteristics
- **Structured output items**: Responses contain typed items (`message`, `function_call`, `reasoning`) rather than a single text field
- **Stateless**: Infercom does not store conversation state—supply full history via `input[]` on each request
- **Client-executed tools**: When a tool is needed, the model returns a `function_call` item; your application executes the function and returns the result
- **Streaming**: Server-Sent Events with typed event hierarchy for real-time output
## Simple generation
The simplest usage passes a string input and receives a structured response.
```python
from openai import OpenAI
client = OpenAI(
base_url="https://api.infercom.ai/v1",
api_key="your-infercom-api-key"
)
response = client.responses.create(
model="gpt-oss-120b",
input="Explain the difference between supervised and unsupervised learning."
)
# Access the text output
print(response.output_text)
```
```python
from sambanova import SambaNova
client = SambaNova(
base_url="https://api.infercom.ai/v1",
api_key="your-infercom-api-key"
)
response = client.responses.create(
model="gpt-oss-120b",
input="Explain the difference between supervised and unsupervised learning."
)
# The answer text
print(response.output_text)
```
```bash
curl -X POST https://api.infercom.ai/v1/responses \
-H "Authorization: Bearer $INFERCOM_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-oss-120b",
"input": "Explain the difference between supervised and unsupervised learning."
}'
```
### Response structure
The response contains an `output` array with typed items:
```json
{
"id": "resp_abc123",
"object": "response",
"status": "completed",
"model": "gpt-oss-120b",
"output": [
{
"type": "reasoning",
"id": "rs_xyz",
"status": "completed",
"content": [
{
"type": "reasoning_text",
"text": "The user is asking about ML concepts..."
}
]
},
{
"type": "message",
"id": "msg_xyz",
"role": "assistant",
"status": "completed",
"content": [
{
"type": "output_text",
"text": "Supervised learning uses labeled data..."
}
]
}
],
"usage": {
"input_tokens": 45,
"output_tokens": 120,
"total_tokens": 165,
"output_tokens_details": {
"reasoning_tokens": 35
}
}
}
```
## System instructions
Use the `instructions` parameter to provide system-level guidance:
```python
response = client.responses.create(
model="gpt-oss-120b",
instructions="You are a helpful assistant that speaks like a pirate.",
input="How are you today?"
)
```
```bash
curl -X POST https://api.infercom.ai/v1/responses \
-H "Authorization: Bearer $INFERCOM_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-oss-120b",
"instructions": "You are a helpful assistant that speaks like a pirate.",
"input": "How are you today?"
}'
```
## Multi-turn conversations
Since the API is stateless, include the full conversation history in the `input` array:
```python
# Turn 1
response_1 = client.responses.create(
model="gpt-oss-120b",
input=[{"role": "user", "content": "My name is Thomas."}]
)
# Turn 2 - include prior messages
response_2 = client.responses.create(
model="gpt-oss-120b",
input=[
{"role": "user", "content": "My name is Thomas."},
response_1.output[0], # Include assistant's response
{"role": "user", "content": "What is my name?"}
]
)
print(response_2.output_text) # "Your name is Thomas..."
```
```bash
curl -X POST https://api.infercom.ai/v1/responses \
-H "Authorization: Bearer $INFERCOM_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-oss-120b",
"input": [
{"role": "user", "content": "My name is Thomas."},
{"role": "assistant", "content": "Hello Thomas!"},
{"role": "user", "content": "What is my name?"}
]
}'
```
## Function calling
The Responses API supports function tools for agentic workflows. Only `type: "function"` tools are supported.
### Step 1: Define tools and make initial request
```python
import json
tools = [{
"type": "function",
"name": "get_weather",
"description": "Get current weather for a city.",
"parameters": {
"type": "object",
"properties": {
"city": {"type": "string", "description": "City name"}
},
"required": ["city"]
}
}]
response = client.responses.create(
model="gpt-oss-120b",
input=[{"role": "user", "content": "What's the weather in Berlin?"}],
tools=tools
)
# Check if model wants to call a function
for item in response.output:
if item.type == "function_call":
print(f"Function: {item.name}")
print(f"Arguments: {item.arguments}")
```
```bash
curl -X POST https://api.infercom.ai/v1/responses \
-H "Authorization: Bearer $INFERCOM_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-oss-120b",
"input": [{"role": "user", "content": "What is the weather in Berlin?"}],
"tools": [{
"type": "function",
"name": "get_weather",
"description": "Get current weather for a city",
"parameters": {
"type": "object",
"properties": {
"city": {"type": "string", "description": "City name"}
},
"required": ["city"]
}
}]
}'
```
### Step 2: Execute function and return result
```python
# Execute the function locally
def get_weather(city: str) -> dict:
# Your actual weather API call here
return {"city": city, "temperature": "18°C", "condition": "Cloudy"}
# Find the function call in the response
tool_call = next(item for item in response.output if item.type == "function_call")
args = json.loads(tool_call.arguments)
result = get_weather(args["city"])
# Send result back to the model
follow_up = client.responses.create(
model="gpt-oss-120b",
input=[
{"role": "user", "content": "What's the weather in Berlin?"},
tool_call, # Include the function call
{
"type": "function_call_output",
"call_id": tool_call.call_id,
"output": json.dumps(result)
}
],
tools=tools
)
print(follow_up.output_text) # "The weather in Berlin is 18°C and cloudy."
```
```bash
curl -X POST https://api.infercom.ai/v1/responses \
-H "Authorization: Bearer $INFERCOM_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-oss-120b",
"input": [
{"role": "user", "content": "What is the weather in Berlin?"},
{
"type": "function_call",
"id": "fc_123",
"call_id": "call_123",
"name": "get_weather",
"arguments": "{\"city\": \"Berlin\"}",
"status": "completed"
},
{
"type": "function_call_output",
"call_id": "call_123",
"output": "{\"temperature\": \"18°C\", \"condition\": \"Cloudy\"}"
}
],
"tools": [{
"type": "function",
"name": "get_weather",
"description": "Get current weather for a city",
"parameters": {
"type": "object",
"properties": {"city": {"type": "string"}},
"required": ["city"]
}
}]
}'
```
### Tool choice
Control when the model uses tools with `tool_choice`:
| Value | Behavior |
|-------|----------|
| `"auto"` | Model decides whether to call a function (default) |
| `"none"` | Model will not call any functions |
| `"required"` | Model must call at least one function |
| `{"type": "function", "name": "..."}` | Force a specific function |
## Structured output (JSON mode)
Request structured JSON output using the `text.format` parameter.
### JSON object mode
```python
response = client.responses.create(
model="gpt-oss-120b",
input="List 3 European capitals",
text={"format": {"type": "json_object"}}
)
import json
data = json.loads(response.output_text)
```
```bash
curl -X POST https://api.infercom.ai/v1/responses \
-H "Authorization: Bearer $INFERCOM_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-oss-120b",
"input": "List 3 European capitals as JSON",
"text": {"format": {"type": "json_object"}}
}'
```
### JSON schema mode
For guaranteed structure, provide a JSON schema:
```python
response = client.responses.create(
model="gpt-oss-120b",
input="Extract event details: SambaNova launch May 1, 2026 at 10am in San Francisco.",
text={
"format": {
"type": "json_schema",
"name": "event_extraction",
"schema": {
"type": "object",
"properties": {
"title": {"type": "string"},
"date": {"type": "string"},
"time": {"type": "string"},
"location": {"type": "string"}
},
"required": ["title", "date", "time", "location"]
}
}
}
)
import json
event = json.loads(response.output_text)
print(event)
# {"title": "SambaNova launch", "date": "May 1, 2026", "time": "10am", "location": "San Francisco"}
```
```bash
curl -X POST https://api.infercom.ai/v1/responses \
-H "Authorization: Bearer $INFERCOM_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-oss-120b",
"input": "List 3 colors",
"text": {
"format": {
"type": "json_schema",
"name": "colors",
"schema": {
"type": "object",
"properties": {
"colors": {"type": "array", "items": {"type": "string"}}
},
"required": ["colors"]
}
}
}
}'
```
## Reasoning
Reasoning-capable models expose their thinking process via `reasoning` output items. Control reasoning depth with `reasoning.effort`:
| Effort | Behavior |
|--------|----------|
| `"low"` | Faster, less depth |
| `"medium"` | Balanced (default) |
| `"high"` | Deeper reasoning, higher token cost |
`MiniMax-M3.1-Flash` also accepts `xhigh` and `max`, and defaults to `max`. See [Reasoning](/en/build/reasoning#reasoning_effort-on-minimax-m31-flash).
```python
response = client.responses.create(
model="gpt-oss-120b",
input="What is 15 * 23?",
reasoning={"effort": "high"}
)
# Access reasoning separately from the answer
for item in response.output:
if item.type == "reasoning":
print("Reasoning:", item.content[0].text)
elif item.type == "message":
print("Answer:", item.content[0].text)
```
```bash
curl -X POST https://api.infercom.ai/v1/responses \
-H "Authorization: Bearer $INFERCOM_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-oss-120b",
"input": "What is 15 * 23?",
"reasoning": {"effort": "high"}
}'
```
## Streaming
Enable streaming for real-time output with `stream: true`. The API emits Server-Sent Events:
```python
stream = client.responses.create(
model="gpt-oss-120b",
input="Write a short poem about speed.",
stream=True
)
for event in stream:
if event.type == "response.output_text.delta":
print(event.delta, end="", flush=True)
```
```bash
curl -X POST https://api.infercom.ai/v1/responses \
-H "Authorization: Bearer $INFERCOM_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-oss-120b",
"input": "Count from 1 to 5",
"stream": true
}'
```
### Streaming event types
| Event | Description |
|-------|-------------|
| `response.created` | Response initialized |
| `response.in_progress` | Generation started |
| `response.output_item.added` | New output item created |
| `response.content_part.added` | New content part added |
| `response.reasoning_text.delta` | Incremental reasoning chunk |
| `response.reasoning_text.done` | Reasoning complete |
| `response.output_text.delta` | Incremental output text |
| `response.output_text.done` | Output text complete |
| `response.function_call_arguments.delta` | Incremental function arguments |
| `response.function_call_arguments.done` | Function arguments complete |
| `response.content_part.done` | Content part finished |
| `response.output_item.done` | Output item completed |
| `response.completed` | Final event with usage stats |
## Request parameters
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `model` | string | Yes | Model ID (`gpt-oss-120b`, `gemma-4-31B-it`) |
| `input` | string \| array | Yes | Text input or conversation array |
| `instructions` | string | No | System message prepended to input |
| `stream` | boolean | No | Enable SSE streaming (default: false) |
| `max_output_tokens` | integer | No | Maximum tokens to generate |
| `temperature` | number | No | Randomness 0-2. [No default](/en/models/infercomcloud-models#if-you-omit-temperature) - omit it and most models decode greedily. |
| `top_p` | number | No | Nucleus sampling 0-1 |
| `top_k` | integer | No | Top-K sampling 1-100 |
| `tools` | array | No | Function tool definitions (max 128) |
| `tool_choice` | string \| object | No | Tool invocation control |
| `parallel_tool_calls` | boolean | No | Allow parallel tool calls (default: true) |
| `text.format` | object | No | Output format: `text`, `json_object`, `json_schema` |
| `reasoning.effort` | string | No | Reasoning depth: `low`, `medium`, `high`. `MiniMax-M3.1-Flash` also accepts `xhigh` and `max` |
## Response fields
| Field | Type | Description |
|-------|------|-------------|
| `id` | string | Unique response identifier |
| `object` | string | Always `"response"` |
| `status` | string | `completed`, `failed`, `in_progress`, `incomplete` |
| `model` | string | Model ID used |
| `output` | array | Output items (messages, reasoning, function calls) |
| `usage` | object | Token usage statistics |
| `error` | object | Error details when `status: "failed"` |
### Usage statistics
The `usage` object includes performance metrics:
```json
{
"input_tokens": 45,
"output_tokens": 120,
"total_tokens": 165,
"input_tokens_details": {"cached_tokens": 0},
"output_tokens_details": {"reasoning_tokens": 35},
"time_to_first_token": 0.084,
"total_latency": 0.459,
"output_tokens_per_sec": 261.4
}
```
## Responses API vs Chat Completions
| Feature | Responses API | Chat Completions |
|---------|---------------|------------------|
| Output structure | Typed items (message, reasoning, function_call) | Single message with content |
| Reasoning visibility | Separate `reasoning` items | Inline in content |
| Tool results | Structured `function_call_output` | `tool` role messages |
| Best for | Agentic workflows, coding agents | Conversational apps |
## Limitations
- **Stateless**: `previous_response_id` is not supported—supply full conversation history in `input[]`
- **Function tools only**: Built-in tools (web_search, code_interpreter) are not supported
- **Not implemented**: `frequency_penalty`, `presence_penalty`, `repetition_penalty`, `max_tool_calls`, `strict` mode. Do not send the three penalty parameters to this endpoint. `frequency_penalty` and `presence_penalty` return HTTP 400 for any value other than `0`. `repetition_penalty` returns HTTP 400 `unsupported_field` for any value. To control repetition, use `repetition_penalty` on `/v1/chat/completions`
## Next steps
- [Function Calling](/en/features/function-calling) - Detailed function calling guide for Chat Completions
- [Text Generation](/en/features/text-generation) - Chat Completions API guide
- [API Reference](/en/api-reference/overview) - Full endpoint documentation
# Implement Text Generation Features - Developer Guide
Source: https://docs.infercom.ai/en/features/text-generation
This document describes different aspects of text generation, including types of generation, model selection, creating prompts, and managing multi-turn conversations.
## Types of generations
You can use various methods to generate text, including non-streaming, streaming, and asynchronous completions.
### Simple generation (non-streaming)
Use the following code to perform text generation with the SambaNova SDK or OpenAI Python client in a non-streaming manner.
```python
from sambanova import SambaNova
client = SambaNova(
base_url="https://api.infercom.ai/v1",
api_key="your-infercom-api-key"
)
completion = client.chat.completions.create(
model="Meta-Llama-3.1-8B-Instruct",
messages = [
{"role": "system", "content": "Answer the question in a couple sentences."},
{"role": "user", "content": "Share a happy story with me"}
]
)
print(completion.choices[0].message.content)
```
```python
from openai import OpenAI
client = OpenAI(
base_url="https://api.infercom.ai/v1",
api_key="your-infercom-api-key"
)
completion = client.chat.completions.create(
model="Meta-Llama-3.1-8B-Instruct",
messages = [
{"role": "system", "content": "Answer the question in a couple sentences."},
{"role": "user", "content": "Share a happy story with me"}
]
)
print(completion.choices[0].message.content)
```
### Asynchronous generation (non-streaming)
For asynchronous completions, use the AsyncSambaNova or AsyncOpenAI Python client, as shown below.
```python
from sambanova import AsyncSambaNova
import asyncio
async def main():
client = AsyncSambaNova(
base_url="https://api.infercom.ai/v1",
api_key="your-infercom-api-key"
)
completion = await client.chat.completions.create(
model="Meta-Llama-3.1-8B-Instruct",
messages = [
{"role": "system", "content": "Answer the question in a couple sentences."},
{"role": "user", "content": "Share a happy story with me"}
]
)
print(completion.choices[0].message.content)
asyncio.run(main())
```
```python
from openai import AsyncOpenAI
import asyncio
async def main():
client = AsyncOpenAI(
base_url="https://api.infercom.ai/v1",
api_key="your-infercom-api-key"
)
completion = await client.chat.completions.create(
model="Meta-Llama-3.1-8B-Instruct",
messages = [
{"role": "system", "content": "Answer the question in a couple sentences."},
{"role": "user", "content": "Share a happy story with me"}
]
)
print(completion.choices[0].message.content)
asyncio.run(main())
```
### Streaming response
For real-time streaming completions, use the following approach with the SambaNova SDK or OpenAI client.
```python
from sambanova import SambaNova
client = SambaNova(
base_url="https://api.infercom.ai/v1",
api_key="your-infercom-api-key"
)
completion = client.chat.completions.create(
model="Meta-Llama-3.1-8B-Instruct",
messages = [
{"role": "system", "content": "Answer the question in a couple sentences."},
{"role": "user", "content": "Share a happy story with me"}
],
stream = True
)
for chunk in completion:
print(chunk.choices[0].delta.content, end="")
```
```python
from openai import OpenAI
client = OpenAI(
base_url="https://api.infercom.ai/v1",
api_key="your-infercom-api-key"
)
completion = client.chat.completions.create(
model="Meta-Llama-3.1-8B-Instruct",
messages = [
{"role": "system", "content": "Answer the question in a couple sentences."},
{"role": "user", "content": "Share a happy story with me"}
],
stream = True
)
for chunk in completion:
print(chunk.choices[0].delta.content, end="")
```
## Model selection
Models differ in their architecture, impacting their speed and response quality. Selecting a model depends on the factors shown below.
| **Factor** | **Consideration** |
| :-------------------- | :------------------------------------------------------------ |
| Task complexity | Larger models are better suited for complex tasks. |
| Accuracy requirements | Larger models generally offer higher accuracy. |
| Cost and resources | Larger models come with increased costs and resource demands. |
Experiment with various models to find the one that best fits your specific use case.
## Creating effective prompts
Prompt engineering is the practice of designing and refining prompts to optimize responses from large language models (LLMs). This process is iterative and requires experimentation to achieve the best possible outcomes.
### Building a prompt
A basic prompt can be as simple as a few words to elicit a response from the LLM. However, for more complex use cases, additional elements may be needed, as shown below.
| **Element** | **Description** |
| :----------------------- | :--------------------------------------------------------------------------------------------------- |
| Defining a persona | Assigning a specific role to the model (e.g., "You are a financial advisor"). |
| Providing context | Supplying background information to guide the model's response. |
| Specifying output format | Instructing the model to respond in a particular style (e.g., JSON, bullet points, structured text). |
| Describing a use case | Clarifying the goal of the interaction. |
### Advanced prompting techniques
To improve response quality and reasoning, more advanced techniques can be used.
| **Technique** | **Description** |
| :------------------------------- | :------------------------------------------------------------------------------ |
| In-context learning | Providing examples of desired outputs to guide the model. |
| Chain-of-Thought (CoT) prompting | Encouraging the model to articulate its reasoning before delivering a response. |
For more details about prompt engineering, see [A Systematic Survey of Prompt Engineering in Large Language Models: Techniques and Applications](https://arxiv.org/pdf/2402.07927).
### Messages and roles
In chat-based interactions, messages are represented as dictionaries with specific roles and content.
| **Element** | **Description** |
| :---------- | :------------------------------------ |
| `role` | Specifies who is sending the message. |
| `content` | Contains the message text. |
#### Common roles
Roles are typically categorized as `system`, `user`, or `assistant`.
| **Role** | **Description** |
| :---------- | :------------------------------------------ |
| `system` | Provides general instructions to the model. |
| `user` | Represents user input. |
| `assistant` | Contains the model's response. |
| `tool` | Contains a tool execution result. |
## Multi-turn conversation
To maintain context across multiple exchanges, messages in a conversational AI system are typically stored as a list of dictionaries. Each dictionary contains keys that specify the sender's role and the message content. This structure helps the system track context across multiple turns in a conversation.
Below is an example of how a multi-turn conversation is structured using the **Meta-Llama-3.1-8B-Instruct** model:
```python title="Structuring Multi-Turn Conversations in Meta-Llama-3.1-8B-Instruct using python"
completion = client.chat.completions.create(
model="Meta-Llama-3.1-8B-Instruct",
messages = [
{"role": "user", "content": "Hi! My name is Peter and I am 31 years old. What is 1+1?"},
{"role": "assistant", "content": "Nice to meet you, Peter. 1 + 1 is equal to 2"},
{"role": "user", "content": "What is my age?"}
],
stream = True
)
for chunk in completion:
print(chunk.choices[0].delta.content, end="")
```
After running the program, you should see an output similar to the following.
```python title="Example output"
You told me earlier, Peter. You're 31 years old.
```
By structuring conversations this way, the model can maintain context, recall prior user inputs, and provide more coherent responses.
### Considerations for long conversations
When engaging in long conversations with LLMs, certain factors such as token limits and memory constraints must be considered to ensure accuracy and coherence.
- **Token limits** - LLMs have a fixed context window, limiting the number of tokens they can process in a single request. If the input exceeds this limit, the system might truncate it, leading to incomplete or incoherent responses.
- **Memory constraints** - The model does not retain context beyond its input window. To preserve context, past messages should be re-included in prompts.
By structuring prompts effectively and managing conversation history, you can optimize interactions with LLMs for better accuracy and coherence.
### Reasoning models and token limits
For details on reasoning models, controlling thinking, and troubleshooting truncated output, see the [reasoning guide](/en/build/reasoning).
# Implement Vision and Multimodal Features - Developer Guide
Source: https://docs.infercom.ai/en/features/vision
Infercom provides access to vision-capable models on our EU sovereign infrastructure, allowing you to process both text and images with full data sovereignty. These models analyze images and generate context-aware text responses.
## Supported models
| Model | Context | Region | Notes |
|-------|---------|--------|-------|
| `gemma-4-31B-it` | 128K | EU | Google's Gemma 4 31B with vision capabilities |
| `MiniMax-M3.1-Flash` | 1M | Non-EU | [Global Model Catalog](/en/models/infercomcloud-models#global-model-catalog), processed outside the EU |
## Make a query with an image
On Infercom, the vision model request follows OpenAI's multimodal input format which accepts both text and image inputs in a structured payload. While the call is similar to [Text Generation](/en/features/text-generation), it differs by including an encoded image file, referenced via the `image_path` variable. A helper function is used to convert this image into a base64 string, allowing it to be passed alongside the text in the request.
Send each image as a base64 data URL in JPEG, PNG or WebP format, for example `data:image/jpeg;base64,...`. An https URL returns an error on every vision model. Other formats return an error on `gemma-4-31B-it`: see [Image URL or unsupported format](#image-url-or-unsupported-format).
1. **Step 1**
Make a new Python file and copy the code below.
```python
from sambanova import SambaNova
import base64
client = SambaNova(
base_url="https://api.infercom.ai/v1",
api_key="your-infercom-api-key",
)
# Helper function to encode the image
def encode_image(image_path):
with open(image_path, "rb") as image_file:
return base64.b64encode(image_file.read()).decode('utf-8')
# The path to your image
image_path = "sample.JPEG"
# The base64 string of the image
image_base64 = encode_image(image_path)
print(image_base64)
response = client.chat.completions.create(
model="gemma-4-31B-it",
messages=[
{
"role": "user",
"content": [
{"type": "text", "text": "What is happening in this image?"},
{"type": "image_url", "image_url": {"url": f"data:image/jpeg;base64,{image_base64}"}}
]
}
]
)
print(response.choices[0].message.content)
```
```python
from openai import OpenAI
import base64
client = OpenAI(
base_url="https://api.infercom.ai/v1",
api_key="your-infercom-api-key",
)
# Helper function to encode the image
def encode_image(image_path):
with open(image_path, "rb") as image_file:
return base64.b64encode(image_file.read()).decode('utf-8')
# The path to your image
image_path = "sample.JPEG"
# The base64 string of the image
image_base64 = encode_image(image_path)
print(image_base64)
response = client.chat.completions.create(
model="gemma-4-31B-it",
messages=[
{
"role": "user",
"content": [
{"type": "text", "text": "What is happening in this image?"},
{"type": "image_url", "image_url": {"url": f"data:image/jpeg;base64,{image_base64}"}}
]
}
]
)
print(response.choices[0].message.content)
```
2. **Step 2**
Use your Infercom API key from the [API keys and URLs](/en/get-started/api-keys-urls) page to replace the placeholder `"your-infercom-api-key"` in the construction of the client.
3. **Step 3**
Select an image and move it to a suitable path that you can specify in the lines.
```python
# The path to your image
image_path = "sample.JPEG"
```
4. **Step 4**
Verify the prompt to pair with the image in the `content` portion of the `user` prompt.
5. **Step 5**
Run the Python file to receive the text output.
## Tools and structured output with images
Vision requests support the same `tools`, `tool_choice` and `response_format` options as text-only requests. The constraint is applied during generation, so a forced tool call or a strict JSON schema is honoured on a request that carries an image.
| Option | Behaviour on a request with an image |
| :----- | :----------------------------------- |
| `tool_choice` with a function name | The model returns that tool call. `finish_reason` is `tool_calls` |
| `tool_choice: "none"` | The model returns plain text. `finish_reason` is `stop` |
| `response_format: {"type": "json_schema", ...}` | The model returns JSON that matches the schema |
```python
from openai import OpenAI
import base64
client = OpenAI(
base_url="https://api.infercom.ai/v1",
api_key="your-infercom-api-key",
)
with open("sample.JPEG", "rb") as image_file:
image_base64 = base64.b64encode(image_file.read()).decode("utf-8")
tools = [{
"type": "function",
"function": {
"name": "report_colors",
"parameters": {
"type": "object",
"properties": {"colors": {"type": "array", "items": {"type": "string"}}},
"required": ["colors"],
},
},
}]
response = client.chat.completions.create(
model="gemma-4-31B-it",
messages=[
{
"role": "user",
"content": [
{"type": "text", "text": "Which colors appear in this image?"},
{"type": "image_url", "image_url": {"url": f"data:image/jpeg;base64,{image_base64}"}},
],
}
],
tools=tools,
tool_choice={"type": "function", "function": {"name": "report_colors"}},
max_tokens=200,
temperature=1.0,
)
print(response.choices[0].message.tool_calls[0].function.arguments)
```
```bash
curl -s "https://api.infercom.ai/v1/chat/completions" \
-H "Authorization: Bearer $INFERCOM_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gemma-4-31B-it",
"messages": [{"role": "user", "content": [
{"type": "text", "text": "Which colors appear in this image?"},
{"type": "image_url", "image_url": {"url": "data:image/jpeg;base64,"}}
]}],
"response_format": {
"type": "json_schema",
"json_schema": {
"name": "colors",
"strict": true,
"schema": {
"type": "object",
"properties": {"colors": {"type": "array", "items": {"type": "string"}}},
"required": ["colors"],
"additionalProperties": false
}
}
},
"max_tokens": 200,
"temperature": 1.0
}'
```
See [Function calling and JSON mode](/en/features/function-calling) for the full tool-calling workflow.
## Image token cost
This section applies to `gemma-4-31B-it`. Other vision models use other image budgets.
`gemma-4-31B-it` uses the standard Gemma 4 image processing with the default budget of 280 visual tokens. The processor scales each image to fit this budget and keeps the aspect ratio. Each image costs its visual tokens plus 2 tokens that mark the start and the end of the image. A square image costs 258 prompt tokens (256 + 2) at any size. Other aspect ratios cost up to 282. `usage.prompt_tokens` shows the exact count.
Gemma 4 also defines budgets from 70 to 1120 tokens ([Gemma 4 vision documentation](https://ai.google.dev/gemma/docs/capabilities/vision)). The API uses the default budget only: `detail` and `max_soft_tokens` have no effect. For fine detail, for example small text, split a large image into parts and send each part as its own image. Each part gets its own budget of 280 tokens.
## Errors
### Malformed image data
If the API cannot decode your image, it returns HTTP 400. This is a permanent error. Do not retry it. Check that the base64 string is complete and that the MIME type in the `data:` URL matches the file.
### Image URL or unsupported format
On `gemma-4-31B-it`, an https URL, or a data URL in a format other than JPEG, PNG or WebP (for example GIF), returns HTTP 500. Do not retry it. Send the image as a base64 data URL.
```json
{
"error": "`image_url` must start with 'data:image/;base64,'",
"error_code": null,
"error_param": null,
"error_type": "Error"
}
```
On `MiniMax-M3.1-Flash`, an https URL returns HTTP 400 with `error_type` `invalid_request_error`.
### Image tokens count towards the context limit
On `gemma-4-31B-it`, each image counts with up to 282 tokens toward the 128K context limit. A request over the limit returns a `context_length_exceeded` error.
# Manage API Keys and URLs
Source: https://docs.infercom.ai/en/get-started/api-keys-urls
If you want to use [Infercom Inference Service](https://infercom.ai), getting your development project started with Infercom technology is easy - all you need is a Infercom API key and a URL.
Refer to the section below based on the product you plan to use.
## Infercom Inference Service
To generate an API key, go to the [API section of the Infercom Inference Service portal](https://cloud.infercom.ai/apis). When generating API keys, be sure to save them securely, as they can't be viewed again.
API endpoints:
- Base URL (to be used with the OpenAI client, for example):
```
https://api.infercom.ai/v1
```
- Chat completion endpoint (to be used with a CURL command, for example):
```
https://api.infercom.ai/v1/chat/completions
```
# Infercom Developer Guide Overview
Source: https://docs.infercom.ai/en/get-started/overview
The Infercom developer guide is intended for users [Infercom Inference Service](https://infercom.ai/).
This guide covers the Inference API. For capacity reserved for you, see [Dedicated capacity](/en/dedicated/overview).
Use [OpenAI](/en/features/openai-compatibility) or [Anthropic](/en/features/anthropic-compatibility) SDKs to quickly request our models.
# Infercom Quickstart Guide for Developers
Source: https://docs.infercom.ai/en/get-started/quickstart
Get started using the Infercom API in just a few minutes.
1. **Get your API key.**
To generate an API key, go to the [API keys and URLs](/en/get-started/api-keys-urls) page. When generating API keys, be sure to save them securely, as they can’t be viewed again.
2. **Pick a model.**
View the available models and details on the [Infercom Inference Service models](/en/models/infercomcloud-models) page.
3. **Make an API request.**
You can make an inference request in multiple ways. See two examples below:
- **SambaNova SDK** - Use Javascript or Python for a more flexible integration.
- **OpenAI client library** – Use Javascript or Python for a more flexible integration.
- **CURL command** – Send a request directly from the command line.
## SambaNova SDK
To get started, choose your preferred programming language. Next, open a terminal and run the command to install the SambaNova SDK.
```javascript
//ensure you have Node.js installed.
npm install sambanova
```
```python
# make sure you have Python3 and pip installed
pip install sambanova
```
Next, copy the following code into a new file.
```javascript
import SambaNova from "sambanova";
const client = new SambaNova({
baseURL: "https://api.infercom.ai/v1",
apiKey: "your-infercom-api-key",
});
const chatCompletion = await client.chat.completions.create({
messages: [
{ role: "system", content: "Answer the question in a couple sentences." },
{ role: "user", content: "Share a happy story with me" },
],
model: "gpt-oss-120b",
});
console.log(chatCompletion.choices[0].message.content);
```
```python
from sambanova import SambaNova
client = SambaNova(
base_url="https://api.infercom.ai/v1",
api_key="your-infercom-api-key"
)
completion = client.chat.completions.create(
model="gpt-oss-120b",
messages = [
{"role": "system", "content": "Answer the question in a couple sentences."},
{"role": "user", "content": "Share a happy story with me"}
]
)
print(completion.choices[0].message.content)
```
After copying the code into the file, replace the placeholder `"your-infercom-api-key"` with your actual API key. Then, run the file in a terminal using the command shown below.
```javascript
node hello-world.js
```
```python
python hello_world.py
```
After running the program, you should see output similar to the example shown below.
```
Here’s a happy story: One day, a little girl named Sophie found a lost puppy in her neighborhood and decided to take it home to care for it. As she nursed the puppy back to health, she named it Max and the two became inseparable best friends, going on adventures and playing together every day.
```
## OpenAI client library
To get started, select your preferred programming language. Then, open a terminal window and run the command to install the OpenAI library.
```javascript
//ensure you have Node.js installed.
npm install openai
```
```python
# make sure you have Python3 and pip installed
pip install openai
```
Next, copy the following code into a new file.
```javascript
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.infercom.ai/v1",
apiKey: "your-infercom-api-key",
});
const chatCompletion = await client.chat.completions.create({
messages: [
{ role: "system", content: "Answer the question in a couple sentences." },
{ role: "user", content: "Share a happy story with me" },
],
model: "gpt-oss-120b",
});
console.log(chatCompletion.choices[0].message.content);
```
```python
from openai import OpenAI
client = OpenAI(
base_url="https://api.infercom.ai/v1",
api_key="your-infercom-api-key"
)
completion = client.chat.completions.create(
model="gpt-oss-120b",
messages = [
{"role": "system", "content": "Answer the question in a couple sentences."},
{"role": "user", "content": "Share a happy story with me"}
]
)
print(completion.choices[0].message.content)
```
Once copied into the file, replace the placeholder `"your-infercom-api-key"` with your API key. Then run the file with the command below in a terminal window.
```javascript
node hello-world.js
```
```python
python hello_world.py
```
After you run the program, you should now see an output like similar to the one below.
```
Here’s a happy story: One day, a little girl named Sophie found a lost puppy in her neighborhood and decided to take it home to care for it. As she nursed the puppy back to health, she named it Max and the two became inseparable best friends, going on adventures and playing together every day.
```
## CURL command
In a terminal window, run the CURL command to make your first request to the API.
```sh
export API_KEY="your-infercom-api-key"
export URL="https://api.infercom.ai/v1/chat/completions"
curl -H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"messages": [
{"role": "system", "content": "Answer the question in a couple sentences."},
{"role": "user", "content": "Share a happy story with me"}
],
"stop": ["<|eot_id|>"],
"model": "gpt-oss-120b",
"stream": true, "stream_options": {"include_usage": true}
}' \
-X POST $URL
```
## Next Steps
Now that you can make requests to a model, great potential of building AI-powered applications await. Get inspired of what to build by exploring our [AI Starter Kits](/en/build/ai-starter-kits), a collection of open-source Python projects.
# Infercom Model Deprecations
Source: https://docs.infercom.ai/en/models/deprecations
Infercom regularly updates our products with new open-source models and consequently retires those that have fallen in market relevance. This document outlines our deprecation process, provides guidance on migration, and maintains a historical record of deprecated models with their recommended alternatives.
## Infercom Inference Service model deprecation process
### Notifications
- **Production models**: Production models will receive a deprecation notice of two to three weeks at a minimum, depending on usage patterns and the availability of newer versions.
- **Preview models**: Preview models may graduate to **Production** based on popularity and usage or be deprecated.
### Communication channels
All notifications will be delivered through at least one of the communication channels listed below:
- **Email**: Users of models scheduled for deprecation will be notified via email. The email will provide details about the deprecation timeline and available alternative models, including recommended replacements.
- **Documentation**: Model deprecation changes will be recorded on this documentation page, including the deprecation date and recommended replacement models.
- **Infercom Inference Service Playground**: Models scheduled for deprecation will be clearly labeled in the Infercom Inference Service Playground to inform users of their upcoming retirement.
### Model migration options
When a model is scheduled for deprecation, users should evaluate and select either the recommended replacement model or another option from our cloud offerings that best fits your application's requirements.
### Model migration steps
To ensure a smooth transition from a deprecated model to a supported alternative, please follow the steps below:
1. **Deprecation notice**
Be attentive to email notifications and Infercom Inference Service platform notifications regarding model deprecations.
2. **Evaluate alternatives**
Review our documentation to identify and select a suitable replacement model from our offerings.
3. **Implement and test**
Integrate your chosen model into your application, conduct necessary testing to ensure compatibility, and deploy your model into production. When migrating to new models, please note that you may need to adjust your prompts to optimize performance.
4. **Complete your migration**
To avoid service disruptions, finalize the transition by fully migrating your workload and application to your selected alternative model before the scheduled deprecation date.
## Upcoming deprecations
| **Model ID** | **Deprecation date** | **Replacement models** |
| :---------------------------- | :------------------- | :---------------------------------------------------------------- |
| `Meta-Llama-3.3-70B-Instruct` | November 17, 2026 | `gemma-4-31B-it` (EU-hosted) or `gpt-oss-120b` (EU-hosted) |
Our support team can help you with the migration: [support@infercom.ai](mailto:support@infercom.ai).
**Recommended migration paths**:
- **gpt-oss-120b** - For reasoning, function calling and agentic workflows. EU-hosted, 128k context.
- **gemma-4-31B-it** - For general workloads and image input. Answers without reasoning by default, like `Meta-Llama-3.3-70B-Instruct`. EU-hosted, 128k context.
**Migration guidance**:
- All replacement models are live now. Change the `model` parameter in your requests before the cutover.
- `Meta-Llama-3.3-70B-Instruct` has a 128k context window, the same as `gpt-oss-120b` and `gemma-4-31B-it`.
---
## Infercom Inference Service model deprecation record
| **Model ID** | **Deprecation date** | **Replacement model** |
| :----------------------------------- | :------------------- | :-------------------- |
| `DeepSeek-V3.1` | November 3, 2026 | `gpt-oss-120b` (EU-hosted) or `MiniMax-M3` via Global Model Catalog |
| `DeepSeek-V3.2` | November 3, 2026 | `gpt-oss-120b` (EU-hosted) or `MiniMax-M3` via Global Model Catalog |
| `MiniMax-M2.7` | September 30, 2026 | `gpt-oss-120b` or `gemma-4-31B-it` (EU-hosted, 128k context). `MiniMax-M3` via Global Model Catalog |
| `MiniMax-M2.5` | July 16, 2026 | `MiniMax-M2.7` (192k context) or `gemma-4-31B-it` (vision-capable) |
| `gemma-3-12b-it` | June 18, 2026 | `gemma-4-31B-it` (EU-hosted, vision-capable) |
| `Qwen3-32B` | April 3, 2026 | `Meta-Llama-3.3-70B-Instruct` or `DeepSeek-V3.2` via Global Model Catalog |
| `Qwen3-235B` | April 3, 2026 | `Meta-Llama-3.3-70B-Instruct` or `DeepSeek-V3.2` via Global Model Catalog |
| `DeepSeek-R1-0528` | April 3, 2026 | `DeepSeek-V3.2` via Global Model Catalog |
| `DeepSeek-R1-Distill-Llama-70B` | April 3, 2026 | `Meta-Llama-3.3-70B-Instruct` via Global Model Catalog |
| `DeepSeek-V3-0324` | April 3, 2026 | `DeepSeek-V3.2` via Global Model Catalog |
| `DeepSeek-V3.1-Terminus` | April 3, 2026 | `DeepSeek-V3.1` (EU-hosted) or `DeepSeek-V3.2` (Global) |
| `Llama-4-Maverick-17B-128E-Instruct` | April 3, 2026 | `Meta-Llama-3.3-70B-Instruct` via Global Model Catalog |
| `Meta-Llama-3.1-8B-Instruct` | April 3, 2026 | `Meta-Llama-3.3-70B-Instruct` via Global Model Catalog |
| `Meta-Llama-3.3-70B-Instruct` | March 12, 2026 | `MiniMax-M2.5` (EU-hosted replacement). Llama-3.3-70B remains available via Global Model Catalog. |
| `DeepSeek-V3-0324-cb` | January 23, 2026 | `DeepSeek-V3.1` |
# Infercom Inference Service Models Overview and Specifications
Source: https://docs.infercom.ai/en/models/infercomcloud-models
The Infercom Inference Service provides access to a broad selection of AI models through the **Global Model Catalog**. Models are available in two categories: **EU-hosted** models running on Infercom's sovereign infrastructure in Germany, and additional models available via global infrastructure.
## EU-hosted models
The following models run on Infercom's EU infrastructure in Germany. For these models, all data processing happens entirely within the EU — no data leaves EU jurisdiction, with full GDPR compliance and no US CLOUD Act exposure.
### Text generation models
| **Developer** | **Model ID** | **Context length** | **Capabilities** | **Region** | **HF Link** |
| :------------ | :---------------------------- | :----------------- | :--------------- | :--------- | :--------------------------------------------------------------------- |
| **OpenAI** | `gpt-oss-120b` | 128k tokens | Text, Reasoning | EU | [Model card](https://huggingface.co/openai/gpt-oss-120b) |
| **Google** | `gemma-4-31B-it` | 128k tokens | Text, Vision | EU | [Model card](https://huggingface.co/google/gemma-4-31b-it) |
### Embedding model
| **Developer** | **Model ID** | **Context length** | **Capabilities** | **Region** | **HF Link** |
| :------------ | :---------------------------- | :----------------- | :--------------- | :--------- | :--------------------------------------------------------------------- |
| **Mistral** | `E5-Mistral-7B-Instruct` | 4k tokens | Embeddings | EU | [Model card](https://huggingface.co/intfloat/e5-mistral-7b-instruct) |
### Audio model
| **Developer** | **Model ID** | **Max audio length** | **Capabilities** | **Region** | **HF Link** |
| :------------ | :---------------------------- | :------------------- | :------------------------- | :--------- | :--------------------------------------------------------------------- |
| **OpenAI** | `Whisper-Large-v3` | 25 MB | Transcription, Translation | EU | [Model card](https://huggingface.co/openai/whisper-large-v3) |
## Global Model Catalog
In addition to EU-hosted models, the Infercom Inference Service provides access to a broader selection of models through the Global Model Catalog. Models not hosted in our EU datacenters are served via global infrastructure. You can always check a model's hosting region via the API or the Playground.
| **Developer** | **Model ID** | **Context length** | **Region** | **Capabilities** | **HF Link** |
| :------------ | :------------------------------------ | :----------------- | :--------- | :--------------- | :------------------------------------------------------------------------------------ |
| **Meta** | `Meta-Llama-3.3-70B-Instruct` - [Deprecated November 17, 2026](/en/models/deprecations#upcoming-deprecations) | 128k tokens | Non-EU | Text | [Model card](https://huggingface.co/meta-llama/Llama-3.3-70B-Instruct) |
| **MiniMax** | `MiniMax-M3.1-Flash` | 1M tokens | Non-EU | Text, Vision, Reasoning | [Model card](https://huggingface.co/MiniMaxAI/MiniMax-M3.1-Flash) |
The previous model ID `MiniMax-M3` still works as an alias for `MiniMax-M3.1-Flash`. `/v1/models` lists only `MiniMax-M3.1-Flash`. Use `MiniMax-M3.1-Flash` in new code.
`Meta-Llama-3.3-70B-Instruct` will be deprecated on November 17, 2026. See [Model deprecations](/en/models/deprecations#upcoming-deprecations).
Our provider lists `MiniMax-M3.1-Flash` as a preview model: it has limited capacity and can be removed at short notice. Do not build production workloads on it. It accepts text and images. See [Vision](/en/features/vision).
See [Identifying model regions](#identifying-model-regions) below for how to check where each model runs.
## Recommended sampling parameters
Sampling parameters are model-specific. Use the values the model's publisher recommends rather than a single setting across all models. The table below reproduces each publisher's own recommendation, with a link to the source.
| **Model ID** | **temperature** | **top_p** | **top_k** | **Publisher recommendation** |
| :---------------------------- | :-------------- | :-------- | :-------- | :------------------------------------------------------------------------------------ |
| `gpt-oss-120b` | 1.0 | 1.0 | - | [openai/gpt-oss](https://github.com/openai/gpt-oss) |
| `gemma-4-31B-it` | 1.0 | 0.95 | 64 | [Model card](https://huggingface.co/google/gemma-4-31b-it) |
| `MiniMax-M3.1-Flash` | 1.0 | 0.95 | - | [Model card](https://huggingface.co/MiniMaxAI/MiniMax-M3.1-Flash) |
| `Meta-Llama-3.3-70B-Instruct` | - | - | - | None published |
A dash means the publisher does not publish a value for that parameter. Where no recommendation exists, start at `temperature` 1.0 and tune for your own workload.
The Infercom API accepts a `temperature` between 0 and 2. `temperature=1.0` does not mean "maximum randomness" - it means the model's probability distribution is used exactly as trained. Values below 1.0 sharpen it, values above 1.0 flatten it. Adjust `temperature`, `top_p`, or `top_k`, but generally not more than one of them at a time.
### If you omit `temperature`
The Infercom API applies no service-wide default. What you get depends on the model.
| **Model ID** | **Behaviour when `temperature` is omitted** |
| :---------------------------- | :------------------------------------------------ |
| `gemma-4-31B-it` | Greedy decoding. Identical to `temperature` 0. |
| `gpt-oss-120b` | Greedy decoding. Identical to `temperature` 0. |
| `Meta-Llama-3.3-70B-Instruct` | Greedy decoding. |
| `MiniMax-M3.1-Flash` | Greedy decoding. |
Greedy decoding means the model always takes its highest-probability token. It is a valid choice for reproducible output. It is also the setting most likely to trigger the repetition loop described below.
`/v1/responses` and `/v1/messages` behave the same way. Set `temperature` on every request.
### Defaults for the other sampling parameters
When you omit a sampling parameter, the platform applies the value below. These hold for every model.
| **Parameter** | **Applied when omitted** | **Effect** |
| :------------------- | :----------------------- | :--------- |
| `temperature` | 0.0 | Any effective value below 0.001 is clipped, which forces greedy decoding |
| `top_p` | 1.0 | Unrestricted |
| `top_k` | 1048576 | Effectively unrestricted. This is a sentinel, not a vocabulary size - `gemma-4-31B-it` reports a vocabulary of 262,144 |
| `repetition_penalty` | 1.0 | No penalty |
### How `top_k` interacts with `temperature`
The request below asks for sampling across 40 candidate tokens. It returns argmax instead, because `temperature` is absent:
```json
{
"model": "gemma-4-31B-it",
"messages": [{"role": "user", "content": "Write one sentence about the sea."}],
"top_k": 40
}
```
On `gemma-4-31B-it`, with an identical prompt:
| Request | Result |
| :------ | :----- |
| `top_k: 40`, `temperature` omitted | Greedy. The same text on every request, `top_k` ignored |
| `top_k: 40`, `temperature: 1.0` | Sampling. The response varies on every request |
| No `top_k`, `temperature` omitted | Greedy. Byte-identical to the first row |
#### Accepted range for `top_k`
Send `top_k` as **1 or greater**. Unlike some other providers, `-1` and `0` are not accepted as a way to disable it.
| **Value sent** | `/v1/chat/completions` and `/v1/messages` | `/v1/responses` |
| :------------- | :---------------------------------------- | :-------------- |
| `-1` | HTTP 400 `Invalid value for 'top_k': -1 is less than the minimum of 1.` | HTTP 200. Not validated |
| `0` | HTTP 400 `Invalid value for 'top_k': 0 is less than the minimum of 1.` | HTTP 200. Not validated |
| `1` | HTTP 200 | HTTP 200 |
| `1048576` | HTTP 200 | HTTP 200 |
| `2000000` | HTTP 200. No upper bound is enforced | HTTP 200 |
To leave `top_k` unrestricted, omit the parameter or send a value larger than the model's vocabulary.
## Identifying model regions
You can identify where a model is hosted through the API or the Playground.
### Via the API
The `/v1/models` endpoint includes an `sn_metadata` object for each model. Use the `region` field to determine where a model is hosted: `"EU"` for sovereign models on Infercom's EU infrastructure, or a non-EU region (e.g. `"US"`, `"JP"`) for models on global infrastructure.
Use the `?verbose=true` query parameter to retrieve detailed model metadata including sovereignty information:
```bash
curl -s "https://api.infercom.ai/v1/models?verbose=true" \
-H "Authorization: Bearer $INFERCOM_API_KEY" | \
jq '.data[] | {id, region: .sn_metadata.region}'
```
```python
from openai import OpenAI
import requests
# Using requests for metadata inspection
headers = {"Authorization": f"Bearer {api_key}"}
response = requests.get(
"https://api.infercom.ai/v1/models?verbose=true",
headers=headers
)
for model in response.json()["data"]:
region = model.get("sn_metadata", {}).get("region", "Global")
print(f"{model['id']}: {region}")
```
**Example response for an EU-hosted model:**
```json
{
"id": "gpt-oss-120b",
"object": "model",
"sn_metadata": {
"is_external": false,
"region": "EU"
}
}
```
**Example response for a globally-routed model:**
```json
{
"id": "MiniMax-M3.1-Flash",
"object": "model",
"sn_metadata": {
"is_external": true,
"region": "JP"
}
}
```
### Via the Playground
In the [Infercom Playground](https://cloud.infercom.ai), region flags are displayed next to each model name, letting you see at a glance where each model runs.
## Data sovereignty
For EU-hosted models, Infercom provides:
- **EU data residency** — inference runs in our EU datacenters
- **GDPR compliance** — full compliance with EU data protection regulations
- **No US CLOUD Act exposure** — your inference data is not subject to US jurisdiction
- **AI Act readiness** — designed for compliance with the EU AI Act
# Infercom Model Rate Limits
Source: https://docs.infercom.ai/en/models/rate-limits
These tiers apply to the Inference API. Dedicated deployments have limits agreed per customer. See [Dedicated capacity](/en/dedicated/overview).
Rate limits are a mechanism to help manage Infercom API usage to provide stable performance and reliable service. They limit how many times each user can call the Infercom API within a given interval.
Rate limits are measured in:
- RPM: Requests per minute
- RPD: Requests per day
Basics
- A **request** is defined by a call to our API
- You can hit either limit type (RPM or RPD) depending on which one you reach first
- You will be notified in every request response what the status of your rate limits are ([see rate limit response headers for more information](#rate-limit-response-headers))
- If you hit a rate limit, you will be sent an error message in your response ([see API error codes](/en/api-reference/using-the-api/api-error-codes))
- Check the [Infercom Status Page](https://status.infercom.ai) for real-time platform and model availability
## Infercom Inference Service rate limit tiers
There are a few different rate limit tier offerings we provide:
- **Free Tier**: Applied when there is no payment method linked with your account
- **Developer Tier**: Applied when a payment method is linked with your account
- **Enterprise Tier**: Higher limits for production workloads
## Rate limit response headers
These headers are found in every request response and give information about the current status of rate limit usage.
**RPM (Requests per minute):**
- `x-ratelimit-limit-requests`
- The maximum number of requests allowed per minute.
- `x-ratelimit-remaining-requests`
- The number of requests remaining in the current minute before hitting the rate limit.
- `x-ratelimit-reset-requests`
- Time in epoch time until the per-minute request quota resets.
**RPD (Requests per day):**
- `x-ratelimit-limit-requests-day`
- The maximum number of requests allowed per day.
- `x-ratelimit-remaining-requests-day`
- The number of requests remaining in the current day before hitting the rate limit.
- `x-ratelimit-reset-requests-day`
- Time in epoch time until the per-day request quota resets.
# Infercom Release Notes and Product Updates
Source: https://docs.infercom.ai/en/release-notes/overview
## **November 9, 2026**
**Model ID `MiniMax-M3.1-Flash`**
- `MiniMax-M3.1-Flash` is now the model ID in `/v1/models` and in all examples. It is processed outside the EU. See [Inference API models](/en/models/infercomcloud-models#global-model-catalog)
- `MiniMax-M3` still works as an alias. Use `MiniMax-M3.1-Flash` in new code
## **November 4, 2026**
**`DeepSeek-V3.1` and `DeepSeek-V3.2` removed**
- Requests to these models return HTTP 410 with the error code `model_deprecated`. Use `gpt-oss-120b` (EU-hosted) or `MiniMax-M3` (processed outside the EU). See [Model deprecations](/en/models/deprecations#infercom-inference-service-model-deprecation-record)
- `Meta-Llama-3.3-70B-Instruct` will be deprecated on **November 17, 2026**. Migrate to `gemma-4-31B-it` or `gpt-oss-120b`. See [Model deprecations](/en/models/deprecations#upcoming-deprecations)
**New: Dedicated Capacity documentation**
- Inference capacity reserved for you in Munich: you choose the models, run several in one bundle and serve your own fine-tuned checkpoints. See [Dedicated Capacity](/en/dedicated/overview)
- New pages: [Supported models](/en/dedicated/models), [Connect to your endpoint](/en/dedicated/connect), [Custom checkpoints](/en/dedicated/custom-checkpoints) and [Questions](/en/dedicated/faq)
- The Inference API catalog is now labelled "Inference API models" in the sidebar
## **November 2, 2026**
**Upcoming deprecation: DeepSeek-V3.1, DeepSeek-V3.2 and Meta-Llama-3.3-70B-Instruct**
- `DeepSeek-V3.1` and `DeepSeek-V3.2` will be deprecated on **November 3, 2026**, `Meta-Llama-3.3-70B-Instruct` on **November 17, 2026**. After the cutover, requests to them return an error
- Replacements: `gpt-oss-120b` or `gemma-4-31B-it` (EU-hosted, 128k context), or `MiniMax-M3` above 128k context (1M, processed outside the EU). See [Model deprecations](/en/models/deprecations#upcoming-deprecations)
**`MiniMax-M3` runs MiniMax-M3.1-Flash**
- Keep sending the model ID `MiniMax-M3`. The `model` field of a chat completion reports `MiniMax-M3.1-Flash`, which is not a valid model ID
- `reasoning_effort` accepts `low`, `medium`, `high`, `xhigh` and `max`. The default is `max`: set a lower value for short answers and JSON output. `enable_thinking: false` returns HTTP 400. See [Reasoning](/en/build/reasoning#reasoning_effort-on-minimax-m31-flash)
- Accepts base64 images and reports `usage.completion_tokens_details.reasoning_tokens`
**Documentation corrections**
- Anthropic Messages API: `gemma-4-31B-it` supports tool use and accepts images as base64 `image` blocks, not as URLs. `gpt-oss-120b` and `MiniMax-M3` return a `thinking` block before the `text` block: select the text block by its type. On `gpt-oss-120b`, `budget_tokens` selects the reasoning level. See [Anthropic compatibility](/en/features/anthropic-compatibility#reasoning-thinking-blocks)
- Vision: send images as base64 data URLs. An https URL returns an error. On `gemma-4-31B-it`, an image costs at most 282 prompt tokens, 258 if square. See [Vision](/en/features/vision#image-token-cost)
- Function calling: on `gpt-oss-120b`, keep the default `reasoning_effort` (`medium`). `high` does not choose tools better and returns the tool call later. See [Function calling](/en/features/function-calling)
## **October 19, 2026**
**Platform update: stricter request validation is live**
- A platform update went live on October 17, 2026. Requests that were accepted and ignored before now return HTTP 400
- `frequency_penalty` and `presence_penalty` return HTTP 400 for any value other than `0`, on `/v1/chat/completions` and `/v1/responses`
- `repetition_penalty` returns HTTP 400 on `/v1/responses` and `/v1/messages`. It still works on `/v1/chat/completions`
- **Action: remove non-zero `frequency_penalty` and `presence_penalty` from your requests, and remove `repetition_penalty` from requests to `/v1/responses` and `/v1/messages`.** See [OpenAI compatibility](/en/features/openai-compatibility#rejected-unless-0)
**Audio: all response formats work**
- `verbose_json` returns segments with timestamps. `srt` and `vtt` return subtitles
- `response_format=json` returns a `usage` object with the duration of the processed audio, in seconds
- `timestamp_granularities[]=segment` is supported. `word` returns HTTP 400. See [Audio](/en/features/audio)
**Other API changes**
- `logit_bias` returns HTTP 400 on `gemma-4-31B-it` (before: ignored) and on `DeepSeek-V3.1` and `DeepSeek-V3.2` (before: HTTP 500). On `Meta-Llama-3.3-70B-Instruct` it returns HTTP 400 or HTTP 500, varying between identical requests. Send `logit_bias` only to `gpt-oss-120b`
- `gemma-4-31B-it` now honours a forced `tool_choice`. See [Function calling](/en/features/function-calling)
- `seed` now gives reproducible output on `gemma-4-31B-it`
- A retired model now returns a JSON HTTP 404 on `/v1/chat/completions`, `/v1/responses` and `/v1/messages`. This corrects the October 1 entry, which said HTTP 410. See [API error codes](/en/api-reference/using-the-api/api-error-codes)
- Embeddings input over 4,096 tokens returns HTTP 400 `context_length_exceeded` instead of HTTP 500
**Documentation corrections**
- The `pricing` fields in `/v1/models` are in EUR, excl. VAT, not USD
- `strict` in a `json_schema` is accepted and has no effect, on every model
- On `DeepSeek-V3.1`, `DeepSeek-V3.2` and `Meta-Llama-3.3-70B-Instruct`, a `json_schema` is not reliably enforced. Validate the output. See [Function calling](/en/features/function-calling)
## **October 1, 2026**
**Deprecation: MiniMax-M2.7 retired**
- `MiniMax-M2.7` was retired on **September 30, 2026 at 6:00 PM CEST**. Requests to `MiniMax-M2.7` now return HTTP 410
- Migrate to [`gpt-oss-120b`](/en/models/infercomcloud-models) or [`gemma-4-31B-it`](/en/models/infercomcloud-models), both EU-hosted
- [Model overview](/en/models/infercomcloud-models), [rate limits](/en/models/rate-limits), [reasoning](/en/build/reasoning), [function calling](/en/features/function-calling), [OpenAI compatibility](/en/features/openai-compatibility) and [deprecations](/en/models/deprecations) updated
**Global Model Catalog: MiniMax-M3 added**
- `MiniMax-M3` is available through the [Global Model Catalog](/en/models/infercomcloud-models#global-model-catalog) with a 1M token context window. It is processed outside the EU
- Our provider lists it as a preview model with limited capacity. It accepts text only
- `logit_bias` and any `repetition_penalty` other than 1.0 return an error on this model. See [OpenAI compatibility](/en/features/openai-compatibility)
## **September 30, 2026**
**Upcoming Deprecation: MiniMax-M2.7**
- `MiniMax-M2.7` will be deprecated on **September 30, 2026 at 6:00 PM CEST**. After the cutover, requests to `MiniMax-M2.7` return an error
- Recommended replacements: [`gpt-oss-120b`](/en/models/infercomcloud-models) (reasoning, function calling, 128k context) or [`gemma-4-31B-it`](/en/models/infercomcloud-models) (vision-capable, 128k context). Both are EU-hosted and live now
- See [deprecations](/en/models/deprecations) for migration guidance, or contact [support@infercom.ai](mailto:support@infercom.ai)
**Documentation: agentic coding guides withdrawn**
- The agentic coding guides are withdrawn for now. Their URLs redirect to [OpenAI compatibility](/en/features/openai-compatibility), [Responses API](/en/features/responses-api) or [Anthropic compatibility](/en/features/anthropic-compatibility)
- Code examples across the docs now use `gpt-oss-120b`
## **September 18, 2026**
**Correction: `logit_bias` works on `gpt-oss-120b` only**
- On September 11 we listed `logit_bias` as working on `DeepSeek-V3.2` and `Meta-Llama-3.3-70B-Instruct`. That was wrong. Our test counted failed requests as changed output
- **`logit_bias` returns HTTP 500 on `DeepSeek-V3.1`, `DeepSeek-V3.2` and `Meta-Llama-3.3-70B-Instruct`, and on some `MiniMax-M2.7` requests.** It is ignored on `gemma-4-31B-it` and on the other `MiniMax-M2.7` requests
- **Action: send `logit_bias` only to `gpt-oss-120b`.** The OpenAI SDKs retry a 500 twice
**Clarification: how `repetition_penalty` and `seed` behave**
- **`repetition_penalty` applies on `/v1/chat/completions` only.** `/v1/responses` and `/v1/messages` accept it and ignore it
- **It also penalises tokens in your prompt.** A long system prompt, such as a voice agent's, can lose words it relies on. It is not a drop-in replacement for `frequency_penalty`
- **Higher values lengthen reasoning rather than always truncating.** On `gpt-oss-120b` a one-sentence answer used 104 completion tokens at 1.0 and 244 at 1.3. With a tight `max_tokens` that can truncate the answer. 1.8 still returns no content. Stay at or below 1.2
- **`seed` pins `MiniMax-M2.7` on each of its two deployments**, so the same seed returns one of two texts
- **`DeepSeek-V3.1` added to the parameter table:** `n`, `logprobs` and `seed` work; `repetition_penalty` has no effect
- **`/v1/responses` echoes `frequency_penalty` and `presence_penalty` in the response.** They are still not applied
**Advance notice: stricter validation for penalty parameters**
- **An upcoming platform release will return an error for `frequency_penalty` or `presence_penalty` set to anything other than `0`.** Today these values are accepted and have no effect. We will add the date here once it is set
- **The same release will return an error for `repetition_penalty` on `/v1/responses` and `/v1/messages`**, where it is ignored today
- **Action now: remove `frequency_penalty` and `presence_penalty` from your requests, or set them to `0`, and send `repetition_penalty` to `/v1/chat/completions` only.** Nothing changes for requests that already do this
## **September 11, 2026**
**Correction: five features we listed as unsupported actually work**
- **`n`, `logprobs` and `top_logprobs` work on every model.** `n: 2` returns two choices. `logprobs: true` with `top_logprobs: 3` returns populated token-level logprobs with alternatives
- **`seed` and `logit_bias` work on `gpt-oss-120b`, `DeepSeek-V3.2` and `Meta-Llama-3.3-70B-Instruct`.** On those three a seed pins the response at `temperature` 1.0: the same seed returns the same text every time, and a different seed returns different text. Without a seed the same prompt varies on nearly every request
- **`seed` on `MiniMax-M2.7` narrows the output without pinning it.** A seed leaves two variants rather than one, where the same prompt without a seed varies on every request. It has no effect at all on `gemma-4-31B-it`
- These arrived with a platform release in May 2026 and our documentation was not updated. The unsupported list now contains only the two parameters that really are unsupported
- **A parameter that has no effect on a model is still accepted.** Nothing in the response says it was dropped. See [Supported, but not on every model](/en/features/openai-compatibility#supported-but-not-on-every-model)
**Documentation correction: `frequency_penalty` does nothing, `repetition_penalty` is the one that works**
- **`frequency_penalty` and `presence_penalty` are accepted and ignored on every model.** On all five models at `temperature` 0, both return output byte-identical to sending nothing. `frequency_penalty: 99` is outside the documented range, is not rejected, and is also ignored. `presence_penalty: 99` does return a `400`
- The API reference described both with full OpenAI semantics and no disclaimer. It now states that they are accepted for compatibility and ignored
- **`repetition_penalty` is the parameter that applies.** It was absent from the API reference and is now documented there and on the OpenAI compatibility page, next to `top_k`. Accepted range is 1 to 2; values outside it return a `400`
- **It is honoured on `gpt-oss-120b`, `MiniMax-M2.7` and `gemma-4-31B-it`, and ignored on `DeepSeek-V3.2` and `Meta-Llama-3.3-70B-Instruct`**
- **High values cut the answer short.** On `gpt-oss-120b` at `temperature` 0, 1.3 truncates the response with `finish_reason: "length"`, and 1.8 returns no content at all, the whole budget having gone to reasoning. Start at 1.05 and stay at or below 1.2
- **Action: if you set `frequency_penalty` to stop a repetition loop, it is not doing anything.** Fix `temperature` first, then use `repetition_penalty`
## **September 10, 2026**
**Documentation correction: a retired model returns a plain-text 410**
- Requesting a deprecated model on `/v1/chat/completions` returns HTTP 410 with `content-type: text/plain; charset=utf-8`. **The body is not JSON.** There is no `error` object and no `request_id`, so parsing it raises a decode error
- Official SDKs survive it. The OpenAI Python SDK raises `openai.APIStatusError` with `status_code` 410 and the sentence in `.body`. Clients that call `.json()` on the raw response themselves do not
- The same condition returns JSON on `/v1/responses` (envelope, `type` and `code` both `internal_error`) and `/v1/messages` (Anthropic shape, `not_found_error`)
- The error codes page listed two responses that do not use the envelope. There are **three**. The page, the defensive parsing helper, and the OpenAPI reference now cover all three
- `model_deprecated` is documented as the 410 code, but no endpoint returns it today. The row now says so. A fix is in progress with our platform provider
- **Do not retry a 410.** The condition is permanent. Change the model ID. See [API error codes](/en/api-reference/using-the-api/api-error-codes#responses-that-do-not-use-the-envelope)
## **September 9, 2026**
**Documentation correction: `top_k` is silently disabled at low `temperature`**
- **`top_k` has no effect unless `temperature` is 0.001 or above.** Below that threshold, including when you omit `temperature` entirely, `top_k` is forced to 1 and decoding is greedy. A request carrying `top_k: 40` and no `temperature` returns argmax, and nothing in the response says the value was ignored
- On `gemma-4-31B-it`, `top_k: 40` without `temperature` returns the same text on every request. The same request with `temperature: 1.0` varies on every request
- **Documented the defaults applied when you omit a sampling parameter:** `temperature` 0.0, `top_p` 1.0, `top_k` 1048576, `repetition_penalty` 1.0
- **`top_k` must be 1 or greater.** `-1` and `0` are rejected with a 400 on `/v1/chat/completions` and `/v1/messages`. They are accepted on `/v1/responses`, which does not validate the lower bound, but they do not mean "unrestricted" anywhere. The API reference stated a maximum of 100 for `top_k`; no upper bound is enforced
- The byte-identical output you get when you omit `temperature` is **not** a pinned seed. It is the forced `top_k` of 1. Do not rely on it across releases
- Documented why `MiniMax-M2.7` samples while the other models decode greedily: on the MiniMax bundles only, unset sampling parameters are backfilled from the checkpoint's own `generation_config.json`
- **Action: set `temperature` explicitly before you tune `top_k`.** See [How top_k interacts with temperature](/en/models/infercomcloud-models#how-top_k-interacts-with-temperature)
**Platform maintenance release: vision tool calling, reasoning token counts, error envelope**
- **Vision requests now support tools and structured output.** `gemma-4-31B-it` honours `tools`, `tool_choice` and `response_format` on requests that carry an image. The constraint is applied during generation. See [Vision](/en/features/vision#tools-and-structured-output-with-images)
- **Reasoning token counts are reported on every EU model.** Read `usage.completion_tokens_details.reasoning_tokens` to budget and bill reasoning separately from the visible answer. It was previously `null` on `gemma-4-31B-it`. See [Counting reasoning tokens](/en/build/reasoning#counting-reasoning-tokens)
- **Malformed image data returns HTTP 400, not 500.** This is a permanent error. Do not retry it
- **Errors use a consistent JSON envelope, with two exceptions.** The response carries a `request_id` you should quote in every support report. A malformed image and an unhonoured forced `tool_choice` still return a flat shape where `error` is a string. See [API error codes](/en/api-reference/using-the-api/api-error-codes)
- **Streaming tool calls on `gpt-oss-120b` are clean.** No reasoning scaffolding leaks into `delta.content`. Note that the same model adds a `channel` field to the delta on streams with no tools - ignore delta fields you do not recognise. See [Streaming tool calls](/en/features/function-calling#streaming-tool-calls)
- **Documentation corrections:** the audio page listed `stream_options` as an accepted parameter. The endpoint rejects it with HTTP 400. `response_format` honours only `json` and `text`; `verbose_json`, `srt` and `vtt` are accepted but return plain text. See [Audio](/en/features/audio#response-formats)
## **August 18, 2026**
**Documentation correction: `temperature` has no default**
- The API reference stated a default `temperature` of 0.7 on `/v1/chat/completions` and `/v1/responses`. That default does not exist. The claim is removed from the OpenAPI spec and from every page that repeated it
- Omit `temperature` and `gemma-4-31B-it`, `gpt-oss-120b`, `DeepSeek-V3.2`, and `Meta-Llama-3.3-70B-Instruct` decode greedily. `MiniMax-M2.7` samples. The same applies on `/v1/chat/completions`, `/v1/responses`, and `/v1/messages`
- Greedy decoding is the setting most likely to send a reasoning model into a non-terminating repetition loop, so requests that set no sampling parameters were exposed to the failure the docs warned about
- `/v1/messages` differs from the Anthropic API, which documents a `temperature` default of 1.0. Code ported from the Anthropic SDK switches to greedy decoding unless you set the parameter
- **Action: set `temperature` explicitly on every request.** See [If you omit temperature](/en/models/infercomcloud-models#if-you-omit-temperature)
## **July 16, 2026**
**Deprecation: MiniMax-M2.5 retired**
- `MiniMax-M2.5` is deprecated effective **July 16, 2026, 9:00 PM CEST**. After the cutover, requests to `MiniMax-M2.5` return an error
- Migrate to [`MiniMax-M2.7`](/en/models/infercomcloud-models) (192k context) or [`gemma-4-31B-it`](/en/models/infercomcloud-models) (cost-efficient, vision-capable)
- [Model overview](/en/models/infercomcloud-models), [rate limits](/en/models/rate-limits), and [deprecations](/en/models/deprecations) updated
## **July 3, 2026**
**Upcoming Deprecation: MiniMax-M2.5**
- `MiniMax-M2.5` will be deprecated on **July 16, 2026 at 9:00 PM CEST**
- Recommended replacements: `MiniMax-M2.7` (complex reasoning, 192k context) or `gemma-4-31B-it` (cost-efficient, vision-capable)
- Both replacement models are already live - migrate before July 16th to avoid service disruption
- See [deprecations](/en/models/deprecations) for migration guidance
## **June 20, 2026**
**Model Update: Gemma 4 replaces Gemma 3**
- `gemma-3-12b-it` has been removed and replaced by [`gemma-4-31B-it`](/en/models/infercomcloud-models) in a single switchover. Requests to `gemma-3-12b-it` are no longer served - update your integrations to use the `gemma-4-31B-it` model ID
- Gemma 4 is EU-hosted on Infercom's sovereign infrastructure with full data sovereignty, offering a 128k context window and improved performance while maintaining vision support
- [Vision guide](/en/features/vision) updated with `gemma-4-31B-it` examples
- [Rate limits](/en/models/rate-limits) and [deprecations](/en/models/deprecations) updated
## **June 5, 2026**
**New Models: Whisper-Large-v3 and E5-Mistral-7B-Instruct**
- [Whisper-Large-v3](/en/features/audio) is now available for audio transcription and translation - OpenAI's state-of-the-art ASR model, EU-hosted with full data sovereignty
- [E5-Mistral-7B-Instruct](/en/features/embeddings) is now available for generating embeddings - high-quality vector representations for RAG, search, and classification workflows
- Both models run on EU sovereign infrastructure with no data leaving EU jurisdiction
- [Rate limits](/en/models/rate-limits) updated for both models
- [Model overview](/en/models/infercomcloud-models) updated with new embedding and audio model sections
## **May 24, 2026**
**Anthropic SDK Compatibility**
- New `/v1/messages` endpoint for Anthropic SDK compatibility
- Use the Anthropic Python SDK with Infercom models - just change the base URL
- Supports streaming, system prompts, multi-turn conversations, and tool use
- [Documentation](/en/features/anthropic-compatibility)
## **May 22, 2026**
**New Model: MiniMax-M2.7**
- [MiniMax-M2.7](/en/models/infercomcloud-models) is now available as an EU-hosted model with 192K context window
- Recommended for agentic coding workflows - replaces M2.5 as the default recommendation
- MiniMax-M2.5 (160K context) remains available but will be deprecated in a future release
- [Rate limits](/en/models/rate-limits) updated for MiniMax-M2.7
## **May 15, 2026**
**Responses API**
- New `POST /v1/responses` endpoint for agentic workflows - supports function tools, streaming, and reasoning effort control
- Compatible with OpenAI Responses API standard
- Supported models: `MiniMax-M2.7`, `MiniMax-M2.5`, `gpt-oss-120b`
- [Documentation](/en/features/responses-api)
**Model Update**
- `gemma-3-12b-it` moved to EU sovereign infrastructure - first vision-capable model with full EU data sovereignty
- [Vision guide](/en/features/vision)
**New Integration**
- Codex CLI now supported via Responses API
- Updated Cline and OpenCode guides with Plan/Execute configuration pattern
## **April 24, 2026**
**Model Catalog Updates**
- **DeepSeek-V3.1 moved to Global Model Catalog**: Now served via proxy (US region) instead of EU-hosted infrastructure
- **gemma-3-12b-it added**: Google's Gemma 3 12B model now available via Global Model Catalog (Japan). This is the first **vision-capable** model on Infercom — see [Vision guide](/en/features/vision)
- **DeepSeek-V3.2 context length corrected**: Updated from 8k to 32k tokens
- **EU-hosted models**: MiniMax-M2.5 and gpt-oss-120b remain as the sovereign EU options
**Documentation Updates**
- Updated [Vision guide](/en/features/vision) with gemma-3-12b-it examples and sovereignty notice
- Added Capabilities column to [model overview](/en/models/infercomcloud-models) tables
## **April 6, 2026**
**New Documentation: Agentic Coding**
- Added Agentic Coding section with guides for 9 AI coding tools
- **Terminal tools:** Aider, OpenCode, Goose, Warp
- **IDE tools:** Cursor, Cline, Continue, Windsurf
- **Advanced:** Claude Code via ccproxy
- Tool comparison guide - Recommendations for choosing the right tool
## **April 3, 2026**
**Global Model Catalog Streamlined**
- Reduced Global Model Catalog to 2 models: `Meta-Llama-3.3-70B-Instruct` (128k) and `DeepSeek-V3.2` (8k)
- 8 models deprecated: Qwen3-32B, Qwen3-235B, DeepSeek-R1-0528, DeepSeek-R1-Distill-Llama-70B, DeepSeek-V3-0324, DeepSeek-V3.1-Terminus, Llama-4-Maverick-17B-128E-Instruct, Meta-Llama-3.1-8B-Instruct
- See [deprecations](/en/models/deprecations) for migration guidance
- Fixed MiniMax-M2.5 context length to 160k (was incorrectly listed as 164k)
## **March 12, 2026**
**Model Update: MiniMax M2.5 replaces Meta-Llama-3.3-70B-Instruct**
- [MiniMax M2.5](/en/models/infercomcloud-models) is now available as an EU-hosted model on Infercom's sovereign infrastructure in Germany
- Meta-Llama-3.3-70B-Instruct has been deprecated and removed from the platform. See [deprecations](/en/models/deprecations) for migration guidance
- [Rate limits](/en/models/rate-limits) updated for MiniMax M2.5
## **February 27, 2026**
**Global Model Catalog Launch**
- 9 new models available through the [Global Model Catalog](/en/models/infercomcloud-models#global-model-catalog), including DeepSeek-R1-0528, Qwen3-235B, Llama-4-Maverick, and more
- EU-hosted and globally-routed models are now clearly separated in the [model overview](/en/models/infercomcloud-models)
- [Rate limits](/en/models/rate-limits) updated for all 12 models across Free and Developer tiers
- API `sn_metadata` now returns `is_external` and `region` fields for all models
## **February 14, 2026**
**New Documentation**
- Added [Performance & Latency](/en/features/performance) guide covering connection pooling, response performance metadata, streaming optimization, and best practices for minimizing latency
## **February 5, 2026**
**Documentation for Global Model Catalog**
- Added documentation for the [Global Model Catalog](/en/models/infercomcloud-models#global-model-catalog), covering EU-hosted and globally-routed models
- Documented how to [identify model regions](/en/models/infercomcloud-models#identifying-model-regions) via the API (`sn_metadata.region`) and the Playground
- Updated [API reference](/en/api-reference/overview#model-sovereignty-metadata) with `sn_metadata` schema and `?verbose=true` query parameter
- Reviewed and qualified sovereignty claims across documentation to reflect Global Model Catalog
## **January 23, 2026**
**Model Update**
- Updated DeepSeek model from `DeepSeek-V3-0324-cb` to `DeepSeek-V3.1` with expanded 128k context window
- The previous model has been deprecated and is listed on the [deprecations page](/en/models/deprecations)
- Updated [rate limits](/en/models/rate-limits) for all models
## **January 13, 2026**
**New**
- [Hugging Face Spaces Chat Demo](https://huggingface.co/spaces/infercomai/chat) - Interactive chat with model selection and real-time performance metrics
**Improvements**
- Documentation cleanup and link fixes
## **December 30, 2025**
Updated the model catalog to reflect currently available models on Infercom Inference Service. The [model list](/en/models/infercomcloud-models) and [rate limits](/en/models/rate-limits) documentation have been updated accordingly.
## **November 17, 2025**
We are pleased to announce the launch of Infercom's documentation portal. This comprehensive documentation has been created based on SambaNova's documentation (dated October 7, 2025) and adapted for Infercom's EU sovereign AI inference platform.
**Key features**
- Complete API reference documentation with OpenAI-compatible endpoints.
- Developer guides for integrating with Infercom's inference platform.
- Model catalog and configuration documentation for all supported models.
- Platform architecture and deployment guides.
- Usage examples in **Python** and **TypeScript**, powered by OpenAI-compatible SDKs.
All documentation will be continuously updated to reflect Infercom-specific features, European data sovereignty capabilities, and platform enhancements as they become available.
# Glossary
Source: https://docs.infercom.ai/en/resources/glossary
**API Key**
An API key is used to authenticate your requests and is a unique jumble letters and numbers to keep secret. For example, in code portions like ``, you substitute your actual key value in the brackets.
**Endpoint path**
The path to the endpoint determines the action to be completed from the server.
**Model name**
An API request needs the complete model name to properly connect to. A complete name, like Meta-Llama-3.1-405b-Instruct, may be shortened to Llama 3.1 405B in casual reference. When making a request, use the complete names available on the [Infercom Inference Service models](/en/models/infercomcloud-models) page.
**Prompt input**
Prompts are distinguished by two different roles: `‘system’` and `‘user’`. System prompts configure the behavior of the model when returning your request. User prompts dynamically outline the instructions for a model to complete a task or query.
**Stop sequence**
List of sequences where the API will stop generating further tokens. This can be a string, or an array of strings.
## Model Parameters
**max_tokens**
The maximum number of tokens to generate.
**Stream**
This decides whether the response is a stream or a single response.
**Stream options**
If set, an additional chunk will be streamed before the data: [DONE] message. The usage field on this chunk shows the token usage statistics for the entire request, and the choices field will always be an empty array. All other chunks will also include a usage field with a null value. The usage metrics include OpenAI metrics and some additional metrics supported by Infercom Inference Service.
**temperature**
Determines the degree of randomness in the response.
**top_p**
The top_p (nucleus) parameter is used to dynamically adjust the number of choices for each predicted token based on the cumulative probabilities.
**top_k**
The top_k(type: number) parameter is used to limit the number of choices for the next predicted word or token. Default value is `MAX_INT`.