> ## Documentation Index
> Fetch the complete documentation index at: https://docs.infercom.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Implement OpenAI-Compatible Features - Developer Guide

> Use OpenAI client libraries with the Infercom API. Drop-in compatible — just change the base URL and API key to switch to EU sovereign inference.

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 theme={null}
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.

<Note>
  Don't have an Infercom API key? Get yours from the [API keys and URLs](/en/get-started/api-keys-urls) page.
</Note>

```python theme={null}
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 theme={null}
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 theme={null}
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)
```

<Note>
  In streaming mode, the API returns chunks that contain multiple tokens. When calculating metrics like tokens per second or time per output token, ensure that you account for all tokens in each chunk.
</Note>

## Currently unsupported OpenAI features

The following features are not yet supported and will be ignored:

* `logprobs`
* `top_logprobs`
* `n`
* `presence_penalty`
* `frequency_penalty`
* `logit_bias`
* `seed`

## 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`.

## Infercom API features not supported by OpenAI clients

The Infercom API supports the `top_k` parameter, which is not supported by the OpenAI client libraries.
