# Creating a client

> A guide for creating Cohere API client using Cohere SDK, supported in 4 different languages – Python, TypeScript, Java, and Go.

## Creating Cohere API Client

To start using all features available in the Cohere SDK, you should create a client first.

<Tabs>
  <Tab title="Python">
    ```python
    import cohere

    co = cohere.ClientV2(api_key="YOUR_API_KEY")
    ```

    [Source](https://github.com/cohere-ai/cohere-python)

    The Cohere API client initializes with the following parameters:

    | Parameter              | Type                 | Default                        | Description                                                                 |
    | ---------------------- | -------------------- | ------------------------------ | --------------------------------------------------------------------------- |
    | `api_key`              | `str/callable`       | `None`                         | API key for authenticating requests to the Cohere V2 API.                   |
    | `base_url`             | `str`                | `os.getenv("CO_API_URL")`      | Base URL for the Cohere API.                                                |
    | `environment`          | `ClientEnvironment`  | `ClientEnvironment.PRODUCTION` | Specifies the API environment (e.g., production, staging).                  |
    | `client_name`          | `str`                | `None`                         | Optional name for the client instance, useful for logging.                  |
    | `timeout`              | `float`              | `None`                         | Timeout in seconds for API requests.                                        |
    | `httpx_client`         | `httpx.Client`       | `None`                         | Optional pre-configured `httpx.Client` for making HTTP requests.            |
    | `thread_pool_executor` | `ThreadPoolExecutor` | `ThreadPoolExecutor(64)`       | Thread pool executor for concurrent operations, with 64 threads by default. |
    | `log_experimental`     | `bool`               | `True`                         | Enables/disables warnings for experimental features.                        |
  </Tab>

  <Tab title="TypeScript">
    ```typescript
    import { CohereClientV2 } from 'cohere-ai';

    const cohere = new CohereClientV2({ token: 'YOUR_API_KEY' });
    ```

    [Source](https://github.com/cohere-ai/cohere-typescript)

    The Cohere API client initializes with the following parameters:

    | Parameter    | Type                    | Default                      | Description                                                               |
    | ------------ | ----------------------- | ---------------------------- | ------------------------------------------------------------------------- |
    | `token`      | `string`                | `undefined`                  | **Required.** API key used for authenticating requests to the Cohere API. |
    | `baseUrl`    | `string`                | `"https://api.cohere.ai/v1"` | Base URL endpoint for the Cohere API.                                     |
    | `clientName` | `string`                | `undefined`                  | Optional identifier for the client instance, useful for logging.          |
    | `timeout`    | `number` (milliseconds) | `120000` (120 seconds)       | Request timeout in milliseconds.                                          |
    | `fetch`      | `typeof fetch`          | Global `fetch`               | Custom fetch implementation for HTTP requests.                            |
  </Tab>

  <Tab title="Java">
    ```java
    import com.cohere.api.Cohere;

    Cohere cohere = Cohere.builder()
                          .token("YOUR_API_KEY")
                          .clientName("your-client-name")
                          .build();

    ```

    [Source](https://github.com/cohere-ai/cohere-java)

    The Cohere API client initializes with the following parameters:

    | Parameter      | Type           | Default                      | Description                                                    |
    | -------------- | -------------- | ---------------------------- | -------------------------------------------------------------- |
    | `token`        | `String`       | `null`                       | **Required.** Your Cohere API key for authenticating requests. |
    | `baseUrl`      | `String`       | `"https://api.cohere.ai/v1"` | The base URL for the Cohere API.                               |
    | `clientName`   | `String`       | `null`                       | Optional identifier for your client application.               |
    | `timeout`      | `Duration`     | `null`                       | Timeout duration for API requests.                             |
    | `okHttpClient` | `OkHttpClient` | `null`                       | Custom `OkHttpClient` instance for making HTTP requests.       |
  </Tab>

  <Tab title="Go">
    ```go
    import (
        client "github.com/cohere-ai/cohere-go/v2/client"
    )

    co := client.NewClient(client.WithToken("YOUR_API_KEY"))
    ```

    [Source](https://github.com/cohere-ai/cohere-go)

    The Cohere API client initializes with the following parameters:

    | Parameter    | Type           | Default                      | Description                                                    |
    | ------------ | -------------- | ---------------------------- | -------------------------------------------------------------- |
    | `token`      | `string`       | `""` (empty string)          | **Required.** Your Cohere API key for authenticating requests. |
    | `baseURL`    | `string`       | `"https://api.cohere.ai/v1"` | The base URL for the Cohere API.                               |
    | `httpClient` | `*http.Client` | `http.DefaultClient`         | Custom HTTP client for making requests.                        |
  </Tab>
</Tabs>