OpenAI comp - Get model details?

Hi,

I’m trying to figure out the correct URL for REST call to retrieve model details using the Open AI compatibility layer.

According to the API reference - OpenAI compatibility  |  Gemini API  |  Google AI for Developers - it should be one of the likes.

GET https://generativelanguage.googleapis.com/v1beta/openai/models?model=gemini-1.5-flash
GET https://generativelanguage.googleapis.com/v1beta/openai/models/?model=gemini-1.5-flash
GET https://generativelanguage.googleapis.com/v1beta/openai/models/gemini-1.5-flash

However, none of them return a result other than HTTP 400 Bad Request

{
  "error": {
    "code": 400,
    "message": "* GetModelRequest.name: unexpected model name format\n",
    "status": "INVALID_ARGUMENT"
  }
}

The corresponding REST call to list all models works as expected.

GET https://generativelanguage.googleapis.com/v1beta/openai/models

Any comment or hints are welcome. Thanks.

@Logan_Kilpatrick @GUNAND_MAYANGLAMBAM

For completeness, here’s the actual REST call.

GET https://generativelanguage.googleapis.com/v1beta/openai/models/gemini-2.0-flash
Authorization: Bearer {{apiKey}}

Which, to my understanding, is as per API reference documentation and should work instead of responding with an HTTP 400 Bad Request.

Cheers

1 Like

Hey @jkirstaetter , Just confirming: are you getting an HTTP 400 error or 501 (Unimplemented) error?

I tested it from my end and I got 501 (Unimplemented) error.

Seems like the ‘List models’ and ‘Retrieve a model’ functionalities have not been implemented, according to the error I got.

1 Like

Hi @GUNAND_MAYANGLAMBAM

Previously, I got HTTP 200 OK on the list models and HTTP 400 Bad Request on the get model endpoints.

Now, I’m getting HTTP 501 Not Implemented on both.

Seems like the team disabled those API endpoints. Wondering when the documentation will be removed or hopefully updated.

Cheers.

2 Likes

Same for me, I began receiving those errors about 3 days ago. Before this, everything was working fine.

However, i can still access the models themselves, meaning, if i hard-specify flash-2.0 i.e., the requests succeed.

Maybe they misimplemented something and pushed code, that is not working correctly?

1 Like

The endpoints are working now. Let me know if you are still facing the issue.

Hi @GUNAND_MAYANGLAMBAM

Wonderful! Hereby confirming that endpoints to list models and to get a model are returning results. Interestingly, the list of models is now aligned with the list of models by the SDK itself. Just different format with less detail information about the model.

# List models
GET https://generativelanguage.googleapis.com/v1beta/openai/models
Authorization: Bearer {{apiKey}}

# Get a model 
GET https://generativelanguage.googleapis.com/v1beta/openai/models/gemini-1.5-flash
Authorization: Bearer {{apiKey}}

{
  "id": "models/gemini-1.5-flash",
  "object": "model",
  "owned_by": "google"
}

Thanks for the heads up!

Cheers