For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://modelgates.ai/docs/_mcp/server.

Get remaining credits

GET https://modelgates.ai/api/v1/credits

Get total credits purchased and used for the authenticated user. Management key required.

Reference: https://modelgates.ai/docs/api/api-reference/credits/get-credits

OpenAPI Specification

yaml
openapi: 3.1.0info:  title: ModelGates API  version: 1.0.0paths:  /credits:    get:      operationId: get-credits      summary: Get remaining credits      description: >-        Get total credits purchased and used for the authenticated user.        [Management key](/docs/guides/overview/auth/management-api-keys)        required.      tags:        - subpackage_credits      parameters:        - name: Authorization          in: header          description: API key as bearer token in Authorization header          required: true          schema:            type: string      responses:        '200':          description: Returns the total credits purchased and used          content:            application/json:              schema:                $ref: '#/components/schemas/Credits_getCredits_Response_200'        '401':          description: Unauthorized - Authentication required or invalid credentials          content:            application/json:              schema:                $ref: '#/components/schemas/UnauthorizedResponse'        '403':          description: Forbidden - Authentication successful but insufficient permissions          content:            application/json:              schema:                $ref: '#/components/schemas/ForbiddenResponse'        '500':          description: Internal Server Error - Unexpected server error          content:            application/json:              schema:                $ref: '#/components/schemas/InternalServerResponse'servers:  - url: https://modelgates.ai/api/v1components:  schemas:    CreditsGetResponsesContentApplicationJsonSchemaData:      type: object      properties:        total_credits:          type: number          format: double          description: Total credits purchased        total_usage:          type: number          format: double          description: Total credits used      required:        - total_credits        - total_usage      title: CreditsGetResponsesContentApplicationJsonSchemaData    Credits_getCredits_Response_200:      type: object      properties:        data:          $ref: >-            #/components/schemas/CreditsGetResponsesContentApplicationJsonSchemaData      required:        - data      description: Total credits purchased and used      title: Credits_getCredits_Response_200    UnauthorizedResponseErrorData:      type: object      properties:        code:          type: integer        message:          type: string        metadata:          type:            - object            - 'null'          additionalProperties:            description: Any type      required:        - code        - message      description: Error data for UnauthorizedResponse      title: UnauthorizedResponseErrorData    UnauthorizedResponse:      type: object      properties:        error:          $ref: '#/components/schemas/UnauthorizedResponseErrorData'        modelgates_metadata:          type:            - object            - 'null'          additionalProperties:            description: Any type        user_id:          type:            - string            - 'null'      required:        - error      description: Unauthorized - Authentication required or invalid credentials      title: UnauthorizedResponse    ForbiddenResponseErrorData:      type: object      properties:        code:          type: integer        message:          type: string        metadata:          type:            - object            - 'null'          additionalProperties:            description: Any type      required:        - code        - message      description: Error data for ForbiddenResponse      title: ForbiddenResponseErrorData    ForbiddenResponse:      type: object      properties:        error:          $ref: '#/components/schemas/ForbiddenResponseErrorData'        modelgates_metadata:          type:            - object            - 'null'          additionalProperties:            description: Any type        user_id:          type:            - string            - 'null'      required:        - error      description: Forbidden - Authentication successful but insufficient permissions      title: ForbiddenResponse    InternalServerResponseErrorData:      type: object      properties:        code:          type: integer        message:          type: string        metadata:          type:            - object            - 'null'          additionalProperties:            description: Any type      required:        - code        - message      description: Error data for InternalServerResponse      title: InternalServerResponseErrorData    InternalServerResponse:      type: object      properties:        error:          $ref: '#/components/schemas/InternalServerResponseErrorData'        modelgates_metadata:          type:            - object            - 'null'          additionalProperties:            description: Any type        user_id:          type:            - string            - 'null'      required:        - error      description: Internal Server Error - Unexpected server error      title: InternalServerResponse  securitySchemes:    apiKey:      type: http      scheme: bearer      description: API key as bearer token in Authorization header

SDK Code Examples

python
import requests url = "https://modelgates.ai/api/v1/credits" headers = {"Authorization": "Bearer <token>"} response = requests.get(url, headers=headers) print(response.json())