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

# Update LLM Provider

Update an existing LLM provider configuration.

## Path Parameters

| Parameter | Type   | Required | Description                                                        |
| --------- | ------ | -------- | ------------------------------------------------------------------ |
| provider  | string | yes      | The provider to update configuration for (e.g., openai, anthropic) |

## Request Body

You can update either or both of these fields:

```json theme={null}
{
  "enabled": true,
  "credentials": {
    "api_key": "sk-new-api-key"
  }
}
```

## Response Examples

### Success Response

```json theme={null}
{
  "provider": "openai",
  "enabled": true,
  "credentials": {
    "api_key": "sk-***"
  }
}
```

### Provider Not Found

```json theme={null}
{
  "error": {
    "code": "NOT_FOUND",
    "message": "No configuration found for provider: openai"
  }
}
```

## Usage Examples

### Enable/Disable a Provider

```bash theme={null}
curl -X PUT "https://api.psci.ai/api/v1/llm-provider/openai" \
  -H "Authorization: Bearer ${API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{"enabled": false}'
```

### Update Credentials

```bash theme={null}
curl -X PUT "https://api.psci.ai/api/v1/llm-provider/openai" \
  -H "Authorization: Bearer ${API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{
    "credentials": {
      "api_key": "sk-new-api-key",
      "organization": "org-new-org-id"
    }
  }'
```


## OpenAPI

````yaml PUT /v1/llm-provider/{provider}
openapi: 3.1.0
info:
  title: re-factor API Reference
  version: 1.0.0
  description: API specification for re-factor system based on schema definitions
servers: []
security:
  - BearerAuth: []
paths:
  /v1/llm-provider/{provider}:
    put:
      summary: Update LLM provider configuration
      parameters:
        - name: provider
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/LLMProvidersEnum'
          description: The LLM provider to update configuration for
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                enabled:
                  type: boolean
                  description: Whether the provider is enabled
                credentials:
                  type: object
                  additionalProperties: true
                  description: The credentials for the provider
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LLMProviderConfig'
        '400':
          $ref: '#/components/responses/BadRequestError'
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '403':
          $ref: '#/components/responses/ForbiddenError'
        '404':
          $ref: '#/components/responses/NotFoundError'
        '500':
          $ref: '#/components/responses/InternalError'
components:
  schemas:
    LLMProvidersEnum:
      type: string
      enum:
        - openai
        - anthropic
        - google
        - google-vertex
        - azure
        - amazon-bedrock
        - xai
      description: The provider to use for LLM access
    LLMProviderConfig:
      type: object
      properties:
        provider:
          $ref: '#/components/schemas/LLMProvidersEnum'
        enabled:
          type: boolean
          description: Whether the provider is enabled
        credentials:
          type: object
          additionalProperties: true
          description: The credentials for the provider
  responses:
    BadRequestError:
      description: Bad Request
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
    UnauthorizedError:
      description: Unauthorized
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
    ForbiddenError:
      description: Forbidden
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
    NotFoundError:
      description: Not Found
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
    InternalError:
      description: Internal Server Error
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````