yym68686 / uni-api

This is a project that unifies the management of LLM APIs. It can call multiple backend services through a unified API interface, convert them to the OpenAI format uniformly, and support load balancing. Currently supported backend services include: OpenAI, Anthropic, DeepBricks, OpenRouter, Gemini, Vertex, etc.
369 stars 46 forks source link

image creation not work with `aimlapi.com` #38

Closed ratu-sh closed 2 weeks ago

ratu-sh commented 2 weeks ago
  - provider: aimlapi-images
    base_url: https://api.aimlapi.com/v1/images/generations
    api: ********************
    model:
      - prompthero/openjourney: openjourney-v4
      - runwayml/stable-diffusion-v1-5: stable-diffusion-v1-5
      - SG161222/Realistic_Vision_V3.0_VAE: realistic-vision-v3-0
      - stabilityai/stable-diffusion-2-1: stabilityai-sd-2-1
      - stabilityai/stable-diffusion-xl-base-1.0: stabilityai-sdxl-1-0
      - wavymulder/Analog-Diffusion: analog-diffusion
      - flux/schnell: flux-schnell
      - flux-pro: flux-pro
      - flux/dev: flux-dev
      - flux/dev/image-to-image: flux-img2img
      - flux-realism: flux-realism-lora
      - stable-diffusion-v3-medium: stabilityai-sd-3
      - dall-e-3: dalle-3
      - dall-e-2: dalle-2
    tools: true
    preferences:
      api_key_rate_limit:
        default: 1500/hour
      api_key_cooldown_period: 60
INFO:     10.60.0.2:56154 - "POST /v1/chat/completions HTTP/1.1" 400 Bad Request
2024-11-08 13:47:48,274 - uni-api - INFO - provider: aimlapi-images model: openjourney-v4         engine: openrouter
2024-11-08 13:47:48,679 - uni-api - ERROR - Error 400 with provider aimlapi-images API key: ********************: {'requestId': '062c6a47-f686-48eb-9338-2fdc88b93cfa', 'statusCode': 400, 'timestamp': '2024-11-08T13:47:48.395Z', 'path': '/v1/images/generations', 'meta': {'_errors': ["Unrecognized key(s) in object: 'messages', 'stream'", "Unrecognized key(s) in object: 'messages', 'stream'"], 'prompt': {'_errors'
INFO:     10.60.0.2:56154 - "POST /v1/chat/completions HTTP/1.1" 400 Bad Request
2024-11-08 13:49:33,606 - uni-api - INFO - provider: aimlapi-images model: stable-diffusion-v1-5  engine: openrouter
2024-11-08 13:49:34,117 - uni-api - ERROR - Error 400 with provider aimlapi-images API key:  ********************: {'requestId': '482a428c-17cd-4eb4-a39f-316b040d630f', 'statusCode': 400, 'timestamp': '2024-11-08T13:49:33.759Z', 'path': '/v1/images/generations', 'meta': {'_errors': ["Unrecognized key(s) in object: 'messages', 'stream'", "Unrecognized key(s) in object: 'messages', 'stream'"], 'prompt': {'_errors'
INFO:     10.60.0.2:52618 - "POST /v1/chat/completions HTTP/1.1" 400 Bad Request
2024-11-08 13:49:44,407 - uni-api - INFO - provider: aimlapi-images model: stabilityai-sd-3       engine: openrouter
2024-11-08 13:49:44,811 - uni-api - ERROR - Error 400 with provider aimlapi-images API key:  ********************: {'requestId': 'c559e1f3-55df-4c0e-91dc-41fc569afec8', 'statusCode': 400, 'timestamp': '2024-11-08T13:49:44.531Z', 'path': '/v1/images/generations', 'meta': {'_errors': ["Unrecognized key(s) in object: 'messages', 'stream'", "Unrecognized key(s) in object: 'messages', 'stream'"], 'prompt': {'_errors'
INFO:     10.60.0.2:60008 - "POST /v1/chat/completions HTTP/1.1" 400 Bad Request
yym68686 commented 2 weeks ago

Your configuration file is incorrect, it should be configured like this:

  - provider: aimlapi-images
    base_url: https://api.aimlapi.com/v1/chat/completions
    api: 0e9ec2ae65d84929923909483ad66b0b
    model:
      - prompthero/openjourney: openjourney-v4
      - runwayml/stable-diffusion-v1-5: stable-diffusion-v1-5
      - SG161222/Realistic_Vision_V3.0_VAE: realistic-vision-v3-0
      - stabilityai/stable-diffusion-2-1: stabilityai-sd-2-1
      - stabilityai/stable-diffusion-xl-base-1.0: stabilityai-sdxl-1-0
      - wavymulder/Analog-Diffusion: analog-diffusion
      - flux/schnell: flux-schnell
      - flux-pro: flux-pro
      - flux/dev: flux-dev
      - flux/dev/image-to-image: flux-img2img
      - flux-realism: flux-realism-lora
      - stable-diffusion-v3-medium: stabilityai-sd-3
      - dall-e-3: dalle-3
      - dall-e-2: dalle-2
    tools: true
    engine: dalle
    preferences:
      api_key_rate_limit:
        default: 1500/hour
      api_key_cooldown_period: 60
image
ratu-sh commented 2 weeks ago

500 Internal Server Error {"error":"All flux-pro error: 'RequestModel' object has no attribute 'prompt'"} 500 Internal Server Error {"error":"All openjourney-v4 error: 'RequestModel' object has no attribute 'prompt'"} 500 Internal Server Error {"error":"All stabilityai-sd-3 error: 'RequestModel' object has no attribute 'prompt'"}

btw, you reveal my API key, so I disable it. if you need new one, i can send you

yym68686 commented 2 weeks ago

500 Internal Server Error {"error":"All flux-pro error: 'RequestModel' object has no attribute 'prompt'"} 500 Internal Server Error {"error":"All openjourney-v4 error: 'RequestModel' object has no attribute 'prompt'"} 500 Internal Server Error {"error":"All stabilityai-sd-3 error: 'RequestModel' object has no attribute 'prompt'"}

btw, you reveal my API key, so I disable it. if you need new one, i can send you

The prompt field is required for generating images, and if it's missing, an error will occur.

ratu-sh commented 2 weeks ago

500 Internal Server Error {"error":"All flux-pro error: 'RequestModel' object has no attribute 'prompt'"} 500 Internal Server Error {"error":"All openjourney-v4 error: 'RequestModel' object has no attribute 'prompt'"} 500 Internal Server Error {"error":"All stabilityai-sd-3 error: 'RequestModel' object has no attribute 'prompt'"} btw, you reveal my API key, so I disable it. if you need new one, i can send you

The prompt field is required for generating images, and if it's missing, an error will occur.

how could this field be missing through your telegram bot? bot not allow to customize this fields. i am sure that for "prompt" filed your bot takes user message

yym68686 commented 2 weeks ago

500 Internal Server Error {"error":"All flux-pro error: 'RequestModel' object has no attribute 'prompt'"} 500 Internal Server Error {"error":"All openjourney-v4 error: 'RequestModel' object has no attribute 'prompt'"} 500 Internal Server Error {"error":"All stabilityai-sd-3 error: 'RequestModel' object has no attribute 'prompt'"} btw, you reveal my API key, so I disable it. if you need new one, i can send you

The prompt field is required for generating images, and if it's missing, an error will occur.

how could this field be missing through your telegram bot? bot not allow to customize this fields. i am sure that for "prompt" filed your bot takes user message

Hello, the tg bot can only be used for chatting and cannot directly generate images. The tg bot uses external functions through llm's tools use to draw images. Currently, switching image generation models is not supported, and only dalle3 can be used. If you want the tg bot to support other image generation models, you can submit an issue in the tg bot repository. This issue will be permanently closed and will not be responded to further.