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

# Create LLM Provider

Create a new LLM provider configuration.

## Request Body

```json theme={null}
{
  "provider": "openai",
  "enabled": true,
  "credentials": {
    "api_key": "sk-your-api-key",
    "organization": "org-your-org-id"  // optional
  }
}
```

### Provider-Specific Credentials

#### OpenAI

```json theme={null}
{
  "api_key": "sk-...",
  "organization": "org-..."  // optional
}
```

#### Anthropic

```json theme={null}
{
  "api_key": "sk-ant-..."
}
```

#### Google

```json theme={null}
{
  "api_key": "..."
}
```

#### Azure

```json theme={null}
{
  "api_key": "...",
  "endpoint": "https://your-resource.openai.azure.com",
  "deployment_id": "..."
}
```

#### Amazon Bedrock

```json theme={null}
{
  "aws_access_key_id": "...",
  "aws_secret_access_key": "...",
  "region": "us-west-2"
}
```

## Response Examples

### Success Response

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

### Provider Already Exists

```json theme={null}
{
  "error": {
    "code": "CONFLICT",
    "message": "Configuration already exists for provider: openai"
  }
}
```


## OpenAPI

````yaml POST /v1/llm-providers
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-providers:
    post:
      summary: Create a new LLM provider configuration
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LLMProviderConfig'
      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'
        '409':
          $ref: '#/components/responses/ConflictError'
        '500':
          $ref: '#/components/responses/InternalError'
components:
  schemas:
    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
    LLMProvidersEnum:
      type: string
      enum:
        - openai
        - anthropic
        - google
        - google-vertex
        - azure
        - amazon-bedrock
        - xai
      description: The provider to use for LLM access
  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
    ConflictError:
      description: Conflict
      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

````